git-subtree-dir: librocksdb-sys/lz4 git-subtree-split: 5ff839680134437dbf4678f3d0c7b371d84f4964master
commit
c43e79ce9f
@ -0,0 +1,75 @@ |
|||||||
|
# This configuration was automatically generated from a CircleCI 1.0 config. |
||||||
|
# It should include any build commands you had along with commands that CircleCI |
||||||
|
# inferred from your project structure. We strongly recommend you read all the |
||||||
|
# comments in this file to understand the structure of CircleCI 2.0, as the idiom |
||||||
|
# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather |
||||||
|
# than the prescribed lifecycle of 1.0. In general, we recommend using this generated |
||||||
|
# configuration as a reference rather than using it in production, though in most |
||||||
|
# cases it should duplicate the execution of your original 1.0 config. |
||||||
|
version: 2 |
||||||
|
jobs: |
||||||
|
build: |
||||||
|
working_directory: ~/lz4/lz4 |
||||||
|
# Parallelism is broken in this file : it just plays the same tests twice. |
||||||
|
# The script will have to be modified to support parallelism properly |
||||||
|
# In the meantime, set it to 1. |
||||||
|
parallelism: 1 |
||||||
|
shell: /bin/bash --login |
||||||
|
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did. |
||||||
|
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables . |
||||||
|
environment: |
||||||
|
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts |
||||||
|
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results |
||||||
|
# In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages. |
||||||
|
# In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images. |
||||||
|
# The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job. |
||||||
|
# We have selected a pre-built image that mirrors the build environment we use on |
||||||
|
# the 1.0 platform, but we recommend you choose an image more tailored to the needs |
||||||
|
# of each job. For more information on choosing an image (or alternatively using a |
||||||
|
# VM instead of a container) see https://circleci.com/docs/2.0/executor-types/ |
||||||
|
# To see the list of pre-built images that CircleCI provides for most common languages see |
||||||
|
# https://circleci.com/docs/2.0/circleci-images/ |
||||||
|
docker: |
||||||
|
- image: fbopensource/lz4-circleci-primary:0.0.4 |
||||||
|
steps: |
||||||
|
# Machine Setup |
||||||
|
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each |
||||||
|
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out. |
||||||
|
- checkout |
||||||
|
# Prepare for artifact and test results collection equivalent to how it was done on 1.0. |
||||||
|
# In many cases you can simplify this from what is generated here. |
||||||
|
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/' |
||||||
|
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS |
||||||
|
# Test |
||||||
|
# This would typically be a build job when using workflows, possibly combined with build |
||||||
|
# This is based on your 1.0 configuration file or project settings |
||||||
|
- run: CFLAGS= make clangtest && make clean |
||||||
|
- run: g++ -v; make cxxtest && make clean |
||||||
|
- run: gcc -v; g++ -v; make ctocpptest && make clean |
||||||
|
- run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -Werror" make check && make clean |
||||||
|
- run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean |
||||||
|
- run: gcc-6 -v; CC=gcc-6 MOREFLAGS="-O2 -Werror" make check && make clean |
||||||
|
- run: make cmake && make clean |
||||||
|
- run: make -C tests test-lz4 |
||||||
|
- run: make -C tests test-lz4c |
||||||
|
- run: make -C tests test-frametest |
||||||
|
- run: make -C tests test-fuzzer && make clean |
||||||
|
- run: make -C lib all && make clean |
||||||
|
- run: pyenv global 3.4.4; make versionsTest MOREFLAGS=-I/usr/include/x86_64-linux-gnu && make clean |
||||||
|
- run: make travis-install && make clean |
||||||
|
- run: gcc -v; CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean |
||||||
|
- run: clang -v; make staticAnalyze && make clean |
||||||
|
- run: make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static && make clean |
||||||
|
- run: make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS=-m64 && make clean |
||||||
|
- run: make platformTest CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static && make clean |
||||||
|
- run: make platformTest CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static && make clean |
||||||
|
# Teardown |
||||||
|
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each |
||||||
|
# Save test results |
||||||
|
- store_test_results: |
||||||
|
path: /tmp/circleci-test-results |
||||||
|
# Save artifacts |
||||||
|
- store_artifacts: |
||||||
|
path: /tmp/circleci-artifacts |
||||||
|
- store_artifacts: |
||||||
|
path: /tmp/circleci-test-results |
@ -0,0 +1,12 @@ |
|||||||
|
FROM circleci/buildpack-deps:bionic |
||||||
|
|
||||||
|
RUN sudo apt-get -y -qq update |
||||||
|
RUN sudo apt-get -y install software-properties-common |
||||||
|
RUN sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test |
||||||
|
RUN sudo apt-get -y install cmake |
||||||
|
RUN sudo apt-get -y install qemu-system-ppc qemu-user-static qemu-system-arm |
||||||
|
RUN sudo apt-get -y install libc6-dev-armel-cross libc6-dev-arm64-cross libc6-dev-i386 |
||||||
|
RUN sudo apt-get -y install clang clang-tools |
||||||
|
RUN sudo apt-get -y install gcc-5 gcc-5-multilib gcc-6 |
||||||
|
RUN sudo apt-get -y install valgrind |
||||||
|
RUN sudo apt-get -y install gcc-multilib-powerpc-linux-gnu gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu |
@ -0,0 +1,5 @@ |
|||||||
|
freebsd_instance: |
||||||
|
image_family: freebsd-12-2 |
||||||
|
|
||||||
|
task: |
||||||
|
script: pkg install -y gmake && gmake test |
@ -0,0 +1,21 @@ |
|||||||
|
# Set the default behavior |
||||||
|
* text eol=lf |
||||||
|
|
||||||
|
# Explicitly declare source files |
||||||
|
*.c text eol=lf |
||||||
|
*.h text eol=lf |
||||||
|
|
||||||
|
# Denote files that should not be modified. |
||||||
|
*.odt binary |
||||||
|
*.png binary |
||||||
|
|
||||||
|
# Visual Studio |
||||||
|
*.sln text eol=crlf |
||||||
|
*.vcxproj* text eol=crlf |
||||||
|
*.vcproj* text eol=crlf |
||||||
|
*.suo binary |
||||||
|
*.rc text eol=crlf |
||||||
|
|
||||||
|
# Windows |
||||||
|
*.bat text eol=crlf |
||||||
|
*.cmd text eol=crlf |
@ -0,0 +1,32 @@ |
|||||||
|
--- |
||||||
|
name: Bug report |
||||||
|
about: Create a report to help us improve |
||||||
|
title: '' |
||||||
|
labels: '' |
||||||
|
assignees: '' |
||||||
|
|
||||||
|
--- |
||||||
|
|
||||||
|
**Describe the bug** |
||||||
|
A clear and concise description of what the bug is. |
||||||
|
|
||||||
|
**Expected behavior** |
||||||
|
Please describe what you expected to happen. |
||||||
|
|
||||||
|
**To Reproduce** |
||||||
|
Steps to reproduce the behavior: |
||||||
|
1. Go to '...' |
||||||
|
2. Click on '....' |
||||||
|
3. Scroll down to '....' |
||||||
|
4. See error '...' |
||||||
|
If applicable, add screenshots to help explain your problem. |
||||||
|
|
||||||
|
**System (please complete the following information):** |
||||||
|
- OS: [e.g. Mac] |
||||||
|
- Version [e.g. 22] |
||||||
|
- Compiler [e.g. gcc] |
||||||
|
- Build System [e.g. Makefile] |
||||||
|
- Other hardware specs [e.g. Core 2 duo...] |
||||||
|
|
||||||
|
**Additional context** |
||||||
|
Add any other context about the problem here. |
@ -0,0 +1,20 @@ |
|||||||
|
--- |
||||||
|
name: Feature request |
||||||
|
about: Suggest an idea for this project |
||||||
|
title: '' |
||||||
|
labels: '' |
||||||
|
assignees: '' |
||||||
|
|
||||||
|
--- |
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.** |
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] |
||||||
|
|
||||||
|
**Describe the solution you'd like** |
||||||
|
A clear and concise description of what you want to happen. |
||||||
|
|
||||||
|
**Describe alternatives you've considered** |
||||||
|
A clear and concise description of any alternative solutions or features you've considered. |
||||||
|
|
||||||
|
**Additional context** |
||||||
|
Add any other context or screenshots about the feature request here. |
@ -0,0 +1,61 @@ |
|||||||
|
This directory contains [GitHub Actions](https://github.com/features/actions) workflow files. |
||||||
|
|
||||||
|
# Known issues |
||||||
|
|
||||||
|
## USAN, ASAN (`lz4-ubsan-x64`, `lz4-ubsan-x86`, `lz4-asan-x64`) |
||||||
|
|
||||||
|
For now, `lz4-ubsan-*` ignores the exit code of `make usan` and `make usan32`. |
||||||
|
Because there are several issues which may take relatively long time to resolve. |
||||||
|
|
||||||
|
We'll fully enable it when we ensure `make usan` is ready for all commits and PRs. |
||||||
|
|
||||||
|
See [#983](https://github.com/lz4/lz4/pull/983) for details. |
||||||
|
|
||||||
|
|
||||||
|
## C Compilers (`lz4-c-compilers`) |
||||||
|
|
||||||
|
- Our test doesn't use `gcc-4.5` due to installation issue of its package. (`apt-get install gcc-4.5` fails on GH-Actions VM) |
||||||
|
|
||||||
|
- Currently, the following 32bit executable tests fail with all versions of `clang`. |
||||||
|
- `CC=clang-X CFLAGS='-O3' make V=1 -C tests clean test-lz4c32` |
||||||
|
- `CC=clang-X CFLAGS='-O3 -mx32' make V=1 -C tests clean test-lz4c32` |
||||||
|
- See [#991](https://github.com/lz4/lz4/issues/991) for details. |
||||||
|
|
||||||
|
- Currently, the following 32bit executable tests fail with `gcc-11` |
||||||
|
- `CC=gcc-11 CFLAGS='-O3' make V=1 -C tests clean test-lz4c32` |
||||||
|
- `CC=gcc-11 CFLAGS='-O3 -mx32' make V=1 -C tests clean test-lz4c32` |
||||||
|
- See [#991](https://github.com/lz4/lz4/issues/991) for details. |
||||||
|
|
||||||
|
|
||||||
|
## cppcheck (`lz4-cppcheck`) |
||||||
|
|
||||||
|
This test script ignores the exit code of `make cppcheck`. |
||||||
|
Because this project doesn't 100% follow their recommendation. |
||||||
|
Also sometimes it reports false positives. |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Notes |
||||||
|
|
||||||
|
- You can investigate various information at the right pane of GitHub |
||||||
|
Actions report page. |
||||||
|
|
||||||
|
| Item | Section in the right pane | |
||||||
|
| ------------------------- | ------------------------------------- | |
||||||
|
| OS, VM | Set up job | |
||||||
|
| git repo, commit hash | Run actions/checkout@v2 | |
||||||
|
| Version of tools | Environment info | |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Difference with `.travis.yml` |
||||||
|
|
||||||
|
The following tests are not included yet. |
||||||
|
|
||||||
|
- name: Compile OSS-Fuzz targets |
||||||
|
|
||||||
|
The following tests will not be included due to limitation of GH-Actions. |
||||||
|
|
||||||
|
- name: aarch64 real-hw tests |
||||||
|
- name: PPC64LE real-hw tests |
||||||
|
- name: IBM s390x real-hw tests |
@ -0,0 +1,800 @@ |
|||||||
|
# For details, see README.md in this directory. |
||||||
|
|
||||||
|
############################################################### |
||||||
|
# C compilers |
||||||
|
# |
||||||
|
# - gcc |
||||||
|
# - clang |
||||||
|
# |
||||||
|
# Known Issue |
||||||
|
# - All test cases which described as 'fail' must be fixed and replaced with 'true'. |
||||||
|
# - gcc-11 (x32, x86) : "../lib/lz4hc.c:148: LZ4HC_countBack: Assertion `(size_t)(match - mMin) < (1U<<31)' failed." |
||||||
|
# - all clangs (x32, x86) : "../lib/lz4hc.c:282: int LZ4HC_InsertAndGetWiderMatch(...): Assertion `matchPtr >= lowPrefixPtr' failed." |
||||||
|
# |
||||||
|
name: lz4 CI |
||||||
|
on: [push, pull_request] |
||||||
|
permissions: |
||||||
|
contents: read |
||||||
|
|
||||||
|
jobs: |
||||||
|
lz4-c-compilers: |
||||||
|
name: CC=${{ matrix.cc }}, ${{ matrix.os }} |
||||||
|
strategy: |
||||||
|
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. |
||||||
|
matrix: |
||||||
|
include: [ |
||||||
|
# You can access the following values via ${{ matrix.??? }} |
||||||
|
# |
||||||
|
# pkgs : apt-get package names. It can include multiple package names which are delimited by space. |
||||||
|
# cc : C compiler executable. |
||||||
|
# cxx : C++ compiler executable for `make ctocpptest`. |
||||||
|
# x32 : Set 'true' if compiler supports x32. Otherwise, set 'false'. |
||||||
|
# Set 'fail' if it supports x32 but fails for now. 'fail' cases must be removed. |
||||||
|
# x86 : Set 'true' if compiler supports x86 (-m32). Otherwise, set 'false'. |
||||||
|
# Set 'fail' if it supports x86 but fails for now. 'fail' cases must be removed. |
||||||
|
# cxxtest : Set 'true' if it can be compiled as C++ code. Otherwise, set 'false'. |
||||||
|
# freestanding : Set 'true' if it can be compiled and execute freestanding code. Otherwise, set 'false'. |
||||||
|
# Usually, it requires Linux, x86_64 and gcc/g++. |
||||||
|
# os : GitHub Actions YAML workflow label. See https://github.com/actions/virtual-environments#available-environments |
||||||
|
|
||||||
|
# cc |
||||||
|
{ pkgs: '', cc: cc, cxx: c++, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-latest, }, |
||||||
|
|
||||||
|
# gcc |
||||||
|
{ pkgs: '', cc: gcc, cxx: g++, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-latest, }, |
||||||
|
{ pkgs: 'gcc-12 g++-12 lib32gcc-12-dev libx32gcc-12-dev', cc: gcc-12, cxx: g++-12, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'gcc-11 g++-11 lib32gcc-11-dev libx32gcc-11-dev', cc: gcc-11, cxx: g++-11, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'gcc-10 g++-10 lib32gcc-10-dev libx32gcc-10-dev', cc: gcc-10, cxx: g++-10, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'gcc-9 g++-9 lib32gcc-9-dev libx32gcc-9-dev', cc: gcc-9, cxx: g++-9, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'gcc-8 g++-8 lib32gcc-8-dev libx32gcc-8-dev', cc: gcc-8, cxx: g++-8, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-20.04, }, |
||||||
|
{ pkgs: 'gcc-7 g++-7 lib32gcc-7-dev libx32gcc-7-dev', cc: gcc-7, cxx: g++-7, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-20.04, }, |
||||||
|
{ pkgs: 'gcc-6 g++-6 lib32gcc-6-dev libx32gcc-6-dev', cc: gcc-6, cxx: g++-6, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-18.04, }, |
||||||
|
{ pkgs: 'gcc-5 g++-5 lib32gcc-5-dev libx32gcc-5-dev', cc: gcc-5, cxx: g++-5, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-18.04, }, |
||||||
|
{ pkgs: 'gcc-4.8 g++-4.8 lib32gcc-4.8-dev libx32gcc-4.8-dev', cc: gcc-4.8, cxx: g++-4.8, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-18.04, }, |
||||||
|
|
||||||
|
# clang |
||||||
|
{ pkgs: 'lib32gcc-11-dev libx32gcc-11-dev', cc: clang, cxx: clang++, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-latest, }, |
||||||
|
{ pkgs: 'clang-14 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-14, cxx: clang++-14, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'clang-13 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-13, cxx: clang++-13, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'clang-12 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-12, cxx: clang++-12, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'clang-11 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-11, cxx: clang++-11, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, |
||||||
|
{ pkgs: 'clang-10 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-10, cxx: clang++-10, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, |
||||||
|
{ pkgs: 'clang-9 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-9, cxx: clang++-9, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, |
||||||
|
{ pkgs: 'clang-8 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-8, cxx: clang++-8, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, |
||||||
|
{ pkgs: 'clang-7 lib32gcc-7-dev libx32gcc-7-dev', cc: clang-7, cxx: clang++-7, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, |
||||||
|
{ pkgs: 'clang-6.0 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-6.0, cxx: clang++-6.0, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, |
||||||
|
{ pkgs: 'clang-5.0 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-5.0, cxx: clang++-5.0, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-18.04, }, |
||||||
|
{ pkgs: 'clang-4.0 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-4.0, cxx: clang++-4.0, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-18.04, }, |
||||||
|
{ pkgs: 'clang-3.9', cc: clang-3.9, cxx: clang++-3.9, x32: 'fail', x86: 'fail', cxxtest: 'false', freestanding: 'false', os: ubuntu-18.04, }, |
||||||
|
] |
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }} |
||||||
|
env: # Set environment variables |
||||||
|
# We globally set CC and CXX to improve compatibility with .travis.yml |
||||||
|
CC: ${{ matrix.cc }} |
||||||
|
CXX: ${{ matrix.cxx }} |
||||||
|
FIXME__LZ4_CI_IGNORE : ' echo Error. But we ignore it for now.' |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
sudo apt-get install ${{ matrix.pkgs }} |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type $CC && which $CC && $CC --version |
||||||
|
echo && type $CXX && which $CXX && $CXX --version |
||||||
|
|
||||||
|
- name: make |
||||||
|
if: always() |
||||||
|
run: make V=1 |
||||||
|
|
||||||
|
- name: install test |
||||||
|
if: always() |
||||||
|
run: make clean; make V=1 -C tests test-install |
||||||
|
|
||||||
|
- name: make all |
||||||
|
if: always() |
||||||
|
run: make V=1 clean all |
||||||
|
|
||||||
|
- name: make c_standards (C90) |
||||||
|
if: always() |
||||||
|
run: make V=1 clean c_standards_c90 |
||||||
|
|
||||||
|
- name: make c_standards (C11) |
||||||
|
if: always() |
||||||
|
run: make V=1 clean c_standards_c11 |
||||||
|
|
||||||
|
- name: make c-to-c++ |
||||||
|
if: always() |
||||||
|
run: make V=1 clean ctocpptest |
||||||
|
|
||||||
|
- name: make cxxtest |
||||||
|
if: ${{ matrix.cxxtest == 'true' }} |
||||||
|
run: make V=1 clean cxxtest |
||||||
|
|
||||||
|
- name: make test-freestanding |
||||||
|
if: ${{ matrix.freestanding == 'true' }} |
||||||
|
run: make V=1 clean test-freestanding |
||||||
|
|
||||||
|
- name: make -C programs default |
||||||
|
if: always() |
||||||
|
run: make V=1 -C programs clean default |
||||||
|
|
||||||
|
- name: make -C programs default -D_FORTIFY_SOURCE=2 |
||||||
|
if: always() |
||||||
|
run: CFLAGS='-fPIC' LDFLAGS='-pie -fPIE -D_FORTIFY_SOURCE=2' make V=1 -C programs clean default |
||||||
|
|
||||||
|
- name: make -C tests test-lz4 |
||||||
|
if: always() |
||||||
|
run: make clean; MOREFLAGS='-Werror' make -j V=1 -C tests test-lz4 |
||||||
|
|
||||||
|
- name: make clangtest (clang only) |
||||||
|
if: ${{ startsWith( matrix.cc , 'clang' ) }} |
||||||
|
run: make V=1 clean clangtest |
||||||
|
|
||||||
|
- name: make -C tests test MOREFLAGS='-mx32' |
||||||
|
if: ${{ matrix.x32 == 'true' }} |
||||||
|
run: make clean; LDFLAGS='-Wl,--verbose' MOREFLAGS='-mx32' make -j V=1 -C tests test |
||||||
|
|
||||||
|
- name: make -C tests test-lz4c32 |
||||||
|
if: ${{ matrix.x86 == 'true' }} |
||||||
|
run: LDFLAGS='-Wl,--verbose' MOREFLAGS='-Werror' make V=1 -C tests clean test-lz4c32 |
||||||
|
|
||||||
|
|
||||||
|
############################################################### |
||||||
|
# # |
||||||
|
# Remove this block when we stabilize the tests. # |
||||||
|
# # |
||||||
|
|
||||||
|
- name: make -C tests test MOREFLAGS='-mx32' || echo Ignore failure for now. |
||||||
|
if: ${{ matrix.x32 == 'fail' }} |
||||||
|
run: make clean; LDFLAGS='-Wl,--verbose' MOREFLAGS='-mx32' make -j V=1 -C tests test || $FIXME__LZ4_CI_IGNORE |
||||||
|
|
||||||
|
- name: make -C tests test-lz4c32 || echo Ignore failure for now. |
||||||
|
if: ${{ matrix.x86 == 'fail' }} |
||||||
|
run: make clean; LDFLAGS='-Wl,--verbose' MOREFLAGS='-Werror' make V=1 -C tests test-lz4c32 || $FIXME__LZ4_CI_IGNORE |
||||||
|
|
||||||
|
# # |
||||||
|
############################################################### |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############################################################### |
||||||
|
# LZ4 self tests |
||||||
|
# |
||||||
|
# - Benchmark |
||||||
|
# - Fuzzer |
||||||
|
# - LZ4 Frame |
||||||
|
# - LZ4 versions |
||||||
|
# - Custom LZ4_DISTANCE_MAX |
||||||
|
# |
||||||
|
lz4-benchmark: |
||||||
|
name: Benchmark |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
|
||||||
|
- name: benchmark (-C tests test-lz4) |
||||||
|
run: make -j V=1 -C tests test-lz4 |
||||||
|
|
||||||
|
- name: benchmark (-C tests test-lz4c) |
||||||
|
run: make -j V=1 -C tests test-lz4c |
||||||
|
|
||||||
|
- name: benchmark (-C tests test-lz4c32) |
||||||
|
run: make V=1 -C tests test-lz4c32 |
||||||
|
|
||||||
|
- name: benchmark (-C tests test-fullbench) |
||||||
|
run: make V=1 -C tests test-fullbench |
||||||
|
|
||||||
|
- name: benchmark (-C tests test-fullbench32) |
||||||
|
run: make V=1 -C tests test-fullbench32 |
||||||
|
|
||||||
|
|
||||||
|
lz4-fuzzer: |
||||||
|
name: Fuzzer test |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
|
||||||
|
- name: setup |
||||||
|
run: sudo sysctl -w vm.mmap_min_addr=4096 |
||||||
|
|
||||||
|
- name: fuzzer |
||||||
|
run: make V=1 -C tests test-fuzzer |
||||||
|
|
||||||
|
- name: fuzzer32 |
||||||
|
run: make V=1 -C tests test-fuzzer32 |
||||||
|
|
||||||
|
|
||||||
|
lz4-standard-makefile-variables: |
||||||
|
name: LZ4 Makefile - support for standard variables |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: make standard_variables |
||||||
|
run: make V=1 standard_variables |
||||||
|
|
||||||
|
|
||||||
|
lz4-versions: |
||||||
|
name: LZ4 versions test |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
|
||||||
|
- name: make -C tests versionsTest |
||||||
|
run: make V=1 -C tests versionsTest |
||||||
|
|
||||||
|
|
||||||
|
lz4-abi: |
||||||
|
name: LZ4 inter-versions ABI test |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
|
||||||
|
- name: make -C tests abiTests |
||||||
|
run: make V=1 -C tests abiTests |
||||||
|
|
||||||
|
|
||||||
|
lz4-frame: |
||||||
|
name: LZ4 frame test |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
|
||||||
|
- name: LZ4 frame test |
||||||
|
run: make V=1 -C tests test-frametest |
||||||
|
|
||||||
|
- name: LZ4 frame test (32-bit) |
||||||
|
run: make V=1 -C tests test-frametest32 |
||||||
|
|
||||||
|
lz4-memory-usage: |
||||||
|
name: test different values of LZ4_MEMORY_USAGE |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: LZ4_MEMORY_USAGE |
||||||
|
run: make V=1 -C tests test-compile-with-lz4-memory-usage |
||||||
|
|
||||||
|
# Custom LZ4_DISTANCE_MAX ; lz4-wlib (CLI linked to dynamic library); LZ4_USER_MEMORY_FUNCTIONS |
||||||
|
lz4-custom-distance: |
||||||
|
name: Custom LZ4_DISTANCE_MAX |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: custom LZ4_DISTANCE_MAX; test LZ4_USER_MEMORY_FUNCTIONS |
||||||
|
run: | |
||||||
|
MOREFLAGS='-DLZ4_DISTANCE_MAX=8000' make V=1 check |
||||||
|
make V=1 clean |
||||||
|
make V=1 -C programs lz4-wlib |
||||||
|
make V=1 clean |
||||||
|
make V=1 -C tests fullbench-wmalloc # test LZ4_USER_MEMORY_FUNCTIONS |
||||||
|
make V=1 clean |
||||||
|
CC="c++ -Wno-deprecated" make V=1 -C tests fullbench-wmalloc # stricter function signature check |
||||||
|
|
||||||
|
# test block device compression #1086 |
||||||
|
lz4cli-block-device: |
||||||
|
name: Test lz4 compression on a block device |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: create a block device, compress it with lz4 # alternative : blindly use /dev/loop0, seems to always exist |
||||||
|
run: | |
||||||
|
make lz4 |
||||||
|
dd if=/dev/zero of=full0.img bs=2M count=1 |
||||||
|
BLOCK_DEVICE=$(sudo losetup --show -fP full0.img) |
||||||
|
sudo chmod 666 $BLOCK_DEVICE |
||||||
|
./lz4 -v $BLOCK_DEVICE -c > /dev/null |
||||||
|
sudo losetup -d $BLOCK_DEVICE |
||||||
|
rm full0.img |
||||||
|
|
||||||
|
|
||||||
|
############################################################### |
||||||
|
# Check tools |
||||||
|
# |
||||||
|
# - cppcheck |
||||||
|
# - scan-build |
||||||
|
# - valgrind |
||||||
|
# - ubsan |
||||||
|
# - asan |
||||||
|
# - unicode-lint |
||||||
|
# - build examples |
||||||
|
# |
||||||
|
lz4-cppcheck: |
||||||
|
name: make cppcheck |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install cppcheck |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: echo && type cppcheck && which cppcheck && cppcheck --version |
||||||
|
|
||||||
|
- name: cppcheck |
||||||
|
# This test script ignores the exit code of cppcheck. |
||||||
|
# See known issues in README.md. |
||||||
|
run: make V=1 clean cppcheck || echo There are some cppcheck reports but we ignore it. |
||||||
|
|
||||||
|
|
||||||
|
lz4-scan-build: |
||||||
|
name: make staticAnalyze |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install clang-tools |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type gcc && which gcc && gcc --version |
||||||
|
echo && type clang && which clang && clang --version |
||||||
|
echo && type scan-build && which scan-build # scan-build doesn't have any --version equivalent option |
||||||
|
echo && type make && which make && make -v |
||||||
|
echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present |
||||||
|
|
||||||
|
- name: make staticAnalyze |
||||||
|
run: make V=1 clean staticAnalyze |
||||||
|
|
||||||
|
|
||||||
|
lz4-valgrind: |
||||||
|
name: valgrind |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install valgrind |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type cc && which cc && cc --version |
||||||
|
echo && type valgrind && which valgrind && valgrind --version |
||||||
|
|
||||||
|
- name: valgrind |
||||||
|
run: make V=1 -C tests test-mem |
||||||
|
|
||||||
|
|
||||||
|
lz4-ubsan-x64: |
||||||
|
name: Linux x64 ubsan |
||||||
|
runs-on: ubuntu-latest |
||||||
|
env: # Set environment variables |
||||||
|
FIXME__LZ4_CI_IGNORE : ' echo Error. But we ignore it for now.' |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: ubsan |
||||||
|
######################################################### |
||||||
|
# For now, we ignore the exit code of `make usan`. |
||||||
|
# See "Known issues / lz4-ubsan-x64" in README.md |
||||||
|
# When we'll resolve this issue, remove "|| $FIXME__LZ4_CI_IGNORE" |
||||||
|
######################################################### |
||||||
|
run: make V=1 clean usan MOREFLAGS='-Wcomma -Werror' || $FIXME__LZ4_CI_IGNORE |
||||||
|
|
||||||
|
|
||||||
|
lz4-ubsan-x86: |
||||||
|
name: Linux x86 ubsan |
||||||
|
runs-on: ubuntu-latest |
||||||
|
env: # Set environment variables |
||||||
|
FIXME__LZ4_CI_IGNORE : ' echo Error. But we ignore it for now.' |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
sudo apt-get install lib32gcc-11-dev |
||||||
|
|
||||||
|
- name: ubsan32 |
||||||
|
######################################################### |
||||||
|
# For now, we ignore the exit code of `make usan32`. |
||||||
|
# See "Known issues / lz4-ubsaan-x86" in README.md. |
||||||
|
# When we'll resolve this issue, remove "|| $FIXME__LZ4_CI_IGNORE" |
||||||
|
######################################################### |
||||||
|
run: CC=clang make V=1 clean usan32 MOREFLAGS='-Wcomma -Werror' || $FIXME__LZ4_CI_IGNORE |
||||||
|
|
||||||
|
|
||||||
|
lz4-asan-x64: |
||||||
|
name: Linux x64 ASAN |
||||||
|
runs-on: ubuntu-latest |
||||||
|
env: # Set environment variables |
||||||
|
FIXME__LZ4_CI_IGNORE : ' echo Error. But we ignore it for now.' |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: setup |
||||||
|
run: sudo sysctl -w vm.mmap_min_addr=4096 |
||||||
|
|
||||||
|
- name: frametest |
||||||
|
run: CC=clang MOREFLAGS=-fsanitize=address make V=1 -C tests clean test-frametest |
||||||
|
|
||||||
|
- name: fuzzer |
||||||
|
run: CC=clang MOREFLAGS=-fsanitize=address make V=1 -C tests clean test-fuzzer |
||||||
|
|
||||||
|
unicode-lint: |
||||||
|
name: lint unicode in ./lib/, ./tests/ and ./programs/ |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: unicode lint |
||||||
|
run: bash ./tests/unicode_lint.sh |
||||||
|
|
||||||
|
lz4-examples: |
||||||
|
name: make examples |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type cc && which cc && cc --version |
||||||
|
echo && type c++ && which c++ && c++ --version |
||||||
|
|
||||||
|
- name: examples |
||||||
|
run: make V=1 clean examples |
||||||
|
|
||||||
|
- name: examples (compile as C++ code) |
||||||
|
run: make V=1 -C examples clean cxxtest |
||||||
|
|
||||||
|
# lasts ~20mn |
||||||
|
oss-fuzz: |
||||||
|
runs-on: ubuntu-latest |
||||||
|
strategy: |
||||||
|
fail-fast: false |
||||||
|
matrix: |
||||||
|
sanitizer: [address, undefined, memory] |
||||||
|
steps: |
||||||
|
- name: Build Fuzzers (${{ matrix.sanitizer }}) |
||||||
|
id: build |
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master |
||||||
|
with: |
||||||
|
oss-fuzz-project-name: 'lz4' |
||||||
|
dry-run: false |
||||||
|
sanitizer: ${{ matrix.sanitizer }} |
||||||
|
- name: Run Fuzzers (${{ matrix.sanitizer }}) |
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master |
||||||
|
with: |
||||||
|
oss-fuzz-project-name: 'lz4' |
||||||
|
fuzz-seconds: 600 |
||||||
|
dry-run: false |
||||||
|
sanitizer: ${{ matrix.sanitizer }} |
||||||
|
- name: Upload Crash |
||||||
|
uses: actions/upload-artifact@v1 |
||||||
|
if: failure() && steps.build.outcome == 'success' |
||||||
|
with: |
||||||
|
name: ${{ matrix.sanitizer }}-artifacts |
||||||
|
path: ./out/artifacts |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############################################################### |
||||||
|
# Platforms |
||||||
|
# |
||||||
|
# - QEMU (ARM, ARM64, PPC, PPC64LE, S390X) |
||||||
|
# - macOS |
||||||
|
# |
||||||
|
|
||||||
|
# QEMU |
||||||
|
# All tests use QEMU (static) and gcc cross compiler. |
||||||
|
# |
||||||
|
# note: |
||||||
|
# We don't employ completely matrix method which provides `MOREFLAGS` |
||||||
|
# etc in the matrix. Because some platform may need its special |
||||||
|
# compiler options and test. |
||||||
|
# For example, xxHash already has tests for scalar and SIMD version of |
||||||
|
# it. But compiler options are quite different between platforms. |
||||||
|
# |
||||||
|
# So, please keep them simple and independent. |
||||||
|
# |
||||||
|
lz4-qemu-platforms: |
||||||
|
name: QEMU ${{ matrix.type }} |
||||||
|
strategy: |
||||||
|
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix instance failed. |
||||||
|
matrix: |
||||||
|
include: [ |
||||||
|
# You can access the following values via ${{ matrix.??? }} |
||||||
|
# type : Architecture type for `if:` statement. |
||||||
|
# pkgs : apt-get package names. You can include multiple packages which are delimited by space. |
||||||
|
# xcc : gcc cross C compiler executable. |
||||||
|
# xemu : QEMU static emulator executable. |
||||||
|
# os : GitHub Actions YAML workflow label. See https://github.com/actions/virtual-environments#available-environments |
||||||
|
|
||||||
|
{ type: ARM, pkgs: 'qemu-system-arm gcc-arm-linux-gnueabi', xcc: arm-linux-gnueabi-gcc, xemu: qemu-arm-static, os: ubuntu-latest, }, |
||||||
|
{ type: ARM64, pkgs: 'qemu-system-arm gcc-aarch64-linux-gnu', xcc: aarch64-linux-gnu-gcc, xemu: qemu-aarch64-static, os: ubuntu-latest, }, |
||||||
|
{ type: PPC, pkgs: 'qemu-system-ppc gcc-powerpc-linux-gnu', xcc: powerpc-linux-gnu-gcc, xemu: qemu-ppc-static, os: ubuntu-latest, }, |
||||||
|
{ type: PPC64LE, pkgs: 'qemu-system-ppc gcc-powerpc64le-linux-gnu', xcc: powerpc64le-linux-gnu-gcc, xemu: qemu-ppc64le-static, os: ubuntu-latest, }, |
||||||
|
{ type: S390X, pkgs: 'qemu-system-s390x gcc-s390x-linux-gnu', xcc: s390x-linux-gnu-gcc, xemu: qemu-s390x-static, os: ubuntu-latest, }, |
||||||
|
] |
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }} |
||||||
|
env: # Set environment variables |
||||||
|
XCC: ${{ matrix.xcc }} |
||||||
|
XEMU: ${{ matrix.xemu }} |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: apt-get install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install gcc-multilib |
||||||
|
sudo apt-get install qemu-utils qemu-user-static |
||||||
|
sudo apt-get install ${{ matrix.pkgs }} |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type $XCC && which $XCC && $XCC --version |
||||||
|
echo && $XCC -v # Show built-in specs |
||||||
|
echo && type $XEMU && which $XEMU && $XEMU --version |
||||||
|
|
||||||
|
- name: ARM64 |
||||||
|
if: ${{ matrix.type == 'ARM64' }} |
||||||
|
run: make V=1 platformTest CC=$XCC QEMU_SYS=$XEMU |
||||||
|
|
||||||
|
- name: ARM |
||||||
|
if: ${{ matrix.type == 'ARM' }} |
||||||
|
run: make V=1 platformTest CC=$XCC QEMU_SYS=$XEMU |
||||||
|
|
||||||
|
- name: PPC |
||||||
|
if: ${{ matrix.type == 'PPC' }} |
||||||
|
run: make V=1 platformTest CC=$XCC QEMU_SYS=$XEMU |
||||||
|
|
||||||
|
- name: PPC64LE |
||||||
|
if: ${{ matrix.type == 'PPC64LE' }} |
||||||
|
run: make V=1 platformTest CC=$XCC QEMU_SYS=$XEMU MOREFLAGS=-m64 |
||||||
|
|
||||||
|
- name: S390X |
||||||
|
if: ${{ matrix.type == 'S390X' }} |
||||||
|
run: make V=1 platformTest CC=$XCC QEMU_SYS=$XEMU |
||||||
|
|
||||||
|
|
||||||
|
# macOS |
||||||
|
lz4-platform-macos-latest: |
||||||
|
name: macOS |
||||||
|
runs-on: macos-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type cc && which cc && cc --version |
||||||
|
echo && type make && which make && make -v |
||||||
|
echo && sysctl -a | grep machdep.cpu # cpuinfo |
||||||
|
|
||||||
|
- name: make default |
||||||
|
run: CFLAGS="-Werror" make V=1 clean default |
||||||
|
|
||||||
|
- name: make test |
||||||
|
run: make clean; make -j V=1 test MOREFLAGS='-Werror -Wconversion -Wno-sign-conversion' |
||||||
|
|
||||||
|
- name: Ensure `make test` doesn't depend on the status of the console |
||||||
|
# see issue #990 for detailed explanations |
||||||
|
run: make -j test > /dev/null |
||||||
|
|
||||||
|
|
||||||
|
############################################################### |
||||||
|
# Build systems |
||||||
|
# |
||||||
|
# - make |
||||||
|
# - cmake |
||||||
|
# - meson |
||||||
|
# |
||||||
|
|
||||||
|
# make |
||||||
|
lz4-build-make: |
||||||
|
name: make |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type cc && which cc && cc --version |
||||||
|
echo && type make && which make && make -v |
||||||
|
|
||||||
|
- name: make |
||||||
|
run: make V=1 |
||||||
|
|
||||||
|
|
||||||
|
lz4-build-make-travis-install: |
||||||
|
name: make travis-install |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: travis-install |
||||||
|
run: make V=1 clean travis-install |
||||||
|
|
||||||
|
- name: travis-install result |
||||||
|
run: | |
||||||
|
echo && echo Installed files |
||||||
|
( cd ~/install_test_dir; find .; ) |
||||||
|
|
||||||
|
|
||||||
|
# cmake |
||||||
|
lz4-build-cmake: |
||||||
|
name: cmake |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type cmake && which cmake && cmake --version |
||||||
|
echo && type make && which make && make -v |
||||||
|
|
||||||
|
- name: cmake |
||||||
|
run: | |
||||||
|
cd build/cmake |
||||||
|
mkdir build |
||||||
|
cd build |
||||||
|
cmake .. |
||||||
|
CFLAGS=-Werror make VERBOSE=1 |
||||||
|
|
||||||
|
|
||||||
|
# Invoke cmake via Makefile |
||||||
|
lz4-build-make-cmake: |
||||||
|
name: make cmake |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- name: make cmake |
||||||
|
# V=1 for lz4 Makefile, VERBOSE=1 for cmake Makefile. |
||||||
|
run: make V=1 VERBOSE=1 clean cmake |
||||||
|
|
||||||
|
|
||||||
|
# Meson |
||||||
|
lz4-build-meson: |
||||||
|
name: Meson + Ninja |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 # https://github.com/actions/checkout |
||||||
|
- uses: actions/setup-python@v2 # https://github.com/actions/setup-python |
||||||
|
with: |
||||||
|
python-version: '3.x' |
||||||
|
|
||||||
|
- name: Install |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install tree ninja-build |
||||||
|
python -m pip install --upgrade pip |
||||||
|
pip3 install --user meson |
||||||
|
|
||||||
|
- name: Environment info |
||||||
|
run: | |
||||||
|
echo && type clang && which clang && clang --version |
||||||
|
echo && type python && which python && python --version |
||||||
|
echo && type meson && which meson && meson --version |
||||||
|
|
||||||
|
- name: meson |
||||||
|
# 'run: >' replaces all newlines in the following block with spaces |
||||||
|
run: > |
||||||
|
meson setup |
||||||
|
--buildtype=debug |
||||||
|
-Db_lundef=false |
||||||
|
-Dauto_features=enabled |
||||||
|
-Dprograms=true |
||||||
|
-Dcontrib=true |
||||||
|
-Dtests=true |
||||||
|
-Dexamples=true |
||||||
|
contrib/meson build |
||||||
|
|
||||||
|
- name: staging |
||||||
|
run: | |
||||||
|
cd build |
||||||
|
DESTDIR=./staging ninja install |
||||||
|
tree ./staging |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############################################################ |
||||||
|
# Check git tag for LZ4 releases |
||||||
|
# |
||||||
|
lz4-check-tag: |
||||||
|
name: git version tag checking for release |
||||||
|
runs-on: ubuntu-latest |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 |
||||||
|
- name: make -C tests checkTag |
||||||
|
if: startsWith(github.ref, 'refs/tags/v') # If git tag name starts with 'v' |
||||||
|
run: | |
||||||
|
echo "tag=${GITHUB_REF#refs/*/}" |
||||||
|
make -C tests checkTag |
||||||
|
tests/checkTag ${GITHUB_REF#refs/*/} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############################################################ |
||||||
|
# Gather CI environment information. |
||||||
|
# |
||||||
|
lz4-env-info: |
||||||
|
name: GH-Actions Virtual Env Info (${{ matrix.os }}) |
||||||
|
strategy: |
||||||
|
matrix: |
||||||
|
include: [ |
||||||
|
{ os: ubuntu-latest, }, # https://github.com/actions/virtual-environments/ |
||||||
|
{ os: ubuntu-22.04, }, # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2204-Readme.md |
||||||
|
{ os: ubuntu-20.04, }, # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md |
||||||
|
{ os: ubuntu-18.04, }, # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-Readme.md |
||||||
|
] |
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }} |
||||||
|
steps: |
||||||
|
- uses: actions/checkout@v2 |
||||||
|
|
||||||
|
- name: init |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
|
||||||
|
- name: cc --version |
||||||
|
run: echo && type cc && which cc && cc --version |
||||||
|
|
||||||
|
- name: gcc --version |
||||||
|
run: echo && type gcc && which gcc && gcc --version |
||||||
|
|
||||||
|
- name: clang --version |
||||||
|
run: echo && type clang && which clang && clang --version |
||||||
|
|
||||||
|
- name: make -v |
||||||
|
run: echo && type make && which make && make -v |
||||||
|
|
||||||
|
- name: g++ --version |
||||||
|
run: echo && type g++ && which g++ && g++ --version |
||||||
|
|
||||||
|
- name: git --version |
||||||
|
run: echo && type git && which git && git --version |
||||||
|
|
||||||
|
- name: gcc packages (apt-cache) |
||||||
|
run: apt-cache search gcc | grep "^gcc-[0-9\.]* " | sort |
||||||
|
|
||||||
|
- name: lib32gcc packages for i386 (apt-cache) |
||||||
|
run: apt-cache search lib32gcc | grep "^lib32gcc-" | sort |
||||||
|
|
||||||
|
- name: libx32gcc packages for x32 (apt-cache) |
||||||
|
run: apt-cache search libx32gcc | grep "^libx32gcc-" | sort |
||||||
|
|
||||||
|
- name: gcc multilib packages (apt-cache) |
||||||
|
run: apt-cache search multilib | grep "gcc-" | sort |
||||||
|
|
||||||
|
- name: clang packages (apt-cache) |
||||||
|
run: apt-cache search clang | grep "^clang-[0-9\.]* " | sort |
||||||
|
|
||||||
|
- name: QEMU packages (apt-cache) |
||||||
|
run: apt-cache search qemu | grep "^qemu-system-.*QEMU full system" | sort |
@ -0,0 +1,43 @@ |
|||||||
|
# Object files |
||||||
|
*.o |
||||||
|
*.ko |
||||||
|
|
||||||
|
# Libraries |
||||||
|
*.lib |
||||||
|
*.a |
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs) |
||||||
|
*.dll |
||||||
|
*.so |
||||||
|
*.so.* |
||||||
|
*.dylib |
||||||
|
*.dSYM # apple |
||||||
|
|
||||||
|
# Executables |
||||||
|
*.exe |
||||||
|
*.out |
||||||
|
*.app |
||||||
|
lz4 |
||||||
|
|
||||||
|
# IDE / editors files |
||||||
|
.clang_complete |
||||||
|
_codelite/ |
||||||
|
_codelite_lz4/ |
||||||
|
bin/ |
||||||
|
*.zip |
||||||
|
*.swp |
||||||
|
|
||||||
|
# analyzers |
||||||
|
infer-out |
||||||
|
|
||||||
|
# Mac |
||||||
|
.DS_Store |
||||||
|
*.dSYM |
||||||
|
|
||||||
|
# Windows / Msys |
||||||
|
nul |
||||||
|
ld.exe* |
||||||
|
|
||||||
|
# test artifacts |
||||||
|
*.lz4 |
||||||
|
tmp* |
@ -0,0 +1,42 @@ |
|||||||
|
language: c |
||||||
|
|
||||||
|
matrix: |
||||||
|
fast_finish: true |
||||||
|
include: |
||||||
|
|
||||||
|
- name: aarch64 real-hw tests |
||||||
|
arch: arm64 |
||||||
|
script: |
||||||
|
- make test |
||||||
|
|
||||||
|
- name: PPC64LE real-hw tests |
||||||
|
arch: ppc64le |
||||||
|
script: |
||||||
|
- make test |
||||||
|
|
||||||
|
- name: IBM s390x real-hw tests |
||||||
|
arch: s390x |
||||||
|
script: |
||||||
|
- make test |
||||||
|
|
||||||
|
# tag-specific test |
||||||
|
- name: tag build |
||||||
|
if: tag =~ ^v[0-9]\.[0-9] |
||||||
|
os: linux |
||||||
|
script: |
||||||
|
- make -C tests checkTag |
||||||
|
- tests/checkTag "$TRAVIS_BRANCH" |
||||||
|
|
||||||
|
# oss-fuzz compilation test |
||||||
|
- name: Compile OSS-Fuzz targets |
||||||
|
script: |
||||||
|
- ./ossfuzz/travisoss.sh |
||||||
|
|
||||||
|
# Unicode lint |
||||||
|
# See https://github.com/lz4/lz4/issues/1018 |
||||||
|
- name: Run Unicode lint |
||||||
|
script: |
||||||
|
- ./tests/unicode_lint.sh |
||||||
|
|
||||||
|
allow_failures: |
||||||
|
- env: ALLOW_FAILURES=true |
@ -0,0 +1,16 @@ |
|||||||
|
Installation |
||||||
|
============= |
||||||
|
|
||||||
|
``` |
||||||
|
make |
||||||
|
make install # this command may require root access |
||||||
|
``` |
||||||
|
|
||||||
|
LZ4's `Makefile` supports standard [Makefile conventions], |
||||||
|
including [staged installs], [redirection], or [command redefinition]. |
||||||
|
It is compatible with parallel builds (`-j#`). |
||||||
|
|
||||||
|
[Makefile conventions]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html |
||||||
|
[staged installs]: https://www.gnu.org/prep/standards/html_node/DESTDIR.html |
||||||
|
[redirection]: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html |
||||||
|
[command redefinition]: https://www.gnu.org/prep/standards/html_node/Utilities-in-Makefiles.html |
@ -0,0 +1,12 @@ |
|||||||
|
This repository uses 2 different licenses : |
||||||
|
- all files in the `lib` directory use a BSD 2-Clause license |
||||||
|
- all other files use a GPLv2 license, unless explicitly stated otherwise |
||||||
|
|
||||||
|
Relevant license is reminded at the top of each source file, |
||||||
|
and with presence of COPYING or LICENSE file in associated directories. |
||||||
|
|
||||||
|
This model is selected to emphasize that |
||||||
|
files in the `lib` directory are designed to be included into 3rd party applications, |
||||||
|
while all other files, in `programs`, `tests` or `examples`, |
||||||
|
are intended to be used "as is", as part of their intended scenarios, |
||||||
|
with no intention to support 3rd party integration use cases. |
@ -0,0 +1,279 @@ |
|||||||
|
# ################################################################
|
||||||
|
# LZ4 - Makefile
|
||||||
|
# Copyright (C) Yann Collet 2011-2020
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# BSD license
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
# other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# You can contact the author at :
|
||||||
|
# - LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
# ################################################################
|
||||||
|
|
||||||
|
LZ4DIR = lib
|
||||||
|
PRGDIR = programs
|
||||||
|
TESTDIR = tests
|
||||||
|
EXDIR = examples
|
||||||
|
FUZZDIR = ossfuzz
|
||||||
|
|
||||||
|
include Makefile.inc |
||||||
|
|
||||||
|
|
||||||
|
.PHONY: default |
||||||
|
default: lib-release lz4-release |
||||||
|
|
||||||
|
# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1
|
||||||
|
$(V)$(VERBOSE).SILENT: |
||||||
|
|
||||||
|
.PHONY: all |
||||||
|
all: allmost examples manuals build_tests |
||||||
|
|
||||||
|
.PHONY: allmost |
||||||
|
allmost: lib lz4 |
||||||
|
|
||||||
|
.PHONY: lib lib-release liblz4.a |
||||||
|
lib: liblz4.a |
||||||
|
lib lib-release liblz4.a: |
||||||
|
$(MAKE) -C $(LZ4DIR) $@
|
||||||
|
|
||||||
|
.PHONY: lz4 lz4-release |
||||||
|
lz4 : liblz4.a |
||||||
|
lz4-release : lib-release |
||||||
|
lz4 lz4-release : |
||||||
|
$(MAKE) -C $(PRGDIR) $@
|
||||||
|
cp $(PRGDIR)/lz4$(EXT) .
|
||||||
|
|
||||||
|
.PHONY: examples |
||||||
|
examples: liblz4.a |
||||||
|
$(MAKE) -C $(EXDIR) all
|
||||||
|
|
||||||
|
.PHONY: manuals |
||||||
|
manuals: |
||||||
|
$(MAKE) -C contrib/gen_manual $@
|
||||||
|
|
||||||
|
.PHONY: build_tests |
||||||
|
build_tests: |
||||||
|
$(MAKE) -C $(TESTDIR) all
|
||||||
|
|
||||||
|
.PHONY: clean |
||||||
|
clean: |
||||||
|
$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(PRGDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(TESTDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(EXDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(FUZZDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C contrib/gen_manual $@ > $(VOID)
|
||||||
|
$(RM) lz4$(EXT)
|
||||||
|
$(RM) -r $(CMAKE_BUILD_DIR)
|
||||||
|
@echo Cleaning completed
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# make install is validated only for Posix environments
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
ifeq ($(POSIX_ENV),Yes) |
||||||
|
HOST_OS = POSIX
|
||||||
|
|
||||||
|
.PHONY: install uninstall |
||||||
|
install uninstall: |
||||||
|
$(MAKE) -C $(LZ4DIR) $@
|
||||||
|
$(MAKE) -C $(PRGDIR) $@
|
||||||
|
|
||||||
|
.PHONY: travis-install |
||||||
|
travis-install: |
||||||
|
$(MAKE) -j1 install DESTDIR=~/install_test_dir
|
||||||
|
|
||||||
|
endif # POSIX_ENV
|
||||||
|
|
||||||
|
|
||||||
|
CMAKE ?= cmake
|
||||||
|
CMAKE_BUILD_DIR ?= build/cmake/build
|
||||||
|
ifneq (,$(filter MSYS%,$(shell $(UNAME)))) |
||||||
|
HOST_OS = MSYS
|
||||||
|
CMAKE_PARAMS = -G"MSYS Makefiles"
|
||||||
|
endif |
||||||
|
|
||||||
|
.PHONY: cmake |
||||||
|
cmake: |
||||||
|
mkdir -p $(CMAKE_BUILD_DIR)
|
||||||
|
cd $(CMAKE_BUILD_DIR); $(CMAKE) $(CMAKE_PARAMS) ..; $(CMAKE) --build .
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# make tests validated only for MSYS and Posix environments
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
ifneq (,$(filter $(HOST_OS),MSYS POSIX)) |
||||||
|
|
||||||
|
.PHONY: list |
||||||
|
list: |
||||||
|
$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
|
||||||
|
|
||||||
|
.PHONY: check |
||||||
|
check: |
||||||
|
$(MAKE) -C $(TESTDIR) test-lz4-essentials
|
||||||
|
|
||||||
|
.PHONY: test |
||||||
|
test: |
||||||
|
$(MAKE) -C $(TESTDIR) $@
|
||||||
|
$(MAKE) -C $(EXDIR) $@
|
||||||
|
|
||||||
|
.PHONY: clangtest |
||||||
|
clangtest: CFLAGS += -Werror -Wconversion -Wno-sign-conversion |
||||||
|
clangtest: CC = clang |
||||||
|
clangtest: clean |
||||||
|
$(CC) -v
|
||||||
|
$(MAKE) -C $(LZ4DIR) all CC=$(CC)
|
||||||
|
$(MAKE) -C $(PRGDIR) all CC=$(CC)
|
||||||
|
$(MAKE) -C $(TESTDIR) all CC=$(CC)
|
||||||
|
|
||||||
|
.PHONY: clangtest-native |
||||||
|
clangtest-native: CFLAGS = -O3 -Werror -Wconversion -Wno-sign-conversion |
||||||
|
clangtest-native: clean |
||||||
|
clang -v
|
||||||
|
$(MAKE) -C $(LZ4DIR) all CC=clang
|
||||||
|
$(MAKE) -C $(PRGDIR) native CC=clang
|
||||||
|
$(MAKE) -C $(TESTDIR) native CC=clang
|
||||||
|
|
||||||
|
.PHONY: usan |
||||||
|
usan: CC = clang |
||||||
|
usan: CFLAGS = -O3 -g -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-recover=pointer-overflow |
||||||
|
usan: LDFLAGS = $(CFLAGS) |
||||||
|
usan: clean |
||||||
|
CC=$(CC) CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
|
||||||
|
|
||||||
|
.PHONY: usan32 |
||||||
|
usan32: CFLAGS = -m32 -O3 -g -fsanitize=undefined |
||||||
|
usan32: LDFLAGS = $(CFLAGS) |
||||||
|
usan32: clean |
||||||
|
$(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
|
||||||
|
|
||||||
|
SCANBUILD ?= scan-build
|
||||||
|
SCANBUILD_FLAGS += --status-bugs -v --force-analyze-debug-code
|
||||||
|
.PHONY: staticAnalyze |
||||||
|
staticAnalyze: clean |
||||||
|
CPPFLAGS=-DLZ4_DEBUG=1 CFLAGS=-g $(SCANBUILD) $(SCANBUILD_FLAGS) $(MAKE) all V=1 DEBUGLEVEL=1
|
||||||
|
|
||||||
|
.PHONY: cppcheck |
||||||
|
cppcheck: |
||||||
|
cppcheck . --force --enable=warning,portability,performance,style --error-exitcode=1 > /dev/null
|
||||||
|
|
||||||
|
.PHONY: platformTest |
||||||
|
platformTest: clean |
||||||
|
@echo "\n ---- test lz4 with $(CC) compiler ----"
|
||||||
|
$(CC) -v
|
||||||
|
CFLAGS="-O3 -Werror" $(MAKE) -C $(LZ4DIR) all
|
||||||
|
CFLAGS="-O3 -Werror -static" $(MAKE) -C $(PRGDIR) all
|
||||||
|
CFLAGS="-O3 -Werror -static" $(MAKE) -C $(TESTDIR) all
|
||||||
|
$(MAKE) -C $(TESTDIR) test-platform
|
||||||
|
|
||||||
|
.PHONY: versionsTest |
||||||
|
versionsTest: clean |
||||||
|
$(MAKE) -C $(TESTDIR) $@
|
||||||
|
|
||||||
|
.PHONY: test-freestanding |
||||||
|
test-freestanding: |
||||||
|
$(MAKE) -C $(TESTDIR) clean $@
|
||||||
|
|
||||||
|
.PHONY: cxxtest cxx32test |
||||||
|
cxxtest cxx32test: CC := "$(CXX) -Wno-deprecated" |
||||||
|
cxxtest cxx32test: CFLAGS = -O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror |
||||||
|
cxx32test: CFLAGS += -m32 |
||||||
|
cxxtest cxx32test: clean |
||||||
|
$(CXX) -v
|
||||||
|
CC=$(CC) $(MAKE) -C $(LZ4DIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
CC=$(CC) $(MAKE) -C $(PRGDIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
CC=$(CC) $(MAKE) -C $(TESTDIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
|
||||||
|
.PHONY: cxx17build |
||||||
|
cxx17build : CC = "$(CXX) -Wno-deprecated" |
||||||
|
cxx17build : CFLAGS = -std=c++17 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror -pedantic |
||||||
|
cxx17build : clean |
||||||
|
$(CXX) -v
|
||||||
|
CC=$(CC) $(MAKE) -C $(LZ4DIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
CC=$(CC) $(MAKE) -C $(PRGDIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
CC=$(CC) $(MAKE) -C $(TESTDIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
|
||||||
|
.PHONY: ctocpptest |
||||||
|
ctocpptest: LIBCC="$(CC)" |
||||||
|
ctocpptest: TESTCC="$(CXX)" |
||||||
|
ctocpptest: CFLAGS= |
||||||
|
ctocpptest: clean |
||||||
|
CC=$(LIBCC) $(MAKE) -C $(LZ4DIR) CFLAGS="$(CFLAGS)" all
|
||||||
|
CC=$(LIBCC) $(MAKE) -C $(TESTDIR) CFLAGS="$(CFLAGS)" lz4.o lz4hc.o lz4frame.o
|
||||||
|
CC=$(TESTCC) $(MAKE) -C $(TESTDIR) CFLAGS="$(CFLAGS)" all
|
||||||
|
|
||||||
|
.PHONY: c_standards |
||||||
|
c_standards: clean c_standards_c11 c_standards_c99 c_standards_c90 |
||||||
|
|
||||||
|
.PHONY: c_standards_c90 |
||||||
|
c_standards_c90: clean |
||||||
|
$(MAKE) clean; CFLAGS="-std=c90 -Werror -pedantic -Wno-long-long -Wno-variadic-macros" $(MAKE) allmost
|
||||||
|
$(MAKE) clean; CFLAGS="-std=gnu90 -Werror -pedantic -Wno-long-long -Wno-variadic-macros" $(MAKE) allmost
|
||||||
|
|
||||||
|
.PHONY: c_standards_c99 |
||||||
|
c_standards_c99: clean |
||||||
|
$(MAKE) clean; CFLAGS="-std=c99 -Werror -pedantic" $(MAKE) all
|
||||||
|
$(MAKE) clean; CFLAGS="-std=gnu99 -Werror -pedantic" $(MAKE) all
|
||||||
|
|
||||||
|
.PHONY: c_standards_c11 |
||||||
|
c_standards_c11: clean |
||||||
|
$(MAKE) clean; CFLAGS="-std=c11 -Werror" $(MAKE) all
|
||||||
|
|
||||||
|
# The following test ensures that standard Makefile variables set through environment
|
||||||
|
# are correctly transmitted at compilation stage.
|
||||||
|
# This test is meant to detect issues like https://github.com/lz4/lz4/issues/958
|
||||||
|
.PHONY: standard_variables |
||||||
|
standard_variables: clean |
||||||
|
@echo =================
|
||||||
|
@echo Check support of Makefile Standard variables through environment
|
||||||
|
@echo note : this test requires V=1 to work properly
|
||||||
|
@echo =================
|
||||||
|
CC="cc -DCC_TEST" \
|
||||||
|
CFLAGS=-DCFLAGS_TEST \
|
||||||
|
CPPFLAGS=-DCPPFLAGS_TEST \
|
||||||
|
LDFLAGS=-DLDFLAGS_TEST \
|
||||||
|
LDLIBS=-DLDLIBS_TEST \
|
||||||
|
$(MAKE) V=1 > tmpsv
|
||||||
|
# Note: just checking the presence of custom flags
|
||||||
|
# would not detect situations where custom flags are
|
||||||
|
# supported in some part of the Makefile, and missed in others.
|
||||||
|
# So the test checks if they are present the _right nb of times_.
|
||||||
|
# However, checking static quantities makes this test brittle,
|
||||||
|
# because quantities (7, 2 and 1) can still evolve in future,
|
||||||
|
# for example when source directories or Makefile evolve.
|
||||||
|
if [ $$(grep CC_TEST tmpsv | wc -l) -ne 7 ]; then \
|
||||||
|
echo "CC environment variable missed" && False; fi
|
||||||
|
if [ $$(grep CFLAGS_TEST tmpsv | wc -l) -ne 7 ]; then \
|
||||||
|
echo "CFLAGS environment variable missed" && False; fi
|
||||||
|
if [ $$(grep CPPFLAGS_TEST tmpsv | wc -l) -ne 7 ]; then \
|
||||||
|
echo "CPPFLAGS environment variable missed" && False; fi
|
||||||
|
if [ $$(grep LDFLAGS_TEST tmpsv | wc -l) -ne 2 ]; then \
|
||||||
|
echo "LDFLAGS environment variable missed" && False; fi
|
||||||
|
if [ $$(grep LDLIBS_TEST tmpsv | wc -l) -ne 1 ]; then \
|
||||||
|
echo "LDLIBS environment variable missed" && False; fi
|
||||||
|
@echo =================
|
||||||
|
@echo all custom variables detected
|
||||||
|
@echo =================
|
||||||
|
$(RM) tmpsv
|
||||||
|
|
||||||
|
endif # MSYS POSIX
|
@ -0,0 +1,111 @@ |
|||||||
|
# ################################################################ |
||||||
|
# LZ4 - Makefile common definitions |
||||||
|
# Copyright (C) Yann Collet 2020 |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# BSD license |
||||||
|
# Redistribution and use in source and binary forms, with or without modification, |
||||||
|
# are permitted provided that the following conditions are met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright notice, this |
||||||
|
# list of conditions and the following disclaimer. |
||||||
|
# |
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice, this |
||||||
|
# list of conditions and the following disclaimer in the documentation and/or |
||||||
|
# other materials provided with the distribution. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
||||||
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
||||||
|
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
# |
||||||
|
# You can contact the author at : |
||||||
|
# - LZ4 source repository : https://github.com/lz4/lz4 |
||||||
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c |
||||||
|
# ################################################################ |
||||||
|
|
||||||
|
UNAME ?= uname |
||||||
|
|
||||||
|
TARGET_OS ?= $(shell $(UNAME)) |
||||||
|
ifeq ($(TARGET_OS),) |
||||||
|
TARGET_OS ?= $(OS) |
||||||
|
endif |
||||||
|
|
||||||
|
ifneq (,$(filter Windows%,$(TARGET_OS))) |
||||||
|
LIBLZ4 = liblz4-$(LIBVER_MAJOR) |
||||||
|
LIBLZ4_EXP = liblz4.lib |
||||||
|
WINBASED = yes |
||||||
|
else |
||||||
|
LIBLZ4_EXP = liblz4.dll.a |
||||||
|
ifneq (,$(filter MINGW%,$(TARGET_OS))) |
||||||
|
LIBLZ4 = liblz4 |
||||||
|
WINBASED = yes |
||||||
|
else |
||||||
|
ifneq (,$(filter MSYS%,$(TARGET_OS))) |
||||||
|
LIBLZ4 = msys-lz4-$(LIBVER_MAJOR) |
||||||
|
WINBASED = yes |
||||||
|
else |
||||||
|
ifneq (,$(filter CYGWIN%,$(TARGET_OS))) |
||||||
|
LIBLZ4 = cyglz4-$(LIBVER_MAJOR) |
||||||
|
WINBASED = yes |
||||||
|
else |
||||||
|
LIBLZ4 = liblz4.$(SHARED_EXT_VER) |
||||||
|
WINBASED = no |
||||||
|
EXT = |
||||||
|
endif |
||||||
|
endif |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
ifeq ($(WINBASED),yes) |
||||||
|
EXT = .exe |
||||||
|
WINDRES = windres |
||||||
|
endif |
||||||
|
|
||||||
|
#determine if dev/nul based on host environment |
||||||
|
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME)))) |
||||||
|
VOID := /dev/null |
||||||
|
else |
||||||
|
ifneq (,$(filter Windows%,$(OS))) |
||||||
|
VOID := nul |
||||||
|
else |
||||||
|
VOID := /dev/null |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS%,$(shell $(UNAME)))) |
||||||
|
POSIX_ENV = Yes |
||||||
|
else |
||||||
|
POSIX_ENV = No |
||||||
|
endif |
||||||
|
|
||||||
|
# Avoid symlinks when targeting Windows or building on a Windows host |
||||||
|
ifeq ($(WINBASED),yes) |
||||||
|
LN_SF = cp -p |
||||||
|
else |
||||||
|
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME)))) |
||||||
|
LN_SF = cp -p |
||||||
|
else |
||||||
|
ifneq (,$(filter Windows%,$(OS))) |
||||||
|
LN_SF = cp -p |
||||||
|
else |
||||||
|
LN_SF = ln -sf |
||||||
|
endif |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
ifneq (,$(filter $(shell $(UNAME)),SunOS)) |
||||||
|
INSTALL ?= ginstall |
||||||
|
else |
||||||
|
INSTALL ?= install |
||||||
|
endif |
||||||
|
|
||||||
|
INSTALL_PROGRAM ?= $(INSTALL) -m 755 |
||||||
|
INSTALL_DATA ?= $(INSTALL) -m 644 |
||||||
|
INSTALL_DIR ?= $(INSTALL) -d -m 755 |
@ -0,0 +1,341 @@ |
|||||||
|
v1.9.4 |
||||||
|
perf : faster decoding speed (~+20%) on aarch64 platforms |
||||||
|
perf : faster decoding speed (~+70%) for -BD4 setting in CLI |
||||||
|
api : new function `LZ4_decompress_safe_partial_usingDict()` by @yawqi |
||||||
|
api : lz4frame: ability to provide custom allocators at state creation |
||||||
|
api : can skip checksum validation for improved decoding speed |
||||||
|
api : new experimental unit `lz4file` for file i/o API, by @anjiahao1 |
||||||
|
api : new experimental function `LZ4F_uncompressedUpdate()`, by @alexmohr |
||||||
|
cli : `--list` works on `stdin` input, by @Low-power |
||||||
|
cli : `--no-crc` does not produce (compression) nor check (decompression) checksums |
||||||
|
cli : fix: `--test` and `--list` produce an error code when parsing invalid input |
||||||
|
cli : fix: support skippable frames when passed via `stdin`, reported by @davidmankin |
||||||
|
build: fix: Makefile respects CFLAGS directives passed via environment variable |
||||||
|
build: `LZ4_FREESTANDING`, new build macro for freestanding environments, by @t-mat |
||||||
|
build: `make` and `make test` are compatible with `-j` parallel run |
||||||
|
build: AS/400 compatibility, by @jonrumsey |
||||||
|
build: Solaris 10 compatibility, by @pekdon |
||||||
|
build: MSVC 2022 support, by @t-mat |
||||||
|
build: improved meson script, by @eli-schwartz |
||||||
|
doc : Updated LZ4 block format, provide an "implementation notes" section |
||||||
|
|
||||||
|
v1.9.3 |
||||||
|
perf: highly improved speed in kernel space, by @terrelln |
||||||
|
perf: faster speed with Visual Studio, thanks to @wolfpld and @remittor |
||||||
|
perf: improved dictionary compression speed, by @felixhandte |
||||||
|
perf: fixed LZ4_compress_HC_destSize() ratio, detected by @hsiangkao |
||||||
|
perf: reduced stack usage in high compression mode, by @Yanpas |
||||||
|
api : LZ4_decompress_safe_partial() supports unknown compressed size, requested by @jfkthame |
||||||
|
api : improved LZ4F_compressBound() with automatic flushing, by Christopher Harvie |
||||||
|
api : can (de)compress to/from NULL without UBs |
||||||
|
api : fix alignment test on 32-bit systems (state initialization) |
||||||
|
api : fix LZ4_saveDictHC() in corner case scenario, detected by @IgorKorkin |
||||||
|
cli : `-l` legacy format is now compatible with `-m` multiple files, by Filipe Calasans |
||||||
|
cli : benchmark mode supports dictionary, by @rkoradi |
||||||
|
cli : fix --fast with large argument, detected by @picoHz |
||||||
|
build: link to user-defined memory functions with LZ4_USER_MEMORY_FUNCTIONS, suggested by Yuriy Levchenko |
||||||
|
build: contrib/cmake_unofficial/ moved to build/cmake/ |
||||||
|
build: visual/* moved to build/ |
||||||
|
build: updated meson script, by @neheb |
||||||
|
build: tinycc support, by Anton Kochkov |
||||||
|
install: Haiku support, by Jerome Duval |
||||||
|
doc : updated LZ4 frame format, clarify EndMark |
||||||
|
|
||||||
|
v1.9.2 |
||||||
|
fix : out-of-bound read in exceptional circumstances when using decompress_partial(), by @terrelln |
||||||
|
fix : slim opportunity for out-of-bound write with compress_fast() with a large enough input and when providing an output smaller than recommended (< LZ4_compressBound(inputSize)), by @terrelln |
||||||
|
fix : rare data corruption bug with LZ4_compress_destSize(), by @terrelln |
||||||
|
fix : data corruption bug when Streaming with an Attached Dict in HC Mode, by @felixhandte |
||||||
|
perf: enable LZ4_FAST_DEC_LOOP on aarch64/GCC by default, by @prekageo |
||||||
|
perf: improved lz4frame streaming API speed, by @dreambottle |
||||||
|
perf: speed up lz4hc on slow patterns when using external dictionary, by @terrelln |
||||||
|
api: better in-place decompression and compression support |
||||||
|
cli : --list supports multi-frames files, by @gstedman |
||||||
|
cli: --version outputs to stdout |
||||||
|
cli : add option --best as an alias of -12 , by @Low-power |
||||||
|
misc: Integration into oss-fuzz by @cmeister2, expanded list of scenarios by @terrelln |
||||||
|
|
||||||
|
v1.9.1 |
||||||
|
fix : decompression functions were reading a few bytes beyond input size (introduced in v1.9.0, reported by @ppodolsky and @danlark1) |
||||||
|
api : fix : lz4frame initializers compatibility with c++, reported by @degski |
||||||
|
cli : added command --list, based on a patch by @gabrielstedman |
||||||
|
build: improved Windows build, by @JPeterMugaas |
||||||
|
build: AIX, by Norman Green |
||||||
|
|
||||||
|
v1.9.0 |
||||||
|
perf: large decompression speed improvement on x86/x64 (up to +20%) by @djwatson |
||||||
|
api : changed : _destSize() compression variants are promoted to stable API |
||||||
|
api : new : LZ4_initStream(HC), replacing LZ4_resetStream(HC) |
||||||
|
api : changed : LZ4_resetStream(HC) as recommended reset function, for better performance on small data |
||||||
|
cli : support custom block sizes, by @blezsan |
||||||
|
build: source code can be amalgamated, by Bing Xu |
||||||
|
build: added meson build, by @lzutao |
||||||
|
build: new build macros : LZ4_DISTANCE_MAX, LZ4_FAST_DEC_LOOP |
||||||
|
install: MidnightBSD, by @laffer1 |
||||||
|
install: msys2 on Windows 10, by @vtorri |
||||||
|
|
||||||
|
v1.8.3 |
||||||
|
perf: minor decompression speed improvement (~+2%) with gcc |
||||||
|
fix : corruption in v1.8.2 at level 9 for files > 64KB under rare conditions (#560) |
||||||
|
cli : new command --fast, by @jennifermliu |
||||||
|
cli : fixed elapsed time, and added cpu load indicator (on -vv) (#555) |
||||||
|
api : LZ4_decompress_safe_partial() now decodes exactly the nb of bytes requested (feature request #566) |
||||||
|
build : added Haiku target, by @fbrosson, and MidnightBSD, by @laffer1 |
||||||
|
doc : updated documentation regarding dictionary compression |
||||||
|
|
||||||
|
v1.8.2 |
||||||
|
perf: *much* faster dictionary compression on small files, by @felixhandte |
||||||
|
perf: improved decompression speed and binary size, by Alexey Tourbin (@svpv) |
||||||
|
perf: slightly faster HC compression and decompression speed |
||||||
|
perf: very small compression ratio improvement |
||||||
|
fix : compression compatible with low memory addresses (< 0xFFFF) |
||||||
|
fix : decompression segfault when provided with NULL input, by @terrelln |
||||||
|
cli : new command --favor-decSpeed |
||||||
|
cli : benchmark mode more accurate for small inputs |
||||||
|
fullbench : can bench _destSize() variants, by @felixhandte |
||||||
|
doc : clarified block format parsing restrictions, by Alexey Tourbin (@svpv) |
||||||
|
|
||||||
|
v1.8.1 |
||||||
|
perf : faster and stronger ultra modes (levels 10+) |
||||||
|
perf : slightly faster compression and decompression speed |
||||||
|
perf : fix bad degenerative case, reported by @c-morgenstern |
||||||
|
fix : decompression failed when using a combination of extDict + low memory address (#397), reported and fixed by Julian Scheid (@jscheid) |
||||||
|
cli : support for dictionary compression (`-D`), by Felix Handte @felixhandte |
||||||
|
cli : fix : `lz4 -d --rm` preserves timestamp (#441) |
||||||
|
cli : fix : do not modify /dev/null permission as root, by @aliceatlas |
||||||
|
api : `_destSize()` variant supported for all compression levels |
||||||
|
build : `make` and `make test` compatible with `-jX`, reported by @mwgamera |
||||||
|
build : can control LZ4LIB_VISIBILITY macro, by @mikir |
||||||
|
install: fix man page directory (#387), reported by Stuart Cardall (@itoffshore) |
||||||
|
|
||||||
|
v1.8.0 |
||||||
|
cli : fix : do not modify /dev/null permissions, reported by @Maokaman1 |
||||||
|
cli : added GNU separator -- specifying that all following arguments are files |
||||||
|
API : added LZ4_compress_HC_destSize(), by Oleg (@remittor) |
||||||
|
API : added LZ4F_resetDecompressionContext() |
||||||
|
API : lz4frame : negative compression levels trigger fast acceleration, request by Lawrence Chan |
||||||
|
API : lz4frame : can control block checksum and dictionary ID |
||||||
|
API : fix : expose obsolete decoding functions, reported by Chen Yufei |
||||||
|
API : experimental : lz4frame_static : new dictionary compression API |
||||||
|
build : fix : static lib installation, by Ido Rosen |
||||||
|
build : dragonFlyBSD, OpenBSD, NetBSD supported |
||||||
|
build : LZ4_MEMORY_USAGE can be modified at compile time, through external define |
||||||
|
doc : Updated LZ4 Frame format to v1.6.0, restoring Dictionary-ID field |
||||||
|
doc : lz4 api manual, by Przemyslaw Skibinski |
||||||
|
|
||||||
|
v1.7.5 |
||||||
|
lz4hc : new high compression mode : levels 10-12 compress more and slower, by Przemyslaw Skibinski |
||||||
|
lz4cat : fix : works with relative path (#284) and stdin (#285) (reported by @beiDei8z) |
||||||
|
cli : fix minor notification when using -r recursive mode |
||||||
|
API : lz4frame : LZ4F_frameBound(0) gives upper bound of *flush() and *End() operations (#290, #280) |
||||||
|
doc : markdown version of man page, by Takayuki Matsuoka (#279) |
||||||
|
build : Makefile : fix make -jX lib+exe concurrency (#277) |
||||||
|
build : cmake : improvements by Michał Górny (#296) |
||||||
|
|
||||||
|
v1.7.4.2 |
||||||
|
fix : Makefile : release build compatible with PIE and customized compilation directives provided through environment variables (#274, reported by Antoine Martin) |
||||||
|
|
||||||
|
v1.7.4 |
||||||
|
Improved : much better speed in -mx32 mode |
||||||
|
cli : fix : Large file support in 32-bits mode on Mac OS-X |
||||||
|
fix : compilation on gcc 4.4 (#272), reported by Antoine Martin |
||||||
|
|
||||||
|
v1.7.3 |
||||||
|
Changed : moved to versioning; package, cli and library have same version number |
||||||
|
Improved: Small decompression speed boost |
||||||
|
Improved: Small compression speed improvement on 64-bits systems |
||||||
|
Improved: Small compression ratio and speed improvement on small files |
||||||
|
Improved: Significant speed boost on ARMv6 and ARMv7 |
||||||
|
Fix : better ratio on 64-bits big-endian targets |
||||||
|
Improved cmake build script, by Evan Nemerson |
||||||
|
New liblz4-dll project, by Przemyslaw Skibinki |
||||||
|
Makefile: Generates object files (*.o) for faster (re)compilation on low power systems |
||||||
|
cli : new : --rm and --help commands |
||||||
|
cli : new : preserved file attributes, by Przemyslaw Skibinki |
||||||
|
cli : fix : crash on some invalid inputs |
||||||
|
cli : fix : -t correctly validates lz4-compressed files, by Nick Terrell |
||||||
|
cli : fix : detects and reports fread() errors, thanks to Hiroshi Fujishima report #243 |
||||||
|
cli : bench : new : -r recursive mode |
||||||
|
lz4cat : can cat multiple files in a single command line (#184) |
||||||
|
Added : doc/lz4_manual.html, by Przemyslaw Skibinski |
||||||
|
Added : dictionary compression and frame decompression examples, by Nick Terrell |
||||||
|
Added : Debianization, by Evgeniy Polyakov |
||||||
|
|
||||||
|
r131 |
||||||
|
New : Dos/DJGPP target, thanks to Louis Santillan (#114) |
||||||
|
Added : Example using lz4frame library, by Zbigniew Jędrzejewski-Szmek (#118) |
||||||
|
Changed: xxhash symbols are modified (namespace emulation) within liblz4 |
||||||
|
|
||||||
|
r130: |
||||||
|
Fixed : incompatibility sparse mode vs console, reported by Yongwoon Cho (#105) |
||||||
|
Fixed : LZ4IO exits too early when frame crc not present, reported by Yongwoon Cho (#106) |
||||||
|
Fixed : incompatibility sparse mode vs append mode, reported by Takayuki Matsuoka (#110) |
||||||
|
Performance fix : big compression speed boost for clang (+30%) |
||||||
|
New : cross-version test, by Takayuki Matsuoka |
||||||
|
|
||||||
|
r129: |
||||||
|
Added : LZ4_compress_fast(), LZ4_compress_fast_continue() |
||||||
|
Added : LZ4_compress_destSize() |
||||||
|
Changed: New lz4 and lz4hc compression API. Previous function prototypes still supported. |
||||||
|
Changed: Sparse file support enabled by default |
||||||
|
New : LZ4 CLI improved performance compressing/decompressing multiple files (#86, kind contribution from Kyle J. Harper & Takayuki Matsuoka) |
||||||
|
Fixed : GCC 4.9+ optimization bug - Reported by Markus Trippelsdorf, Greg Slazinski & Evan Nemerson |
||||||
|
Changed: Enums converted to LZ4F_ namespace convention - by Takayuki Matsuoka |
||||||
|
Added : AppVeyor CI environment, for Visual tests - Suggested by Takayuki Matsuoka |
||||||
|
Modified:Obsolete functions generate warnings - Suggested by Evan Nemerson, contributed by Takayuki Matsuoka |
||||||
|
Fixed : Bug #75 (unfinished stream), reported by Yongwoon Cho |
||||||
|
Updated: Documentation converted to MarkDown format |
||||||
|
|
||||||
|
r128: |
||||||
|
New : lz4cli sparse file support (Requested by Neil Wilson, and contributed by Takayuki Matsuoka) |
||||||
|
New : command -m, to compress multiple files in a single command (suggested by Kyle J. Harper) |
||||||
|
Fixed : Restored lz4hc compression ratio (slightly lower since r124) |
||||||
|
New : lz4 cli supports long commands (suggested by Takayuki Matsuoka) |
||||||
|
New : lz4frame & lz4cli frame content size support |
||||||
|
New : lz4frame supports skippable frames, as requested by Sergey Cherepanov |
||||||
|
Changed: Default "make install" directory is /usr/local, as notified by Ron Johnson |
||||||
|
New : lz4 cli supports "pass-through" mode, requested by Neil Wilson |
||||||
|
New : datagen can generate sparse files |
||||||
|
New : scan-build tests, thanks to kind help by Takayuki Matsuoka |
||||||
|
New : g++ compatibility tests |
||||||
|
New : arm cross-compilation test, thanks to kind help by Takayuki Matsuoka |
||||||
|
Fixed : Fuzzer + frametest compatibility with NetBSD (issue #48, reported by Thomas Klausner) |
||||||
|
Added : Visual project directory |
||||||
|
Updated: Man page & Specification |
||||||
|
|
||||||
|
r127: |
||||||
|
N/A : added a file on SVN |
||||||
|
|
||||||
|
r126: |
||||||
|
New : lz4frame API is now integrated into liblz4 |
||||||
|
Fixed : GCC 4.9 bug on highest performance settings, reported by Greg Slazinski |
||||||
|
Fixed : bug within LZ4 HC streaming mode, reported by James Boyle |
||||||
|
Fixed : older compiler don't like nameless unions, reported by Cheyi Lin |
||||||
|
Changed : lz4 is C90 compatible |
||||||
|
Changed : added -pedantic option, fixed a few mminor warnings |
||||||
|
|
||||||
|
r125: |
||||||
|
Changed : endian and alignment code |
||||||
|
Changed : directory structure : new "lib" directory |
||||||
|
Updated : lz4io, now uses lz4frame |
||||||
|
Improved: slightly improved decoding speed |
||||||
|
Fixed : LZ4_compress_limitedOutput(); Special thanks to Christopher Speller ! |
||||||
|
Fixed : some alignment warnings under clang |
||||||
|
Fixed : deprecated function LZ4_slideInputBufferHC() |
||||||
|
|
||||||
|
r124: |
||||||
|
New : LZ4 HC streaming mode |
||||||
|
Fixed : LZ4F_compressBound() using null preferencesPtr |
||||||
|
Updated : xxHash to r38 |
||||||
|
Updated library number, to 1.4.0 |
||||||
|
|
||||||
|
r123: |
||||||
|
Added : experimental lz4frame API, thanks to Takayuki Matsuoka and Christopher Jackson for testings |
||||||
|
Fix : s390x support, thanks to Nobuhiro Iwamatsu |
||||||
|
Fix : test mode (-t) no longer requires confirmation, thanks to Thary Nguyen |
||||||
|
|
||||||
|
r122: |
||||||
|
Fix : AIX & AIX64 support (SamG) |
||||||
|
Fix : mips 64-bits support (lew van) |
||||||
|
Added : Examples directory, using code examples from Takayuki Matsuoka |
||||||
|
Updated : Framing specification, to v1.4.1 |
||||||
|
Updated : xxHash, to r36 |
||||||
|
|
||||||
|
r121: |
||||||
|
Added : Makefile : install for kFreeBSD and Hurd (Nobuhiro Iwamatsu) |
||||||
|
Fix : Makefile : install for OS-X and BSD, thanks to Takayuki Matsuoka |
||||||
|
|
||||||
|
r120: |
||||||
|
Modified : Streaming API, using strong types |
||||||
|
Added : LZ4_versionNumber(), thanks to Takayuki Matsuoka |
||||||
|
Fix : OS-X : library install name, thanks to Clemens Lang |
||||||
|
Updated : Makefile : synchronize library version number with lz4.h, thanks to Takayuki Matsuoka |
||||||
|
Updated : Makefile : stricter compilation flags |
||||||
|
Added : pkg-config, thanks to Zbigniew Jędrzejewski-Szmek (issue 135) |
||||||
|
Makefile : lz4-test only test native binaries, as suggested by Michał Górny (issue 136) |
||||||
|
Updated : xxHash to r35 |
||||||
|
|
||||||
|
r119: |
||||||
|
Fix : Issue 134 : extended malicious address space overflow in 32-bits mode for some specific configurations |
||||||
|
|
||||||
|
r118: |
||||||
|
New : LZ4 Streaming API (Fast version), special thanks to Takayuki Matsuoka |
||||||
|
New : datagen : parametrable synthetic data generator for tests |
||||||
|
Improved : fuzzer, support more test cases, more parameters, ability to jump to specific test |
||||||
|
fix : support ppc64le platform (issue 131) |
||||||
|
fix : Issue 52 (malicious address space overflow in 32-bits mode when using large custom format) |
||||||
|
fix : Makefile : minor issue 130 : header files permissions |
||||||
|
|
||||||
|
r117: |
||||||
|
Added : man pages for lz4c and lz4cat |
||||||
|
Added : automated tests on Travis, thanks to Takayuki Matsuoka ! |
||||||
|
fix : block-dependency command line (issue 127) |
||||||
|
fix : lz4fullbench (issue 128) |
||||||
|
|
||||||
|
r116: |
||||||
|
hotfix (issue 124 & 125) |
||||||
|
|
||||||
|
r115: |
||||||
|
Added : lz4cat utility, installed on POSX systems (issue 118) |
||||||
|
OS-X compatible compilation of dynamic library (issue 115) |
||||||
|
|
||||||
|
r114: |
||||||
|
Makefile : library correctly compiled with -O3 switch (issue 114) |
||||||
|
Makefile : library compilation compatible with clang |
||||||
|
Makefile : library is versioned and linked (issue 119) |
||||||
|
lz4.h : no more static inline prototypes (issue 116) |
||||||
|
man : improved header/footer (issue 111) |
||||||
|
Makefile : Use system default $(CC) & $(MAKE) variables (issue 112) |
||||||
|
xxhash : updated to r34 |
||||||
|
|
||||||
|
r113: |
||||||
|
Large decompression speed improvement for GCC 32-bits. Thanks to Valery Croizier ! |
||||||
|
LZ4HC : Compression Level is now a programmable parameter (CLI from 4 to 9) |
||||||
|
Separated IO routines from command line (lz4io.c) |
||||||
|
Version number into lz4.h (suggested by Francesc Alted) |
||||||
|
|
||||||
|
r112: |
||||||
|
quickfix |
||||||
|
|
||||||
|
r111 : |
||||||
|
Makefile : added capability to install libraries |
||||||
|
Modified Directory tree, to better separate libraries from programs. |
||||||
|
|
||||||
|
r110 : |
||||||
|
lz4 & lz4hc : added capability to allocate state & stream state with custom allocator (issue 99) |
||||||
|
fuzzer & fullbench : updated to test new functions |
||||||
|
man : documented -l command (Legacy format, for Linux kernel compression) (issue 102) |
||||||
|
cmake : improved version by Mika Attila, building programs and libraries (issue 100) |
||||||
|
xxHash : updated to r33 |
||||||
|
Makefile : clean also delete local package .tar.gz |
||||||
|
|
||||||
|
r109 : |
||||||
|
lz4.c : corrected issue 98 (LZ4_compress_limitedOutput()) |
||||||
|
Makefile : can specify version number from makefile |
||||||
|
|
||||||
|
r108 : |
||||||
|
lz4.c : corrected compression efficiency issue 97 in 64-bits chained mode (-BD) for streams > 4 GB (thanks Roman Strashkin for reporting) |
||||||
|
|
||||||
|
r107 : |
||||||
|
Makefile : support DESTDIR for staged installs. Thanks Jorge Aparicio. |
||||||
|
Makefile : make install installs both lz4 and lz4c (Jorge Aparicio) |
||||||
|
Makefile : removed -Wno-implicit-declaration compilation switch |
||||||
|
lz4cli.c : include <stduni.h> for isatty() (Luca Barbato) |
||||||
|
lz4.h : introduced LZ4_MAX_INPUT_SIZE constant (Shay Green) |
||||||
|
lz4.h : LZ4_compressBound() : unified macro and inline definitions (Shay Green) |
||||||
|
lz4.h : LZ4_decompressSafe_partial() : clarify comments (Shay Green) |
||||||
|
lz4.c : LZ4_compress() verify input size condition (Shay Green) |
||||||
|
bench.c : corrected a bug in free memory size evaluation |
||||||
|
cmake : install into bin/ directory (Richard Yao) |
||||||
|
cmake : check for just C compiler (Elan Ruusamae) |
||||||
|
|
||||||
|
r106 : |
||||||
|
Makefile : make dist modify text files in the package to respect Unix EoL convention |
||||||
|
lz4cli.c : corrected small display bug in HC mode |
||||||
|
|
||||||
|
r105 : |
||||||
|
Makefile : New install script and man page, contributed by Prasad Pandit |
||||||
|
lz4cli.c : Minor modifications, for easier extensibility |
||||||
|
COPYING : added license file |
||||||
|
LZ4_Streaming_Format.odt : modified file name to remove white space characters |
||||||
|
Makefile : .exe suffix now properly added only for Windows target |
@ -0,0 +1,120 @@ |
|||||||
|
LZ4 - Extremely fast compression |
||||||
|
================================ |
||||||
|
|
||||||
|
LZ4 is lossless compression algorithm, |
||||||
|
providing compression speed > 500 MB/s per core, |
||||||
|
scalable with multi-cores CPU. |
||||||
|
It features an extremely fast decoder, |
||||||
|
with speed in multiple GB/s per core, |
||||||
|
typically reaching RAM speed limits on multi-core systems. |
||||||
|
|
||||||
|
Speed can be tuned dynamically, selecting an "acceleration" factor |
||||||
|
which trades compression ratio for faster speed. |
||||||
|
On the other end, a high compression derivative, LZ4_HC, is also provided, |
||||||
|
trading CPU time for improved compression ratio. |
||||||
|
All versions feature the same decompression speed. |
||||||
|
|
||||||
|
LZ4 is also compatible with [dictionary compression](https://github.com/facebook/zstd#the-case-for-small-data-compression), |
||||||
|
both at [API](https://github.com/lz4/lz4/blob/v1.8.3/lib/lz4frame.h#L481) and [CLI](https://github.com/lz4/lz4/blob/v1.8.3/programs/lz4.1.md#operation-modifiers) levels. |
||||||
|
It can ingest any input file as dictionary, though only the final 64KB are used. |
||||||
|
This capability can be combined with the [Zstandard Dictionary Builder](https://github.com/facebook/zstd/blob/v1.3.5/programs/zstd.1.md#dictionary-builder), |
||||||
|
in order to drastically improve compression performance on small files. |
||||||
|
|
||||||
|
|
||||||
|
LZ4 library is provided as open-source software using BSD 2-Clause license. |
||||||
|
|
||||||
|
|
||||||
|
|Branch |Status | |
||||||
|
|------------|---------| |
||||||
|
|dev | [![Build Status][travisDevBadge]][travisLink] [![Build status][AppveyorDevBadge]][AppveyorLink] | |
||||||
|
|
||||||
|
[travisDevBadge]: https://travis-ci.org/lz4/lz4.svg?branch=dev "Continuous Integration test suite" |
||||||
|
[travisLink]: https://travis-ci.org/lz4/lz4 |
||||||
|
[AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/github/lz4/lz4?branch=dev&svg=true "Windows test suite" |
||||||
|
[AppveyorLink]: https://ci.appveyor.com/project/YannCollet/lz4-1lndh |
||||||
|
|
||||||
|
|
||||||
|
Benchmarks |
||||||
|
------------------------- |
||||||
|
|
||||||
|
The benchmark uses [lzbench], from @inikep |
||||||
|
compiled with GCC v8.2.0 on Linux 64-bits (Ubuntu 4.18.0-17). |
||||||
|
The reference system uses a Core i7-9700K CPU @ 4.9GHz (w/ turbo boost). |
||||||
|
Benchmark evaluates the compression of reference [Silesia Corpus] |
||||||
|
in single-thread mode. |
||||||
|
|
||||||
|
[lzbench]: https://github.com/inikep/lzbench |
||||||
|
[Silesia Corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia |
||||||
|
|
||||||
|
| Compressor | Ratio | Compression | Decompression | |
||||||
|
| ---------- | ----- | ----------- | ------------- | |
||||||
|
| memcpy | 1.000 | 13700 MB/s | 13700 MB/s | |
||||||
|
|**LZ4 default (v1.9.0)** |**2.101**| **780 MB/s**| **4970 MB/s** | |
||||||
|
| LZO 2.09 | 2.108 | 670 MB/s | 860 MB/s | |
||||||
|
| QuickLZ 1.5.0 | 2.238 | 575 MB/s | 780 MB/s | |
||||||
|
| Snappy 1.1.4 | 2.091 | 565 MB/s | 1950 MB/s | |
||||||
|
| [Zstandard] 1.4.0 -1 | 2.883 | 515 MB/s | 1380 MB/s | |
||||||
|
| LZF v3.6 | 2.073 | 415 MB/s | 910 MB/s | |
||||||
|
| [zlib] deflate 1.2.11 -1| 2.730 | 100 MB/s | 415 MB/s | |
||||||
|
|**LZ4 HC -9 (v1.9.0)** |**2.721**| 41 MB/s | **4900 MB/s** | |
||||||
|
| [zlib] deflate 1.2.11 -6| 3.099 | 36 MB/s | 445 MB/s | |
||||||
|
|
||||||
|
[zlib]: http://www.zlib.net/ |
||||||
|
[Zstandard]: http://www.zstd.net/ |
||||||
|
|
||||||
|
LZ4 is also compatible and optimized for x32 mode, |
||||||
|
for which it provides additional speed performance. |
||||||
|
|
||||||
|
|
||||||
|
Installation |
||||||
|
------------------------- |
||||||
|
|
||||||
|
``` |
||||||
|
make |
||||||
|
make install # this command may require root permissions |
||||||
|
``` |
||||||
|
|
||||||
|
LZ4's `Makefile` supports standard [Makefile conventions], |
||||||
|
including [staged installs], [redirection], or [command redefinition]. |
||||||
|
It is compatible with parallel builds (`-j#`). |
||||||
|
|
||||||
|
[Makefile conventions]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html |
||||||
|
[staged installs]: https://www.gnu.org/prep/standards/html_node/DESTDIR.html |
||||||
|
[redirection]: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html |
||||||
|
[command redefinition]: https://www.gnu.org/prep/standards/html_node/Utilities-in-Makefiles.html |
||||||
|
|
||||||
|
### Building LZ4 - Using vcpkg |
||||||
|
|
||||||
|
You can download and install LZ4 using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: |
||||||
|
|
||||||
|
git clone https://github.com/Microsoft/vcpkg.git |
||||||
|
cd vcpkg |
||||||
|
./bootstrap-vcpkg.sh |
||||||
|
./vcpkg integrate install |
||||||
|
vcpkg install lz4 |
||||||
|
|
||||||
|
The LZ4 port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. |
||||||
|
|
||||||
|
Documentation |
||||||
|
------------------------- |
||||||
|
|
||||||
|
The raw LZ4 block compression format is detailed within [lz4_Block_format]. |
||||||
|
|
||||||
|
Arbitrarily long files or data streams are compressed using multiple blocks, |
||||||
|
for streaming requirements. These blocks are organized into a frame, |
||||||
|
defined into [lz4_Frame_format]. |
||||||
|
Interoperable versions of LZ4 must also respect the frame format. |
||||||
|
|
||||||
|
[lz4_Block_format]: doc/lz4_Block_format.md |
||||||
|
[lz4_Frame_format]: doc/lz4_Frame_format.md |
||||||
|
|
||||||
|
|
||||||
|
Other source versions |
||||||
|
------------------------- |
||||||
|
|
||||||
|
Beyond the C reference source, |
||||||
|
many contributors have created versions of lz4 in multiple languages |
||||||
|
(Java, C#, Python, Perl, Ruby, etc.). |
||||||
|
A list of known source ports is maintained on the [LZ4 Homepage]. |
||||||
|
|
||||||
|
[LZ4 Homepage]: http://www.lz4.org |
@ -0,0 +1,147 @@ |
|||||||
|
version: 1.0.{build} |
||||||
|
environment: |
||||||
|
matrix: |
||||||
|
- COMPILER: "gcc" |
||||||
|
PLATFORM: "mingw64" |
||||||
|
- COMPILER: "gcc" |
||||||
|
PLATFORM: "mingw32" |
||||||
|
- COMPILER: "visual" |
||||||
|
CONFIGURATION: "Debug" |
||||||
|
PLATFORM: "x64" |
||||||
|
- COMPILER: "visual" |
||||||
|
CONFIGURATION: "Debug" |
||||||
|
PLATFORM: "Win32" |
||||||
|
- COMPILER: "visual" |
||||||
|
CONFIGURATION: "Release" |
||||||
|
PLATFORM: "x64" |
||||||
|
- COMPILER: "visual" |
||||||
|
CONFIGURATION: "Release" |
||||||
|
PLATFORM: "Win32" |
||||||
|
- COMPILER: "gcc" |
||||||
|
PLATFORM: "clang" |
||||||
|
|
||||||
|
install: |
||||||
|
- ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% |
||||||
|
- MKDIR bin |
||||||
|
- if [%COMPILER%]==[gcc] SET PATH_ORIGINAL=%PATH% |
||||||
|
- if [%COMPILER%]==[gcc] ( |
||||||
|
SET "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin" && |
||||||
|
SET "PATH_MINGW64=c:\msys64\mingw64\bin;c:\msys64\usr\bin" && |
||||||
|
COPY C:\MinGW\bin\mingw32-make.exe C:\MinGW\bin\make.exe && |
||||||
|
COPY C:\MinGW\bin\gcc.exe C:\MinGW\bin\cc.exe |
||||||
|
) else ( |
||||||
|
IF [%PLATFORM%]==[x64] (SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;") |
||||||
|
) |
||||||
|
|
||||||
|
build_script: |
||||||
|
- if [%PLATFORM%]==[mingw32] SET PATH=%PATH_MINGW32%;%PATH_ORIGINAL% |
||||||
|
- if [%PLATFORM%]==[mingw64] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL% |
||||||
|
- if [%PLATFORM%]==[clang] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL% |
||||||
|
- ECHO *** && |
||||||
|
ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION% && |
||||||
|
ECHO *** |
||||||
|
- if [%PLATFORM%]==[clang] (clang -v) |
||||||
|
- if [%COMPILER%]==[gcc] (gcc -v) |
||||||
|
- if [%COMPILER%]==[gcc] ( |
||||||
|
echo ----- && |
||||||
|
make -v && |
||||||
|
echo ----- && |
||||||
|
if not [%PLATFORM%]==[clang] ( |
||||||
|
make -C programs lz4 && |
||||||
|
make -C tests fullbench && |
||||||
|
make -C tests fuzzer && |
||||||
|
make -C lib lib V=1 |
||||||
|
) ELSE ( |
||||||
|
make -C programs lz4 CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && |
||||||
|
make -C tests fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && |
||||||
|
make -C tests fuzzer CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && |
||||||
|
make -C lib lib CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" |
||||||
|
) |
||||||
|
) |
||||||
|
- if [%COMPILER%]==[gcc] if not [%PLATFORM%]==[clang] ( |
||||||
|
MKDIR bin\dll bin\static bin\example bin\include && |
||||||
|
COPY tests\fullbench.c bin\example\ && |
||||||
|
COPY lib\xxhash.c bin\example\ && |
||||||
|
COPY lib\xxhash.h bin\example\ && |
||||||
|
COPY lib\lz4.h bin\include\ && |
||||||
|
COPY lib\lz4hc.h bin\include\ && |
||||||
|
COPY lib\lz4frame.h bin\include\ && |
||||||
|
COPY lib\liblz4.a bin\static\liblz4_static.lib && |
||||||
|
COPY lib\dll\* bin\dll\ && |
||||||
|
COPY lib\dll\example\Makefile bin\example\ && |
||||||
|
COPY lib\dll\example\fullbench-dll.* bin\example\ && |
||||||
|
COPY lib\dll\example\README.md bin\ && |
||||||
|
COPY programs\lz4.exe bin\lz4.exe |
||||||
|
) |
||||||
|
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] ( |
||||||
|
7z.exe a -bb1 bin\lz4_x64.zip NEWS .\bin\lz4.exe .\bin\README.md .\bin\example .\bin\dll .\bin\static .\bin\include && |
||||||
|
appveyor PushArtifact bin\lz4_x64.zip |
||||||
|
) |
||||||
|
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] ( |
||||||
|
7z.exe a -bb1 bin\lz4_x86.zip NEWS .\bin\lz4.exe .\bin\README.md .\bin\example .\bin\dll .\bin\static .\bin\include && |
||||||
|
appveyor PushArtifact bin\lz4_x86.zip |
||||||
|
) |
||||||
|
- if [%COMPILER%]==[gcc] (COPY tests\*.exe programs\) |
||||||
|
- if [%COMPILER%]==[visual] ( |
||||||
|
ECHO *** && |
||||||
|
ECHO *** Building Visual Studio 2010 %PLATFORM%\%CONFIGURATION% && |
||||||
|
ECHO *** && |
||||||
|
msbuild "build\VS2010\lz4.sln" %ADDITIONALPARAM% /m /verbosity:minimal /property:PlatformToolset=v100 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /p:EnableWholeProgramOptimization=true /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && |
||||||
|
ECHO *** && |
||||||
|
ECHO *** Building Visual Studio 2012 %PLATFORM%\%CONFIGURATION% && |
||||||
|
ECHO *** && |
||||||
|
msbuild "build\VS2010\lz4.sln" /m /verbosity:minimal /property:PlatformToolset=v110 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && |
||||||
|
ECHO *** && |
||||||
|
ECHO *** Building Visual Studio 2013 %PLATFORM%\%CONFIGURATION% && |
||||||
|
ECHO *** && |
||||||
|
msbuild "build\VS2010\lz4.sln" /m /verbosity:minimal /property:PlatformToolset=v120 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && |
||||||
|
ECHO *** && |
||||||
|
ECHO *** Building Visual Studio 2015 %PLATFORM%\%CONFIGURATION% && |
||||||
|
ECHO *** && |
||||||
|
msbuild "build\VS2010\lz4.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && |
||||||
|
COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe programs\ |
||||||
|
) |
||||||
|
|
||||||
|
test_script: |
||||||
|
- ECHO *** && |
||||||
|
ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% && |
||||||
|
ECHO *** |
||||||
|
- if not [%COMPILER%]==[unknown] ( |
||||||
|
CD programs && |
||||||
|
lz4 -h && |
||||||
|
lz4 -i1b lz4.exe && |
||||||
|
lz4 -i1b5 lz4.exe && |
||||||
|
lz4 -i1b10 lz4.exe && |
||||||
|
lz4 -i1b15 lz4.exe && |
||||||
|
echo ------- lz4 tested ------- && |
||||||
|
fullbench.exe -i1 fullbench.exe && |
||||||
|
echo trying to launch fuzzer.exe && |
||||||
|
fuzzer.exe -v -T30s |
||||||
|
) |
||||||
|
|
||||||
|
artifacts: |
||||||
|
- path: bin\lz4_x64.zip |
||||||
|
- path: bin\lz4_x86.zip |
||||||
|
|
||||||
|
deploy: |
||||||
|
- provider: GitHub |
||||||
|
artifact: bin\lz4_x64.zip |
||||||
|
auth_token: |
||||||
|
secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId |
||||||
|
force_update: true |
||||||
|
prerelease: true |
||||||
|
on: |
||||||
|
COMPILER: gcc |
||||||
|
PLATFORM: "mingw64" |
||||||
|
appveyor_repo_tag: true |
||||||
|
|
||||||
|
- provider: GitHub |
||||||
|
artifact: bin\lz4_x86.zip |
||||||
|
auth_token: |
||||||
|
secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId |
||||||
|
force_update: true |
||||||
|
prerelease: true |
||||||
|
on: |
||||||
|
COMPILER: gcc |
||||||
|
PLATFORM: "mingw32" |
||||||
|
appveyor_repo_tag: true |
@ -0,0 +1,16 @@ |
|||||||
|
# Visual C++ |
||||||
|
.vs/ |
||||||
|
*Copy |
||||||
|
*.db |
||||||
|
*.opensdf |
||||||
|
*.sdf |
||||||
|
*.suo |
||||||
|
*.user |
||||||
|
ver*/ |
||||||
|
VS2010/bin/ |
||||||
|
VS2017/bin/ |
||||||
|
ipch |
||||||
|
|
||||||
|
# Fixup for lz4 project directories |
||||||
|
!VS2010/lz4 |
||||||
|
!VS2017/lz4 |
@ -0,0 +1,55 @@ |
|||||||
|
Projects for various integrated development environments (IDE) |
||||||
|
============================================================== |
||||||
|
|
||||||
|
#### Included projects |
||||||
|
|
||||||
|
The following projects are included with the lz4 distribution: |
||||||
|
- `cmake` - CMake project |
||||||
|
- `VS2010` - Visual Studio 2010 project (which also works well with Visual Studio 2012, 2013, 2015) |
||||||
|
- `VS2017` - Visual Studio 2017 project |
||||||
|
|
||||||
|
|
||||||
|
#### How to compile lz4 with Visual Studio |
||||||
|
|
||||||
|
1. Install Visual Studio e.g. VS 2015 Community Edition (it's free). |
||||||
|
2. Download the latest version of lz4 from https://github.com/lz4/lz4/releases |
||||||
|
3. Decompress ZIP archive. |
||||||
|
4. Go to decompressed directory then to `build` then `VS2010` and open `lz4.sln` |
||||||
|
5. Visual Studio will ask about converting VS2010 project to VS2015 and you should agree. |
||||||
|
6. Change `Debug` to `Release` and if you have 64-bit Windows change also `Win32` to `x64`. |
||||||
|
7. Press F7 on keyboard or select `BUILD` from the menu bar and choose `Build Solution`. |
||||||
|
8. If compilation will be fine a compiled executable will be in `build\VS2010\bin\x64_Release\lz4.exe` |
||||||
|
|
||||||
|
|
||||||
|
#### Projects available within lz4.sln |
||||||
|
|
||||||
|
The Visual Studio solution file `lz4.sln` contains many projects that will be compiled to the |
||||||
|
`build\VS2010\bin\$(Platform)_$(Configuration)` directory. For example `lz4` set to `x64` and |
||||||
|
`Release` will be compiled to `build\VS2010\bin\x64_Release\lz4.exe`. The solution file contains the |
||||||
|
following projects: |
||||||
|
|
||||||
|
- `lz4` : Command Line Utility, supporting gzip-like arguments |
||||||
|
- `datagen` : Synthetic and parametrable data generator, for tests |
||||||
|
- `frametest` : Test tool that checks lz4frame integrity on target platform |
||||||
|
- `fullbench` : Precisely measure speed for each lz4 inner functions |
||||||
|
- `fuzzer` : Test tool, to check lz4 integrity on target platform |
||||||
|
- `liblz4` : A static LZ4 library compiled to `liblz4_static.lib` |
||||||
|
- `liblz4-dll` : A dynamic LZ4 library (DLL) compiled to `liblz4.dll` with the import library `liblz4.lib` |
||||||
|
- `fullbench-dll` : The fullbench program compiled with the import library; the executable requires LZ4 DLL |
||||||
|
|
||||||
|
|
||||||
|
#### Using LZ4 DLL with Microsoft Visual C++ project |
||||||
|
|
||||||
|
The header files `lib\lz4.h`, `lib\lz4hc.h`, `lib\lz4frame.h` and the import library |
||||||
|
`build\VS2010\bin\$(Platform)_$(Configuration)\liblz4.lib` are required to |
||||||
|
compile a project using Visual C++. |
||||||
|
|
||||||
|
1. The path to header files should be added to `Additional Include Directories` that can |
||||||
|
be found in Project Properties of Visual Studio IDE in the `C/C++` Property Pages on the `General` page. |
||||||
|
2. The import library has to be added to `Additional Dependencies` that can |
||||||
|
be found in Project Properties in the `Linker` Property Pages on the `Input` page. |
||||||
|
If one will provide only the name `liblz4.lib` without a full path to the library |
||||||
|
then the directory has to be added to `Linker\General\Additional Library Directories`. |
||||||
|
|
||||||
|
The compiled executable will require LZ4 DLL which is available at |
||||||
|
`build\VS2010\bin\$(Platform)_$(Configuration)\liblz4.dll`. |
@ -0,0 +1,169 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectGuid>{D745AE2F-596A-403A-9B91-81A8C6779243}</ProjectGuid> |
||||||
|
<Keyword>Win32Proj</Keyword> |
||||||
|
<RootNamespace>datagen</RootNamespace> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="..\..\..\programs\datagen.c" /> |
||||||
|
<ClCompile Include="..\..\..\tests\datagencli.c" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClInclude Include="..\..\..\programs\datagen.h" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
</Project> |
@ -0,0 +1,176 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectGuid>{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}</ProjectGuid> |
||||||
|
<Keyword>Win32Proj</Keyword> |
||||||
|
<RootNamespace>frametest</RootNamespace> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" /> |
||||||
|
<ClCompile Include="..\..\..\tests\frametest.c" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
</Project> |
@ -0,0 +1,176 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectGuid>{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}</ProjectGuid> |
||||||
|
<Keyword>Win32Proj</Keyword> |
||||||
|
<RootNamespace>fullbench</RootNamespace> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" /> |
||||||
|
<ClCompile Include="..\..\..\tests\fullbench.c" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
</Project> |
@ -0,0 +1,173 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectGuid>{18B9F1A7-9C66-4352-898B-30804DADE0FD}</ProjectGuid> |
||||||
|
<Keyword>Win32Proj</Keyword> |
||||||
|
<RootNamespace>fuzzer</RootNamespace> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" /> |
||||||
|
<ClCompile Include="..\..\..\tests\fuzzer.c" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
</Project> |
@ -0,0 +1,51 @@ |
|||||||
|
// Microsoft Visual C++ generated resource script. |
||||||
|
// |
||||||
|
|
||||||
|
#include "lz4.h" /* LZ4_VERSION_STRING */ |
||||||
|
#define APSTUDIO_READONLY_SYMBOLS |
||||||
|
#include "verrsrc.h" |
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS |
||||||
|
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
||||||
|
LANGUAGE 9, 1 |
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////// |
||||||
|
// |
||||||
|
// Version |
||||||
|
// |
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO |
||||||
|
FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
||||||
|
#ifdef _DEBUG |
||||||
|
FILEFLAGS VS_FF_DEBUG |
||||||
|
#else |
||||||
|
FILEFLAGS 0x0L |
||||||
|
#endif |
||||||
|
FILEOS VOS_NT_WINDOWS32 |
||||||
|
FILETYPE VFT_DLL |
||||||
|
FILESUBTYPE VFT2_UNKNOWN |
||||||
|
BEGIN |
||||||
|
BLOCK "StringFileInfo" |
||||||
|
BEGIN |
||||||
|
BLOCK "040904B0" |
||||||
|
BEGIN |
||||||
|
VALUE "CompanyName", "Yann Collet" |
||||||
|
VALUE "FileDescription", "Extremely fast compression" |
||||||
|
VALUE "FileVersion", LZ4_VERSION_STRING |
||||||
|
VALUE "InternalName", "lz4.dll" |
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet" |
||||||
|
VALUE "OriginalFilename", "lz4.dll" |
||||||
|
VALUE "ProductName", "LZ4" |
||||||
|
VALUE "ProductVersion", LZ4_VERSION_STRING |
||||||
|
END |
||||||
|
END |
||||||
|
BLOCK "VarFileInfo" |
||||||
|
BEGIN |
||||||
|
VALUE "Translation", 0x0409, 1200 |
||||||
|
END |
||||||
|
END |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,175 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectGuid>{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}</ProjectGuid> |
||||||
|
<Keyword>Win32Proj</Keyword> |
||||||
|
<RootNamespace>liblz4</RootNamespace> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<TargetName>liblz4_static</TargetName> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<LinkIncremental>true</LinkIncremental> |
||||||
|
<TargetName>liblz4_static</TargetName> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<TargetName>liblz4_static</TargetName> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
<TargetName>liblz4_static</TargetName> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>false</EnablePREfast> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<PrecompiledHeader> |
||||||
|
</PrecompiledHeader> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<TreatWarningAsError>false</TreatWarningAsError> |
||||||
|
<EnablePREfast>true</EnablePREfast> |
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions> |
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
</Project> |
@ -0,0 +1,98 @@ |
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||||
|
# Visual Studio Express 2012 for Windows Desktop |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lz4", "lz4\lz4.vcxproj", "{E30329AC-0057-4FE0-8FDA-7F650D398C4C}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4-dll", "liblz4-dll\liblz4-dll.vcxproj", "{9800039D-4AAA-43A4-BB78-FEF6F4836927}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "liblz4\liblz4.vcxproj", "{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fuzzer", "fuzzer\fuzzer.vcxproj", "{18B9F1A7-9C66-4352-898B-30804DADE0FD}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench", "fullbench\fullbench.vcxproj", "{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frametest", "frametest\frametest.vcxproj", "{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datagen", "datagen\datagen.vcxproj", "{D745AE2F-596A-403A-9B91-81A8C6779243}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll\fullbench-dll.vcxproj", "{13992FD2-077E-4954-B065-A428198201A9}" |
||||||
|
ProjectSection(ProjectDependencies) = postProject |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927} = {9800039D-4AAA-43A4-BB78-FEF6F4836927} |
||||||
|
EndProjectSection |
||||||
|
EndProject |
||||||
|
Global |
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||||
|
Debug|Win32 = Debug|Win32 |
||||||
|
Debug|x64 = Debug|x64 |
||||||
|
Release|Win32 = Release|Win32 |
||||||
|
Release|x64 = Release|x64 |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{E30329AC-0057-4FE0-8FDA-7F650D398C4C}.Release|x64.Build.0 = Release|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.Build.0 = Release|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.Build.0 = Release|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.Build.0 = Release|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.Build.0 = Release|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.Build.0 = Release|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.Build.0 = Release|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.Build.0 = Release|x64 |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(SolutionProperties) = preSolution |
||||||
|
HideSolutionNode = FALSE |
||||||
|
EndGlobalSection |
||||||
|
EndGlobal |
@ -0,0 +1,51 @@ |
|||||||
|
// Microsoft Visual C++ generated resource script. |
||||||
|
// |
||||||
|
|
||||||
|
#include "lz4.h" /* LZ4_VERSION_STRING */ |
||||||
|
#define APSTUDIO_READONLY_SYMBOLS |
||||||
|
#include "verrsrc.h" |
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS |
||||||
|
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
||||||
|
LANGUAGE 9, 1 |
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////// |
||||||
|
// |
||||||
|
// Version |
||||||
|
// |
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO |
||||||
|
FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
||||||
|
#ifdef _DEBUG |
||||||
|
FILEFLAGS VS_FF_DEBUG |
||||||
|
#else |
||||||
|
FILEFLAGS 0x0L |
||||||
|
#endif |
||||||
|
FILEOS VOS_NT_WINDOWS32 |
||||||
|
FILETYPE VFT_DLL |
||||||
|
FILESUBTYPE VFT2_UNKNOWN |
||||||
|
BEGIN |
||||||
|
BLOCK "StringFileInfo" |
||||||
|
BEGIN |
||||||
|
BLOCK "040904B0" |
||||||
|
BEGIN |
||||||
|
VALUE "CompanyName", "Yann Collet" |
||||||
|
VALUE "FileDescription", "Extremely fast compression" |
||||||
|
VALUE "FileVersion", LZ4_VERSION_STRING |
||||||
|
VALUE "InternalName", "lz4.exe" |
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet" |
||||||
|
VALUE "OriginalFilename", "lz4.exe" |
||||||
|
VALUE "ProductName", "LZ4" |
||||||
|
VALUE "ProductVersion", LZ4_VERSION_STRING |
||||||
|
END |
||||||
|
END |
||||||
|
BLOCK "VarFileInfo" |
||||||
|
BEGIN |
||||||
|
VALUE "Translation", 0x0409, 1200 |
||||||
|
END |
||||||
|
END |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,51 @@ |
|||||||
|
// Microsoft Visual C++ generated resource script. |
||||||
|
// |
||||||
|
|
||||||
|
#include "lz4.h" /* LZ4_VERSION_STRING */ |
||||||
|
#define APSTUDIO_READONLY_SYMBOLS |
||||||
|
#include "verrsrc.h" |
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS |
||||||
|
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
||||||
|
LANGUAGE 9, 1 |
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////// |
||||||
|
// |
||||||
|
// Version |
||||||
|
// |
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO |
||||||
|
FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
||||||
|
#ifdef _DEBUG |
||||||
|
FILEFLAGS VS_FF_DEBUG |
||||||
|
#else |
||||||
|
FILEFLAGS 0x0L |
||||||
|
#endif |
||||||
|
FILEOS VOS_NT_WINDOWS32 |
||||||
|
FILETYPE VFT_DLL |
||||||
|
FILESUBTYPE VFT2_UNKNOWN |
||||||
|
BEGIN |
||||||
|
BLOCK "StringFileInfo" |
||||||
|
BEGIN |
||||||
|
BLOCK "040904B0" |
||||||
|
BEGIN |
||||||
|
VALUE "CompanyName", "Yann Collet" |
||||||
|
VALUE "FileDescription", "Extremely fast compression" |
||||||
|
VALUE "FileVersion", LZ4_VERSION_STRING |
||||||
|
VALUE "InternalName", "lz4.dll" |
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet" |
||||||
|
VALUE "OriginalFilename", "lz4.dll" |
||||||
|
VALUE "ProductName", "LZ4" |
||||||
|
VALUE "ProductVersion", LZ4_VERSION_STRING |
||||||
|
END |
||||||
|
END |
||||||
|
BLOCK "VarFileInfo" |
||||||
|
BEGIN |
||||||
|
VALUE "Translation", 0x0409, 1200 |
||||||
|
END |
||||||
|
END |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,103 @@ |
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||||
|
# Visual Studio 15 |
||||||
|
VisualStudioVersion = 15.0.28307.271 |
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1 |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4-dll", "liblz4-dll\liblz4-dll.vcxproj", "{9800039D-4AAA-43A4-BB78-FEF6F4836927}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "liblz4\liblz4.vcxproj", "{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fuzzer", "fuzzer\fuzzer.vcxproj", "{18B9F1A7-9C66-4352-898B-30804DADE0FD}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench", "fullbench\fullbench.vcxproj", "{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frametest", "frametest\frametest.vcxproj", "{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datagen", "datagen\datagen.vcxproj", "{D745AE2F-596A-403A-9B91-81A8C6779243}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll\fullbench-dll.vcxproj", "{13992FD2-077E-4954-B065-A428198201A9}" |
||||||
|
ProjectSection(ProjectDependencies) = postProject |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927} = {9800039D-4AAA-43A4-BB78-FEF6F4836927} |
||||||
|
EndProjectSection |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lz4", "lz4\lz4.vcxproj", "{60A3115E-B988-41EE-8815-F4D4F253D866}" |
||||||
|
EndProject |
||||||
|
Global |
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||||
|
Debug|Win32 = Debug|Win32 |
||||||
|
Debug|x64 = Debug|x64 |
||||||
|
Release|Win32 = Release|Win32 |
||||||
|
Release|x64 = Release|x64 |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.Build.0 = Release|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.Build.0 = Release|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.Build.0 = Release|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.Build.0 = Release|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.Build.0 = Release|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.Build.0 = Release|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.Build.0 = Release|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.Build.0 = Release|x64 |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(SolutionProperties) = preSolution |
||||||
|
HideSolutionNode = FALSE |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution |
||||||
|
SolutionGuid = {BBC259B2-BABF-47CD-8A6A-7B8318A803AC} |
||||||
|
EndGlobalSection |
||||||
|
EndGlobal |
@ -0,0 +1,51 @@ |
|||||||
|
// Microsoft Visual C++ generated resource script. |
||||||
|
// |
||||||
|
|
||||||
|
#include "lz4.h" /* LZ4_VERSION_STRING */ |
||||||
|
#define APSTUDIO_READONLY_SYMBOLS |
||||||
|
#include "verrsrc.h" |
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS |
||||||
|
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
||||||
|
LANGUAGE 9, 1 |
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////// |
||||||
|
// |
||||||
|
// Version |
||||||
|
// |
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO |
||||||
|
FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
||||||
|
#ifdef _DEBUG |
||||||
|
FILEFLAGS VS_FF_DEBUG |
||||||
|
#else |
||||||
|
FILEFLAGS 0x0L |
||||||
|
#endif |
||||||
|
FILEOS VOS_NT_WINDOWS32 |
||||||
|
FILETYPE VFT_DLL |
||||||
|
FILESUBTYPE VFT2_UNKNOWN |
||||||
|
BEGIN |
||||||
|
BLOCK "StringFileInfo" |
||||||
|
BEGIN |
||||||
|
BLOCK "040904B0" |
||||||
|
BEGIN |
||||||
|
VALUE "CompanyName", "Yann Collet" |
||||||
|
VALUE "FileDescription", "Extremely fast compression" |
||||||
|
VALUE "FileVersion", LZ4_VERSION_STRING |
||||||
|
VALUE "InternalName", "lz4.exe" |
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet" |
||||||
|
VALUE "OriginalFilename", "lz4.exe" |
||||||
|
VALUE "ProductName", "LZ4" |
||||||
|
VALUE "ProductVersion", LZ4_VERSION_STRING |
||||||
|
END |
||||||
|
END |
||||||
|
BLOCK "VarFileInfo" |
||||||
|
BEGIN |
||||||
|
VALUE "Translation", 0x0409, 1200 |
||||||
|
END |
||||||
|
END |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,175 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<VCProjectVersion>15.0</VCProjectVersion> |
||||||
|
<ProjectGuid>{60A3115E-B988-41EE-8815-F4D4F253D866}</ProjectGuid> |
||||||
|
<RootNamespace>lz4</RootNamespace> |
||||||
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<PlatformToolset>v141</PlatformToolset> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<PlatformToolset>v141</PlatformToolset> |
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<PlatformToolset>v141</PlatformToolset> |
||||||
|
<CharacterSet>MultiByte</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<PlatformToolset>v141</PlatformToolset> |
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||||
|
<CharacterSet>MultiByte</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="Shared"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir> |
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir> |
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> |
||||||
|
<LinkIncremental>false</LinkIncremental> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level4</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<OptimizeReferences>false</OptimizeReferences> |
||||||
|
<EnableCOMDATFolding>false</EnableCOMDATFolding> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
</ClCompile> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" /> |
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" /> |
||||||
|
<ClCompile Include="..\..\..\programs\bench.c" /> |
||||||
|
<ClCompile Include="..\..\..\programs\datagen.c" /> |
||||||
|
<ClCompile Include="..\..\..\programs\lz4cli.c" /> |
||||||
|
<ClCompile Include="..\..\..\programs\lz4io.c" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" /> |
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" /> |
||||||
|
<ClInclude Include="..\..\..\programs\bench.h" /> |
||||||
|
<ClInclude Include="..\..\..\programs\datagen.h" /> |
||||||
|
<ClInclude Include="..\..\..\programs\lz4io.h" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ResourceCompile Include="lz4.rc" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
</Project> |
@ -0,0 +1,51 @@ |
|||||||
|
// Microsoft Visual C++ generated resource script. |
||||||
|
// |
||||||
|
|
||||||
|
#include "lz4.h" /* LZ4_VERSION_STRING */ |
||||||
|
#define APSTUDIO_READONLY_SYMBOLS |
||||||
|
#include "verrsrc.h" |
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS |
||||||
|
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
||||||
|
LANGUAGE 9, 1 |
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////// |
||||||
|
// |
||||||
|
// Version |
||||||
|
// |
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO |
||||||
|
FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 |
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
||||||
|
#ifdef _DEBUG |
||||||
|
FILEFLAGS VS_FF_DEBUG |
||||||
|
#else |
||||||
|
FILEFLAGS 0x0L |
||||||
|
#endif |
||||||
|
FILEOS VOS_NT_WINDOWS32 |
||||||
|
FILETYPE VFT_DLL |
||||||
|
FILESUBTYPE VFT2_UNKNOWN |
||||||
|
BEGIN |
||||||
|
BLOCK "StringFileInfo" |
||||||
|
BEGIN |
||||||
|
BLOCK "040904B0" |
||||||
|
BEGIN |
||||||
|
VALUE "CompanyName", "Yann Collet" |
||||||
|
VALUE "FileDescription", "Extremely fast compression" |
||||||
|
VALUE "FileVersion", LZ4_VERSION_STRING |
||||||
|
VALUE "InternalName", "lz4.dll" |
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet" |
||||||
|
VALUE "OriginalFilename", "lz4.dll" |
||||||
|
VALUE "ProductName", "LZ4" |
||||||
|
VALUE "ProductVersion", LZ4_VERSION_STRING |
||||||
|
END |
||||||
|
END |
||||||
|
BLOCK "VarFileInfo" |
||||||
|
BEGIN |
||||||
|
VALUE "Translation", 0x0409, 1200 |
||||||
|
END |
||||||
|
END |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,103 @@ |
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||||
|
# Visual Studio 15 |
||||||
|
VisualStudioVersion = 15.0.28307.271 |
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1 |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4-dll", "liblz4-dll\liblz4-dll.vcxproj", "{9800039D-4AAA-43A4-BB78-FEF6F4836927}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "liblz4\liblz4.vcxproj", "{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fuzzer", "fuzzer\fuzzer.vcxproj", "{18B9F1A7-9C66-4352-898B-30804DADE0FD}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench", "fullbench\fullbench.vcxproj", "{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frametest", "frametest\frametest.vcxproj", "{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datagen", "datagen\datagen.vcxproj", "{D745AE2F-596A-403A-9B91-81A8C6779243}" |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll\fullbench-dll.vcxproj", "{13992FD2-077E-4954-B065-A428198201A9}" |
||||||
|
ProjectSection(ProjectDependencies) = postProject |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927} = {9800039D-4AAA-43A4-BB78-FEF6F4836927} |
||||||
|
EndProjectSection |
||||||
|
EndProject |
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lz4", "lz4\lz4.vcxproj", "{60A3115E-B988-41EE-8815-F4D4F253D866}" |
||||||
|
EndProject |
||||||
|
Global |
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||||
|
Debug|Win32 = Debug|Win32 |
||||||
|
Debug|x64 = Debug|x64 |
||||||
|
Release|Win32 = Release|Win32 |
||||||
|
Release|x64 = Release|x64 |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.Build.0 = Release|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.Build.0 = Release|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.Build.0 = Release|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.Build.0 = Release|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.Build.0 = Release|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.Build.0 = Release|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.Build.0 = Release|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.Build.0 = Debug|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.ActiveCfg = Debug|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.Build.0 = Debug|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.ActiveCfg = Release|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.Build.0 = Release|Win32 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.ActiveCfg = Release|x64 |
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.Build.0 = Release|x64 |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(SolutionProperties) = preSolution |
||||||
|
HideSolutionNode = FALSE |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution |
||||||
|
SolutionGuid = {BBC259B2-BABF-47CD-8A6A-7B8318A803AC} |
||||||
|
EndGlobalSection |
||||||
|
EndGlobal |
@ -0,0 +1,10 @@ |
|||||||
|
# cmake build artefact |
||||||
|
|
||||||
|
CMakeCache.txt |
||||||
|
CMakeFiles |
||||||
|
*.cmake |
||||||
|
Makefile |
||||||
|
liblz4.pc |
||||||
|
lz4c |
||||||
|
install_manifest.txt |
||||||
|
build |
@ -0,0 +1,273 @@ |
|||||||
|
# CMake support for LZ4 |
||||||
|
# |
||||||
|
# To the extent possible under law, the author(s) have dedicated all |
||||||
|
# copyright and related and neighboring rights to this software to |
||||||
|
# the public domain worldwide. This software is distributed without |
||||||
|
# any warranty. |
||||||
|
# |
||||||
|
# For details, see <http://creativecommons.org/publicdomain/zero/1.0/>. |
||||||
|
# |
||||||
|
# LZ4's CMake support is maintained by Evan Nemerson; when filing |
||||||
|
# bugs please mention @nemequ to make sure I see it. |
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.8.12) |
||||||
|
|
||||||
|
set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") |
||||||
|
|
||||||
|
# Parse version information |
||||||
|
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_MAJOR REGEX "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$") |
||||||
|
string(REGEX REPLACE "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$" "\\1" LZ4_VERSION_MAJOR "${LZ4_VERSION_MAJOR}") |
||||||
|
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_MINOR REGEX "^#define LZ4_VERSION_MINOR +([0-9]+) +.*$") |
||||||
|
string(REGEX REPLACE "^#define LZ4_VERSION_MINOR +([0-9]+) +.*$" "\\1" LZ4_VERSION_MINOR "${LZ4_VERSION_MINOR}") |
||||||
|
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_RELEASE REGEX "^#define LZ4_VERSION_RELEASE +([0-9]+) +.*$") |
||||||
|
string(REGEX REPLACE "^#define LZ4_VERSION_RELEASE +([0-9]+) +.*$" "\\1" LZ4_VERSION_RELEASE "${LZ4_VERSION_RELEASE}") |
||||||
|
set(LZ4_VERSION_STRING "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}") |
||||||
|
mark_as_advanced(LZ4_VERSION_STRING LZ4_VERSION_MAJOR LZ4_VERSION_MINOR LZ4_VERSION_RELEASE) |
||||||
|
|
||||||
|
if("${CMAKE_VERSION}" VERSION_LESS "3.0") |
||||||
|
project(LZ4 C) |
||||||
|
else() |
||||||
|
cmake_policy (SET CMP0048 NEW) |
||||||
|
project(LZ4 |
||||||
|
VERSION ${LZ4_VERSION_STRING} |
||||||
|
LANGUAGES C) |
||||||
|
endif() |
||||||
|
|
||||||
|
option(LZ4_BUILD_CLI "Build lz4 program" ON) |
||||||
|
option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c program with legacy argument support" ON) |
||||||
|
|
||||||
|
# If LZ4 is being bundled in another project, we don't want to |
||||||
|
# install anything. However, we want to let people override this, so |
||||||
|
# we'll use the LZ4_BUNDLED_MODE variable to let them do that; just |
||||||
|
# set it to OFF in your project before you add_subdirectory(lz4/contrib/cmake_unofficial). |
||||||
|
get_directory_property(LZ4_PARENT_DIRECTORY PARENT_DIRECTORY) |
||||||
|
if("${LZ4_BUNDLED_MODE}" STREQUAL "") |
||||||
|
# Bundled mode hasn't been set one way or the other, set the default |
||||||
|
# depending on whether or not we are the top-level project. |
||||||
|
if("${LZ4_PARENT_DIRECTORY}" STREQUAL "") |
||||||
|
set(LZ4_BUNDLED_MODE OFF) |
||||||
|
else() |
||||||
|
set(LZ4_BUNDLED_MODE ON) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
mark_as_advanced(LZ4_BUNDLED_MODE) |
||||||
|
|
||||||
|
# CPack |
||||||
|
if(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED) |
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library") |
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${LZ4_TOP_SOURCE_DIR}/README.md") |
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${LZ4_TOP_SOURCE_DIR}/LICENSE") |
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${LZ4_VERSION_MAJOR}) |
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${LZ4_VERSION_MINOR}) |
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${LZ4_VERSION_RELEASE}) |
||||||
|
include(CPack) |
||||||
|
endif(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED) |
||||||
|
|
||||||
|
# Allow people to choose whether to build shared or static libraries |
||||||
|
# via the BUILD_SHARED_LIBS option unless we are in bundled mode, in |
||||||
|
# which case we always use static libraries. |
||||||
|
include(CMakeDependentOption) |
||||||
|
CMAKE_DEPENDENT_OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON "NOT LZ4_BUNDLED_MODE" OFF) |
||||||
|
CMAKE_DEPENDENT_OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF "BUILD_SHARED_LIBS" ON) |
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) |
||||||
|
message(FATAL_ERROR "Both BUILD_SHARED_LIBS and BUILD_STATIC_LIBS have been disabled") |
||||||
|
endif() |
||||||
|
|
||||||
|
set(LZ4_LIB_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/lib") |
||||||
|
set(LZ4_PROG_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/programs") |
||||||
|
|
||||||
|
include_directories("${LZ4_LIB_SOURCE_DIR}") |
||||||
|
|
||||||
|
# CLI sources |
||||||
|
set(LZ4_SOURCES |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4.c" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4hc.c" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4.h" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4hc.h" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4frame.c" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4frame.h" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/xxhash.c") |
||||||
|
set(LZ4_CLI_SOURCES |
||||||
|
"${LZ4_PROG_SOURCE_DIR}/bench.c" |
||||||
|
"${LZ4_PROG_SOURCE_DIR}/lz4cli.c" |
||||||
|
"${LZ4_PROG_SOURCE_DIR}/lz4io.c" |
||||||
|
"${LZ4_PROG_SOURCE_DIR}/datagen.c") |
||||||
|
|
||||||
|
# Whether to use position independent code for the static library. If |
||||||
|
# we're building a shared library this is ignored and PIC is always |
||||||
|
# used. |
||||||
|
option(LZ4_POSITION_INDEPENDENT_LIB "Use position independent code for static library (if applicable)" ON) |
||||||
|
|
||||||
|
# liblz4 |
||||||
|
set(LZ4_LIBRARIES_BUILT) |
||||||
|
if(BUILD_SHARED_LIBS) |
||||||
|
add_library(lz4_shared SHARED ${LZ4_SOURCES}) |
||||||
|
target_include_directories(lz4_shared |
||||||
|
PUBLIC $<BUILD_INTERFACE:${LZ4_LIB_SOURCE_DIR}> |
||||||
|
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
||||||
|
set_target_properties(lz4_shared PROPERTIES |
||||||
|
OUTPUT_NAME lz4 |
||||||
|
SOVERSION "${LZ4_VERSION_MAJOR}" |
||||||
|
VERSION "${LZ4_VERSION_STRING}") |
||||||
|
if(MSVC) |
||||||
|
target_compile_definitions(lz4_shared PRIVATE |
||||||
|
LZ4_DLL_EXPORT=1) |
||||||
|
endif() |
||||||
|
list(APPEND LZ4_LIBRARIES_BUILT lz4_shared) |
||||||
|
endif() |
||||||
|
if(BUILD_STATIC_LIBS) |
||||||
|
set(STATIC_LIB_NAME lz4) |
||||||
|
if (MSVC AND BUILD_SHARED_LIBS) |
||||||
|
set(STATIC_LIB_NAME lz4_static) |
||||||
|
endif() |
||||||
|
add_library(lz4_static STATIC ${LZ4_SOURCES}) |
||||||
|
target_include_directories(lz4_static |
||||||
|
PUBLIC $<BUILD_INTERFACE:${LZ4_LIB_SOURCE_DIR}> |
||||||
|
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
||||||
|
set_target_properties(lz4_static PROPERTIES |
||||||
|
OUTPUT_NAME ${STATIC_LIB_NAME} |
||||||
|
POSITION_INDEPENDENT_CODE ${LZ4_POSITION_INDEPENDENT_LIB}) |
||||||
|
list(APPEND LZ4_LIBRARIES_BUILT lz4_static) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(BUILD_STATIC_LIBS) |
||||||
|
set(LZ4_LINK_LIBRARY lz4_static) |
||||||
|
else() |
||||||
|
list(APPEND LZ4_CLI_SOURCES ${LZ4_SOURCES}) |
||||||
|
endif() |
||||||
|
|
||||||
|
# lz4 |
||||||
|
if (LZ4_BUILD_CLI) |
||||||
|
set(LZ4_PROGRAMS_BUILT lz4cli) |
||||||
|
add_executable(lz4cli ${LZ4_CLI_SOURCES}) |
||||||
|
set_target_properties(lz4cli PROPERTIES OUTPUT_NAME lz4) |
||||||
|
if (BUILD_STATIC_LIBS) |
||||||
|
target_link_libraries(lz4cli ${LZ4_LINK_LIBRARY}) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
# lz4c |
||||||
|
if (LZ4_BUILD_LEGACY_LZ4C) |
||||||
|
list(APPEND LZ4_PROGRAMS_BUILT lz4c) |
||||||
|
add_executable(lz4c ${LZ4_CLI_SOURCES}) |
||||||
|
set_target_properties(lz4c PROPERTIES COMPILE_DEFINITIONS "ENABLE_LZ4C_LEGACY_OPTIONS") |
||||||
|
if (BUILD_STATIC_LIBS) |
||||||
|
target_link_libraries(lz4c ${LZ4_LINK_LIBRARY}) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
# Extra warning flags |
||||||
|
include (CheckCCompilerFlag) |
||||||
|
foreach (flag |
||||||
|
# GCC-style |
||||||
|
-Wall |
||||||
|
-Wextra |
||||||
|
-Wundef |
||||||
|
-Wcast-qual |
||||||
|
-Wcast-align |
||||||
|
-Wshadow |
||||||
|
-Wswitch-enum |
||||||
|
-Wdeclaration-after-statement |
||||||
|
-Wstrict-prototypes |
||||||
|
-Wpointer-arith |
||||||
|
|
||||||
|
# MSVC-style |
||||||
|
/W4) |
||||||
|
# Because https://gcc.gnu.org/wiki/FAQ#wnowarning |
||||||
|
string(REGEX REPLACE "\\-Wno\\-(.+)" "-W\\1" flag_to_test "${flag}") |
||||||
|
string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" test_name "CFLAG_${flag_to_test}") |
||||||
|
|
||||||
|
check_c_compiler_flag("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${test_name}) |
||||||
|
|
||||||
|
if(${test_name}) |
||||||
|
set(CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}") |
||||||
|
endif() |
||||||
|
|
||||||
|
unset(test_name) |
||||||
|
unset(flag_to_test) |
||||||
|
endforeach (flag) |
||||||
|
|
||||||
|
if(NOT LZ4_BUNDLED_MODE) |
||||||
|
include(GNUInstallDirs) |
||||||
|
|
||||||
|
install(TARGETS ${LZ4_PROGRAMS_BUILT} |
||||||
|
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" |
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") |
||||||
|
install(TARGETS ${LZ4_LIBRARIES_BUILT} |
||||||
|
EXPORT lz4Targets |
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") |
||||||
|
install(FILES |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4.h" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4frame.h" |
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4hc.h" |
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") |
||||||
|
install(FILES "${LZ4_PROG_SOURCE_DIR}/lz4.1" |
||||||
|
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") |
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblz4.pc" |
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") |
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers) |
||||||
|
write_basic_package_version_file( |
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/lz4ConfigVersion.cmake" |
||||||
|
VERSION ${LZ4_VERSION_STRING} |
||||||
|
COMPATIBILITY SameMajorVersion) |
||||||
|
|
||||||
|
set(LZ4_PKG_INSTALLDIR "${CMAKE_INSTALL_LIBDIR}/cmake/lz4") |
||||||
|
configure_package_config_file( |
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/lz4Config.cmake.in" |
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/lz4Config.cmake" |
||||||
|
INSTALL_DESTINATION ${LZ4_PKG_INSTALLDIR}) |
||||||
|
export(EXPORT lz4Targets |
||||||
|
FILE ${CMAKE_CURRENT_BINARY_DIR}/lz4Targets.cmake |
||||||
|
NAMESPACE LZ4::) |
||||||
|
|
||||||
|
install(EXPORT lz4Targets |
||||||
|
FILE lz4Targets.cmake |
||||||
|
NAMESPACE LZ4:: |
||||||
|
DESTINATION ${LZ4_PKG_INSTALLDIR}) |
||||||
|
install(FILES |
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/lz4Config.cmake |
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/lz4ConfigVersion.cmake |
||||||
|
DESTINATION ${LZ4_PKG_INSTALLDIR}) |
||||||
|
|
||||||
|
# install lz4cat and unlz4 symlinks on *nix |
||||||
|
if(UNIX AND LZ4_BUILD_CLI) |
||||||
|
install(CODE " |
||||||
|
foreach(f lz4cat unlz4) |
||||||
|
set(dest \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/\${f}\") |
||||||
|
message(STATUS \"Symlinking: \${dest} -> lz4\") |
||||||
|
execute_process( |
||||||
|
COMMAND \"${CMAKE_COMMAND}\" -E create_symlink lz4 \"\${dest}\") |
||||||
|
endforeach() |
||||||
|
") |
||||||
|
|
||||||
|
# create manpage aliases |
||||||
|
foreach(f lz4cat unlz4) |
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" ".so man1/lz4.1\n") |
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" |
||||||
|
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") |
||||||
|
endforeach() |
||||||
|
endif(UNIX AND LZ4_BUILD_CLI) |
||||||
|
endif(NOT LZ4_BUNDLED_MODE) |
||||||
|
|
||||||
|
# pkg-config |
||||||
|
set(PREFIX "${CMAKE_INSTALL_PREFIX}") |
||||||
|
|
||||||
|
if("${CMAKE_INSTALL_FULL_LIBDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
||||||
|
set(LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") |
||||||
|
else() |
||||||
|
set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") |
||||||
|
endif() |
||||||
|
|
||||||
|
if("${CMAKE_INSTALL_FULL_INCLUDEDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") |
||||||
|
set(INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") |
||||||
|
else() |
||||||
|
set(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}") |
||||||
|
endif() |
||||||
|
|
||||||
|
# for liblz4.pc substitution |
||||||
|
set(VERSION ${LZ4_VERSION_STRING}) |
||||||
|
configure_file(${LZ4_LIB_SOURCE_DIR}/liblz4.pc.in liblz4.pc @ONLY) |
@ -0,0 +1,2 @@ |
|||||||
|
@PACKAGE_INIT@ |
||||||
|
include( "${CMAKE_CURRENT_LIST_DIR}/lz4Targets.cmake" ) |
@ -0,0 +1,10 @@ |
|||||||
|
liblz4 (1.7.2) unstable; urgency=low |
||||||
|
|
||||||
|
* Changed : moved to versioning; package, cli and library have same version number |
||||||
|
* Improved: Small decompression speed boost (+4%) |
||||||
|
* Improved: Performance on ARMv6 and ARMv7 |
||||||
|
* Added : Debianization, by Evgeniy Polyakov |
||||||
|
* Makefile: Generates object files (*.o) for faster (re)compilation on low power systems |
||||||
|
* Fix : cli : crash on some invalid inputs |
||||||
|
|
||||||
|
-- Yann Collet <Cyan4973@github.com> Sun, 28 Jun 2015 01:00:00 +0000 |
@ -0,0 +1 @@ |
|||||||
|
7 |
@ -0,0 +1,23 @@ |
|||||||
|
Source: liblz4 |
||||||
|
Section: devel |
||||||
|
Priority: optional |
||||||
|
Maintainer: Evgeniy Polyakov <zbr@ioremap.net> |
||||||
|
Build-Depends: |
||||||
|
cmake (>= 2.6), |
||||||
|
debhelper (>= 7.0.50~), |
||||||
|
cdbs |
||||||
|
Standards-Version: 3.8.0 |
||||||
|
Homepage: http://www.lz4.org/ |
||||||
|
Vcs-Git: git://github.com/lz4/lz4.git |
||||||
|
Vcs-Browser: https://github.com/lz4/lz4 |
||||||
|
|
||||||
|
Package: liblz4 |
||||||
|
Architecture: any |
||||||
|
Depends: ${shlibs:Depends}, ${misc:Depends} |
||||||
|
Description: Extremely Fast Compression algorithm http://www.lz4.org |
||||||
|
|
||||||
|
Package: liblz4-dev |
||||||
|
Architecture: any |
||||||
|
Depends: ${shlibs:Depends}, ${misc:Depends} |
||||||
|
Description: Extremely Fast Compression algorithm http://www.lz4.org |
||||||
|
Development files. |
@ -0,0 +1,9 @@ |
|||||||
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ |
||||||
|
Upstream-Name: liblz4 |
||||||
|
Upstream-Contact: Yann Collet <Cyan4973@github.com> |
||||||
|
Source: https://github.com/lz4/lz4 |
||||||
|
|
||||||
|
Files: * |
||||||
|
Copyright: (C) 2011-2020 Yann Collet |
||||||
|
License: GPL-2+ |
||||||
|
The full text of license: https://github.com/lz4/lz4/blob/dev/lib/LICENSE |
@ -0,0 +1 @@ |
|||||||
|
usr/bin |
@ -0,0 +1,2 @@ |
|||||||
|
usr/include/lz4* |
||||||
|
usr/lib/liblz4.so |
@ -0,0 +1,2 @@ |
|||||||
|
usr/lib/liblz4.so.* |
||||||
|
usr/bin/* |
@ -0,0 +1,7 @@ |
|||||||
|
#!/usr/bin/make -f |
||||||
|
|
||||||
|
include /usr/share/cdbs/1/rules/debhelper.mk |
||||||
|
include /usr/share/cdbs/1/class/cmake.mk |
||||||
|
|
||||||
|
|
||||||
|
DEB_CMAKE_EXTRA_FLAGS := -DCMAKE_BUILD_TYPE=RelWithDebInfo ../../build/cmake |
@ -0,0 +1,24 @@ |
|||||||
|
Copyright (c) 2014, lpsantil |
||||||
|
All rights reserved. |
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without |
||||||
|
modification, are permitted provided that the following conditions are met: |
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this |
||||||
|
list of conditions and the following disclaimer. |
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, |
||||||
|
this list of conditions and the following disclaimer in the documentation |
||||||
|
and/or other materials provided with the distribution. |
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
@ -0,0 +1,130 @@ |
|||||||
|
# Copyright (c) 2015, Louis P. Santillan <lpsantil@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
# See LICENSE for licensing details.
|
||||||
|
DESTDIR ?= /opt/local
|
||||||
|
|
||||||
|
# Pulled the code below from lib/Makefile. Might be nicer to derive this somehow without sed
|
||||||
|
# Version numbers
|
||||||
|
VERSION ?= 129
|
||||||
|
RELEASE ?= r$(VERSION)
|
||||||
|
LIBVER_MAJOR=$(shell sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h)
|
||||||
|
LIBVER_MINOR=$(shell sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h)
|
||||||
|
LIBVER_PATCH=$(shell sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h)
|
||||||
|
LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
CROSS ?= i586-pc-msdosdjgpp
|
||||||
|
CC = $(CROSS)-gcc
|
||||||
|
AR = $(CROSS)-ar
|
||||||
|
LD = $(CROSS)-gcc
|
||||||
|
|
||||||
|
CFLAGS ?= -O3 -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic -DLZ4_VERSION=\"$(RELEASE)\"
|
||||||
|
LDFLAGS ?= -s
|
||||||
|
SRC = programs/bench.c programs/lz4io.c programs/lz4cli.c
|
||||||
|
OBJ = $(SRC:.c=.o)
|
||||||
|
SDEPS = $(SRC:.c=.d)
|
||||||
|
IDIR = lib
|
||||||
|
EDIR = .
|
||||||
|
EXE = lz4.exe
|
||||||
|
LNK = lz4
|
||||||
|
LDIR = lib
|
||||||
|
LSRC = lib/lz4.c lib/lz4hc.c lib/lz4frame.c lib/xxhash.c
|
||||||
|
INC = $(LSRC:.c=.h)
|
||||||
|
LOBJ = $(LSRC:.c=.o)
|
||||||
|
LSDEPS = $(LSRC:.c=.d)
|
||||||
|
LIB = $(LDIR)/lib$(LNK).a
|
||||||
|
|
||||||
|
# Since LDFLAGS defaults to "-s", probably better to override unless
|
||||||
|
# you have a default you would like to maintain
|
||||||
|
ifeq ($(WITH_DEBUG), 1) |
||||||
|
CFLAGS += -g
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif |
||||||
|
|
||||||
|
# Since LDFLAGS defaults to "-s", probably better to override unless
|
||||||
|
# you have a default you would like to maintain
|
||||||
|
ifeq ($(WITH_PROFILING), 1) |
||||||
|
CFLAGS += -pg
|
||||||
|
LDFLAGS += -pg
|
||||||
|
endif |
||||||
|
|
||||||
|
%.o: %.c $(INC) Makefile |
||||||
|
$(CC) $(CFLAGS) -MMD -MP -I$(IDIR) -c $< -o $@
|
||||||
|
|
||||||
|
%.exe: %.o $(LIB) Makefile |
||||||
|
$(LD) $< -L$(LDIR) -l$(LNK) $(LDFLAGS) $(LIBDEP) -o $@
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
######################## DO NOT MODIFY BELOW #########################
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
.PHONY: all install uninstall showconfig gstat gpush |
||||||
|
|
||||||
|
all: $(LIB) $(EXE) |
||||||
|
|
||||||
|
$(LIB): $(LOBJ) |
||||||
|
$(AR) -rcs $@ $^
|
||||||
|
|
||||||
|
$(EXE): $(LOBJ) $(OBJ) |
||||||
|
$(LD) $(LDFLAGS) $(LOBJ) $(OBJ) -o $(EDIR)/$@
|
||||||
|
|
||||||
|
clean: |
||||||
|
rm -f $(OBJ) $(EXE) $(LOBJ) $(LIB) *.tmp $(SDEPS) $(LSDEPS) $(TSDEPS)
|
||||||
|
|
||||||
|
install: $(INC) $(LIB) $(EXE) |
||||||
|
mkdir -p $(DESTDIR)/bin $(DESTDIR)/include $(DESTDIR)/lib
|
||||||
|
rm -f .footprint
|
||||||
|
echo $(DESTDIR)/bin/$(EXE) >> .footprint
|
||||||
|
cp -v $(EXE) $(DESTDIR)/bin/
|
||||||
|
@for T in $(LIB); \
|
||||||
|
do ( \
|
||||||
|
echo $(DESTDIR)/$$T >> .footprint; \
|
||||||
|
cp -v --parents $$T $(DESTDIR) \
|
||||||
|
); done
|
||||||
|
@for T in $(INC); \
|
||||||
|
do ( \
|
||||||
|
echo $(DESTDIR)/include/`basename -a $$T` >> .footprint; \
|
||||||
|
cp -v $$T $(DESTDIR)/include/ \
|
||||||
|
); done
|
||||||
|
|
||||||
|
uninstall: .footprint |
||||||
|
@for T in $(shell cat .footprint); do rm -v $$T; done
|
||||||
|
|
||||||
|
-include $(SDEPS) $(LSDEPS) |
||||||
|
|
||||||
|
showconfig: |
||||||
|
@echo "PWD="$(PWD)
|
||||||
|
@echo "VERSION="$(VERSION)
|
||||||
|
@echo "RELEASE="$(RELEASE)
|
||||||
|
@echo "LIBVER_MAJOR="$(LIBVER_MAJOR)
|
||||||
|
@echo "LIBVER_MINOR="$(LIBVER_MINOR)
|
||||||
|
@echo "LIBVER_PATCH="$(LIBVER_PATCH)
|
||||||
|
@echo "LIBVER="$(LIBVER)
|
||||||
|
@echo "CROSS="$(CROSS)
|
||||||
|
@echo "CC="$(CC)
|
||||||
|
@echo "AR="$(AR)
|
||||||
|
@echo "LD="$(LD)
|
||||||
|
@echo "DESTDIR="$(DESTDIR)
|
||||||
|
@echo "CFLAGS="$(CFLAGS)
|
||||||
|
@echo "LDFLAGS="$(LDFLAGS)
|
||||||
|
@echo "SRC="$(SRC)
|
||||||
|
@echo "OBJ="$(OBJ)
|
||||||
|
@echo "IDIR="$(IDIR)
|
||||||
|
@echo "INC="$(INC)
|
||||||
|
@echo "EDIR="$(EDIR)
|
||||||
|
@echo "EXE="$(EXE)
|
||||||
|
@echo "LDIR="$(LDIR)
|
||||||
|
@echo "LSRC="$(LSRC)
|
||||||
|
@echo "LOBJ="$(LOBJ)
|
||||||
|
@echo "LNK="$(LNK)
|
||||||
|
@echo "LIB="$(LIB)
|
||||||
|
@echo "SDEPS="$(SDEPS)
|
||||||
|
@echo "LSDEPS="$(LSDEPS)
|
||||||
|
|
||||||
|
gstat: |
||||||
|
git status
|
||||||
|
|
||||||
|
gpush: |
||||||
|
git commit
|
||||||
|
git push
|
@ -0,0 +1,21 @@ |
|||||||
|
# lz4 for DOS/djgpp |
||||||
|
This file details on how to compile lz4.exe, and liblz4.a for use on DOS/djgpp using |
||||||
|
Andrew Wu's build-djgpp cross compilers ([GH][0], [Binaries][1]) on OSX, Linux. |
||||||
|
|
||||||
|
## Setup |
||||||
|
* Download a djgpp tarball [binaries][1] for your platform. |
||||||
|
* Extract and install it (`tar jxvf djgpp-linux64-gcc492.tar.bz2`). Note the path. We'll assume `/home/user/djgpp`. |
||||||
|
* Add the `bin` folder to your `PATH`. In bash, do `export PATH=/home/user/djgpp/bin:$PATH`. |
||||||
|
* The `Makefile` in `contrib/djgpp/` sets up `CC`, `AR`, `LD` for you. So, `CC=i586-pc-msdosdjgpp-gcc`, `AR=i586-pc-msdosdjgpp-ar`, `LD=i586-pc-msdosdjgpp-gcc`. |
||||||
|
|
||||||
|
## Building LZ4 for DOS |
||||||
|
In the base dir of lz4 and with `contrib/djgpp/Makefile`, try: |
||||||
|
Try: |
||||||
|
* `make -f contrib/djgpp/Makefile` |
||||||
|
* `make -f contrib/djgpp/Makefile liblz4.a` |
||||||
|
* `make -f contrib/djgpp/Makefile lz4.exe` |
||||||
|
* `make -f contrib/djgpp/Makefile DESTDIR=/home/user/dos install`, however it doesn't make much sense on a \*nix. |
||||||
|
* You can also do `make -f contrib/djgpp/Makefile uninstall` |
||||||
|
|
||||||
|
[0]: https://github.com/andrewwutw/build-djgpp |
||||||
|
[1]: https://github.com/andrewwutw/build-djgpp/releases |
@ -0,0 +1,2 @@ |
|||||||
|
# build artefact |
||||||
|
gen_manual |
@ -0,0 +1,76 @@ |
|||||||
|
# ################################################################
|
||||||
|
# Copyright (C) Przemyslaw Skibinski 2016-present
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# BSD license
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
# other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# You can contact the author at :
|
||||||
|
# - LZ4 source repository : https://github.com/Cyan4973/lz4
|
||||||
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
# ################################################################
|
||||||
|
|
||||||
|
|
||||||
|
CXXFLAGS ?= -O2
|
||||||
|
CXXFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wno-comment
|
||||||
|
CPPFLAGS += $(MOREFLAGS)
|
||||||
|
FLAGS = $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
|
LZ4API = ../../lib/lz4.h
|
||||||
|
LZ4MANUAL = ../../doc/lz4_manual.html
|
||||||
|
LZ4FAPI = ../../lib/lz4frame.h
|
||||||
|
LZ4FMANUAL = ../../doc/lz4frame_manual.html
|
||||||
|
LIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
|
||||||
|
LIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
|
||||||
|
LIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
|
||||||
|
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
|
||||||
|
LZ4VER := $(shell echo $(LIBVER_SCRIPT))
|
||||||
|
|
||||||
|
# Define *.exe as extension for Windows systems
|
||||||
|
ifneq (,$(filter Windows%,$(OS))) |
||||||
|
EXT =.exe
|
||||||
|
else |
||||||
|
EXT =
|
||||||
|
endif |
||||||
|
|
||||||
|
|
||||||
|
.PHONY: default |
||||||
|
default: gen_manual |
||||||
|
|
||||||
|
gen_manual: gen_manual.cpp |
||||||
|
$(CXX) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
$(LZ4MANUAL) : gen_manual $(LZ4API) |
||||||
|
echo "Update lz4 manual in /doc"
|
||||||
|
./gen_manual $(LZ4VER) $(LZ4API) $@
|
||||||
|
|
||||||
|
$(LZ4FMANUAL) : gen_manual $(LZ4FAPI) |
||||||
|
echo "Update lz4frame manual in /doc"
|
||||||
|
./gen_manual $(LZ4VER) $(LZ4FAPI) $@
|
||||||
|
|
||||||
|
.PHONY: manuals |
||||||
|
manuals: $(LZ4MANUAL) $(LZ4FMANUAL) |
||||||
|
|
||||||
|
.PHONY: clean |
||||||
|
clean: |
||||||
|
@$(RM) gen_manual$(EXT)
|
||||||
|
@echo Cleaning completed
|
@ -0,0 +1,31 @@ |
|||||||
|
gen_manual - a program for automatic generation of manual from source code |
||||||
|
========================================================================== |
||||||
|
|
||||||
|
#### Introduction |
||||||
|
|
||||||
|
This simple C++ program generates a single-page HTML manual from `lz4.h`. |
||||||
|
|
||||||
|
The format of recognized comment blocks is following: |
||||||
|
- comments of type `/*!` mean: this is a function declaration; switch comments with declarations |
||||||
|
- comments of type `/**` and `/*-` mean: this is a comment; use a `<H2>` header for the first line |
||||||
|
- comments of type `/*=` and `/**=` mean: use a `<H3>` header and show also all functions until first empty line |
||||||
|
- comments of type `/*X` where `X` is different from above-mentioned are ignored |
||||||
|
|
||||||
|
Moreover: |
||||||
|
- `LZ4LIB_API` is removed to improve readability |
||||||
|
- `typedef` are detected and included even if uncommented |
||||||
|
- comments of type `/**<` and `/*!<` are detected and only function declaration is highlighted (bold) |
||||||
|
|
||||||
|
|
||||||
|
#### Usage |
||||||
|
|
||||||
|
The program requires 3 parameters: |
||||||
|
``` |
||||||
|
gen_manual [lz4_version] [input_file] [output_html] |
||||||
|
``` |
||||||
|
|
||||||
|
To compile program and generate lz4 manual we have used: |
||||||
|
``` |
||||||
|
make |
||||||
|
./gen_manual.exe 1.7.3 ../../lib/lz4.h lz4_manual.html |
||||||
|
``` |
@ -0,0 +1,10 @@ |
|||||||
|
#!/bin/sh |
||||||
|
|
||||||
|
LIBVER_MAJOR_SCRIPT=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ../../lib/lz4.h` |
||||||
|
LIBVER_MINOR_SCRIPT=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ../../lib/lz4.h` |
||||||
|
LIBVER_PATCH_SCRIPT=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ../../lib/lz4.h` |
||||||
|
LIBVER_SCRIPT=$LIBVER_MAJOR_SCRIPT.$LIBVER_MINOR_SCRIPT.$LIBVER_PATCH_SCRIPT |
||||||
|
|
||||||
|
echo LZ4_VERSION=$LIBVER_SCRIPT |
||||||
|
./gen_manual "lz4 $LIBVER_SCRIPT" ../../lib/lz4.h ./lz4_manual.html |
||||||
|
./gen_manual "lz4frame $LIBVER_SCRIPT" ../../lib/lz4frame.h ./lz4frame_manual.html |
@ -0,0 +1,248 @@ |
|||||||
|
/*
|
||||||
|
Copyright (c) 2016-present, Przemyslaw Skibinski |
||||||
|
All rights reserved. |
||||||
|
|
||||||
|
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without |
||||||
|
modification, are permitted provided that the following conditions are |
||||||
|
met: |
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright |
||||||
|
notice, this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above |
||||||
|
copyright notice, this list of conditions and the following disclaimer |
||||||
|
in the documentation and/or other materials provided with the |
||||||
|
distribution. |
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
You can contact the author at : |
||||||
|
- LZ4 homepage : http://www.lz4.org
|
||||||
|
- LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
*/ |
||||||
|
|
||||||
|
#include <iostream> |
||||||
|
#include <fstream> |
||||||
|
#include <sstream> |
||||||
|
#include <vector> |
||||||
|
using namespace std; |
||||||
|
|
||||||
|
|
||||||
|
/* trim string at the beginning and at the end */ |
||||||
|
void trim(string& s, string characters) |
||||||
|
{ |
||||||
|
size_t p = s.find_first_not_of(characters); |
||||||
|
s.erase(0, p); |
||||||
|
|
||||||
|
p = s.find_last_not_of(characters); |
||||||
|
if (string::npos != p) |
||||||
|
s.erase(p+1); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/* trim C++ style comments */ |
||||||
|
void trim_comments(string &s) |
||||||
|
{ |
||||||
|
size_t spos, epos; |
||||||
|
|
||||||
|
spos = s.find("/*"); |
||||||
|
epos = s.find("*/"); |
||||||
|
s = s.substr(spos+3, epos-(spos+3)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/* get lines until a given terminator */ |
||||||
|
vector<string> get_lines(vector<string>& input, int& linenum, string terminator) |
||||||
|
{ |
||||||
|
vector<string> out; |
||||||
|
string line; |
||||||
|
|
||||||
|
while ((size_t)linenum < input.size()) { |
||||||
|
line = input[linenum]; |
||||||
|
|
||||||
|
if (terminator.empty() && line.empty()) { linenum--; break; } |
||||||
|
|
||||||
|
size_t const epos = line.find(terminator); |
||||||
|
if (!terminator.empty() && epos!=string::npos) { |
||||||
|
out.push_back(line); |
||||||
|
break; |
||||||
|
} |
||||||
|
out.push_back(line); |
||||||
|
linenum++; |
||||||
|
} |
||||||
|
return out; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/* print line with LZ4LIB_API removed and C++ comments not bold */ |
||||||
|
void print_line(stringstream &sout, string line) |
||||||
|
{ |
||||||
|
size_t spos, epos; |
||||||
|
|
||||||
|
if (line.substr(0,11) == "LZ4LIB_API ") line = line.substr(11); |
||||||
|
if (line.substr(0,12) == "LZ4FLIB_API ") line = line.substr(12); |
||||||
|
spos = line.find("/*"); |
||||||
|
epos = line.find("*/"); |
||||||
|
if (spos!=string::npos && epos!=string::npos) { |
||||||
|
sout << line.substr(0, spos); |
||||||
|
sout << "</b>" << line.substr(spos) << "<b>" << '\n'; |
||||||
|
} else { |
||||||
|
sout << line << '\n'; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) { |
||||||
|
char exclam; |
||||||
|
int linenum, chapter = 1; |
||||||
|
vector<string> input, lines, comments, chapters; |
||||||
|
string line, version; |
||||||
|
size_t spos, l; |
||||||
|
stringstream sout; |
||||||
|
ifstream istream; |
||||||
|
ofstream ostream; |
||||||
|
|
||||||
|
if (argc < 4) { |
||||||
|
cout << "usage: " << argv[0] << " [lz4_version] [input_file] [output_html]" << endl; |
||||||
|
return 1; |
||||||
|
} |
||||||
|
|
||||||
|
version = string(argv[1]) + " Manual"; |
||||||
|
|
||||||
|
istream.open(argv[2], ifstream::in); |
||||||
|
if (!istream.is_open()) { |
||||||
|
cout << "Error opening file " << argv[2] << endl; |
||||||
|
return 1; |
||||||
|
} |
||||||
|
|
||||||
|
ostream.open(argv[3], ifstream::out); |
||||||
|
if (!ostream.is_open()) { |
||||||
|
cout << "Error opening file " << argv[3] << endl; |
||||||
|
return 1; |
||||||
|
} |
||||||
|
|
||||||
|
while (getline(istream, line)) { |
||||||
|
input.push_back(line); |
||||||
|
} |
||||||
|
|
||||||
|
for (linenum=0; (size_t)linenum < input.size(); linenum++) { |
||||||
|
line = input[linenum]; |
||||||
|
|
||||||
|
/* typedefs are detected and included even if uncommented */ |
||||||
|
if (line.substr(0,7) == "typedef" && line.find("{")!=string::npos) { |
||||||
|
lines = get_lines(input, linenum, "}"); |
||||||
|
sout << "<pre><b>"; |
||||||
|
for (l=0; l<lines.size(); l++) { |
||||||
|
print_line(sout, lines[l]); |
||||||
|
} |
||||||
|
sout << "</b></pre><BR>" << endl; |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
/* comments of type / * * < and / * ! < are detected, and only function declaration is highlighted (bold) */ |
||||||
|
if ((line.find("/**<")!=string::npos || line.find("/*!<")!=string::npos) |
||||||
|
&& line.find("*/")!=string::npos) { |
||||||
|
sout << "<pre><b>"; |
||||||
|
print_line(sout, line); |
||||||
|
sout << "</b></pre><BR>" << endl; |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
spos = line.find("/**="); |
||||||
|
if (spos==string::npos) { |
||||||
|
spos = line.find("/*!"); |
||||||
|
if (spos==string::npos) |
||||||
|
spos = line.find("/**"); |
||||||
|
if (spos==string::npos) |
||||||
|
spos = line.find("/*-"); |
||||||
|
if (spos==string::npos) |
||||||
|
spos = line.find("/*="); |
||||||
|
if (spos==string::npos) |
||||||
|
continue; |
||||||
|
exclam = line[spos+2]; |
||||||
|
} |
||||||
|
else exclam = '='; |
||||||
|
|
||||||
|
comments = get_lines(input, linenum, "*/"); |
||||||
|
if (!comments.empty()) comments[0] = line.substr(spos+3); |
||||||
|
if (!comments.empty()) |
||||||
|
comments[comments.size()-1] = comments[comments.size()-1].substr(0, comments[comments.size()-1].find("*/")); |
||||||
|
for (l=0; l<comments.size(); l++) { |
||||||
|
if (comments[l].compare(0, 2, " *") == 0) |
||||||
|
comments[l] = comments[l].substr(2); |
||||||
|
else if (comments[l].compare(0, 3, " *") == 0) |
||||||
|
comments[l] = comments[l].substr(3); |
||||||
|
trim(comments[l], "*-="); |
||||||
|
} |
||||||
|
while (!comments.empty() && comments[comments.size()-1].empty()) comments.pop_back(); // remove empty line at the end
|
||||||
|
while (!comments.empty() && comments[0].empty()) comments.erase(comments.begin()); // remove empty line at the start
|
||||||
|
|
||||||
|
/* comments of type / * ! mean: this is a function declaration; switch comments with declarations */ |
||||||
|
if (exclam == '!') { |
||||||
|
if (!comments.empty()) comments.erase(comments.begin()); /* remove first line like "LZ4_XXX() :" */ |
||||||
|
linenum++; |
||||||
|
lines = get_lines(input, linenum, ""); |
||||||
|
|
||||||
|
sout << "<pre><b>"; |
||||||
|
for (l=0; l<lines.size(); l++) { |
||||||
|
print_line(sout, lines[l]); |
||||||
|
} |
||||||
|
sout << "</b><p>"; |
||||||
|
for (l=0; l<comments.size(); l++) { |
||||||
|
print_line(sout, comments[l]); |
||||||
|
} |
||||||
|
sout << "</p></pre><BR>" << endl << endl; |
||||||
|
} else if (exclam == '=') { /* comments of type / * = and / * * = mean: use a <H3> header and show also all functions until first empty line */ |
||||||
|
trim(comments[0], " "); |
||||||
|
sout << "<h3>" << comments[0] << "</h3><pre>"; |
||||||
|
for (l=1; l<comments.size(); l++) { |
||||||
|
print_line(sout, comments[l]); |
||||||
|
} |
||||||
|
sout << "</pre><b><pre>"; |
||||||
|
lines = get_lines(input, ++linenum, ""); |
||||||
|
for (l=0; l<lines.size(); l++) { |
||||||
|
print_line(sout, lines[l]); |
||||||
|
} |
||||||
|
sout << "</pre></b><BR>" << endl; |
||||||
|
} else { /* comments of type / * * and / * - mean: this is a comment; use a <H2> header for the first line */ |
||||||
|
if (comments.empty()) continue; |
||||||
|
|
||||||
|
trim(comments[0], " "); |
||||||
|
sout << "<a name=\"Chapter" << chapter << "\"></a><h2>" << comments[0] << "</h2><pre>"; |
||||||
|
chapters.push_back(comments[0]); |
||||||
|
chapter++; |
||||||
|
|
||||||
|
for (l=1; l<comments.size(); l++) { |
||||||
|
print_line(sout, comments[l]); |
||||||
|
} |
||||||
|
if (comments.size() > 1) |
||||||
|
sout << "<BR></pre>" << endl << endl; |
||||||
|
else |
||||||
|
sout << "</pre>" << endl << endl; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
ostream << "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n<title>" << version << "</title>\n</head>\n<body>" << endl; |
||||||
|
ostream << "<h1>" << version << "</h1>\n"; |
||||||
|
|
||||||
|
ostream << "<hr>\n<a name=\"Contents\"></a><h2>Contents</h2>\n<ol>\n"; |
||||||
|
for (size_t i=0; i<chapters.size(); i++) |
||||||
|
ostream << "<li><a href=\"#Chapter" << i+1 << "\">" << chapters[i].c_str() << "</a></li>\n"; |
||||||
|
ostream << "</ol>\n<hr>\n"; |
||||||
|
|
||||||
|
ostream << sout.str(); |
||||||
|
ostream << "</html>" << endl << "</body>" << endl; |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
Meson build system for lz4 |
||||||
|
========================== |
||||||
|
|
||||||
|
Meson is a build system designed to optimize programmer productivity. |
||||||
|
It aims to do this by providing simple, out-of-the-box support for |
||||||
|
modern software development tools and practices, such as unit tests, |
||||||
|
coverage reports, Valgrind, CCache and the like. |
||||||
|
|
||||||
|
This Meson build system is provided with no guarantee. |
||||||
|
|
||||||
|
## How to build |
||||||
|
|
||||||
|
`cd` to this meson directory (`contrib/meson`) |
||||||
|
|
||||||
|
```sh |
||||||
|
meson setup --buildtype=release -Ddefault_library=shared -Dprograms=true builddir |
||||||
|
cd builddir |
||||||
|
ninja # to build |
||||||
|
ninja install # to install |
||||||
|
``` |
||||||
|
|
||||||
|
You might want to install it in staging directory: |
||||||
|
|
||||||
|
```sh |
||||||
|
DESTDIR=./staging ninja install |
||||||
|
``` |
||||||
|
|
||||||
|
To configure build options, use: |
||||||
|
|
||||||
|
```sh |
||||||
|
meson configure |
||||||
|
``` |
||||||
|
|
||||||
|
See [man meson(1)](https://manpages.debian.org/testing/meson/meson.1.en.html). |
@ -0,0 +1,27 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
# This is a dummy meson file. |
||||||
|
# The intention is that it can be easily moved to the root of the project |
||||||
|
# (together with meson_options.txt) and packaged for wrapdb. |
||||||
|
|
||||||
|
project( |
||||||
|
'lz4', |
||||||
|
['c'], |
||||||
|
license: 'BSD-2-Clause-Patent AND GPL-2.0-or-later', |
||||||
|
default_options: [ |
||||||
|
'c_std=c99', |
||||||
|
'buildtype=release', |
||||||
|
'warning_level=3' |
||||||
|
], |
||||||
|
version: 'DUMMY', |
||||||
|
meson_version: '>=0.49.0' |
||||||
|
) |
||||||
|
|
||||||
|
subdir('meson') |
@ -0,0 +1,39 @@ |
|||||||
|
#!/usr/bin/env python3 |
||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
import re |
||||||
|
|
||||||
|
|
||||||
|
def find_version_tuple(filepath): |
||||||
|
version_file_data = None |
||||||
|
with open(filepath) as fd: |
||||||
|
version_file_data = fd.read() |
||||||
|
|
||||||
|
patterns = r"""#\s*define\s+LZ4_VERSION_MAJOR\s+([0-9]+).*$ |
||||||
|
#\s*define\s+LZ4_VERSION_MINOR\s+([0-9]+).*$ |
||||||
|
#\s*define\s+LZ4_VERSION_RELEASE\s+([0-9]+).*$ |
||||||
|
""" |
||||||
|
regex = re.compile(patterns, re.MULTILINE) |
||||||
|
version_match = regex.search(version_file_data) |
||||||
|
if version_match: |
||||||
|
return version_match.groups() |
||||||
|
raise Exception("Unable to find version string.") |
||||||
|
|
||||||
|
|
||||||
|
def main(): |
||||||
|
import argparse |
||||||
|
parser = argparse.ArgumentParser(description='Print lz4 version from lib/lz4.h') |
||||||
|
parser.add_argument('file', help='path to lib/lz4.h') |
||||||
|
args = parser.parse_args() |
||||||
|
version_tuple = find_version_tuple(args.file) |
||||||
|
print('.'.join(version_tuple)) |
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__': |
||||||
|
main() |
@ -0,0 +1,42 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
lz4_source_root = '../../../../..' |
||||||
|
|
||||||
|
add_languages('cpp') |
||||||
|
|
||||||
|
sources = files( |
||||||
|
lz4_source_root / 'contrib/gen_manual/gen_manual.cpp' |
||||||
|
) |
||||||
|
|
||||||
|
gen_manual = executable( |
||||||
|
'gen_manual', |
||||||
|
sources, |
||||||
|
native: true, |
||||||
|
install: false |
||||||
|
) |
||||||
|
|
||||||
|
manual_pages = ['lz4', 'lz4frame'] |
||||||
|
|
||||||
|
foreach mp : manual_pages |
||||||
|
custom_target( |
||||||
|
'@0@_manual.html'.format(mp), |
||||||
|
build_by_default: true, |
||||||
|
input: lz4_source_root / 'lib/@0@.h'.format(mp), |
||||||
|
output: '@0@_manual.html'.format(mp), |
||||||
|
command: [ |
||||||
|
gen_manual, |
||||||
|
lz4_version, |
||||||
|
'@INPUT@', |
||||||
|
'@OUTPUT@', |
||||||
|
], |
||||||
|
install: false |
||||||
|
) |
||||||
|
endforeach |
@ -0,0 +1,11 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
subdir('gen_manual') |
@ -0,0 +1,32 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
lz4_source_root = '../../../..' |
||||||
|
|
||||||
|
examples = { |
||||||
|
'printVersion': 'printVersion.c', |
||||||
|
'doubleBuffer': 'blockStreaming_doubleBuffer.c', |
||||||
|
'dictionaryRandomAccess': 'dictionaryRandomAccess.c', |
||||||
|
'ringBuffer': 'blockStreaming_ringBuffer.c', |
||||||
|
'ringBufferHC': 'HCStreaming_ringBuffer.c', |
||||||
|
'lineCompress': 'blockStreaming_lineByLine.c', |
||||||
|
'frameCompress': 'frameCompress.c', |
||||||
|
'compressFunctions': 'compress_functions.c', |
||||||
|
'simpleBuffer': 'simple_buffer.c', |
||||||
|
} |
||||||
|
|
||||||
|
foreach e, src : examples |
||||||
|
executable( |
||||||
|
e, |
||||||
|
lz4_source_root / 'examples' / src, |
||||||
|
dependencies: [liblz4_internal_dep], |
||||||
|
install: false |
||||||
|
) |
||||||
|
endforeach |
@ -0,0 +1,76 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
lz4_source_root = '../../../..' |
||||||
|
|
||||||
|
sources = files( |
||||||
|
lz4_source_root / 'lib/lz4.c', |
||||||
|
lz4_source_root / 'lib/lz4frame.c', |
||||||
|
lz4_source_root / 'lib/lz4hc.c', |
||||||
|
lz4_source_root / 'lib/xxhash.c' |
||||||
|
) |
||||||
|
|
||||||
|
c_args = [] |
||||||
|
|
||||||
|
if host_machine.system() == 'windows' and get_option('default_library') != 'static' |
||||||
|
c_args += '-DLZ4_DLL_EXPORT=1' |
||||||
|
endif |
||||||
|
|
||||||
|
if get_option('unstable') |
||||||
|
compile_args += '-DLZ4_STATIC_LINKING_ONLY' |
||||||
|
if get_option('default_library') != 'static' |
||||||
|
c_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS' |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
liblz4 = library( |
||||||
|
'lz4', |
||||||
|
sources, |
||||||
|
install: true, |
||||||
|
version: lz4_version, |
||||||
|
gnu_symbol_visibility: 'hidden' |
||||||
|
) |
||||||
|
|
||||||
|
liblz4_dep = declare_dependency( |
||||||
|
link_with: liblz4, |
||||||
|
include_directories: include_directories(lz4_source_root / 'lib') |
||||||
|
) |
||||||
|
|
||||||
|
if get_option('tests') or get_option('programs') or get_option('examples') |
||||||
|
liblz4_internal = static_library( |
||||||
|
'lz4-internal', |
||||||
|
objects: liblz4.extract_all_objects(recursive: true), |
||||||
|
gnu_symbol_visibility: 'hidden' |
||||||
|
) |
||||||
|
|
||||||
|
liblz4_internal_dep = declare_dependency( |
||||||
|
link_with: liblz4_internal, |
||||||
|
include_directories: include_directories(lz4_source_root / 'lib') |
||||||
|
) |
||||||
|
endif |
||||||
|
|
||||||
|
pkgconfig.generate( |
||||||
|
liblz4, |
||||||
|
name: 'lz4', |
||||||
|
filebase: 'liblz4', |
||||||
|
description: 'extremely fast lossless compression algorithm library', |
||||||
|
version: lz4_version, |
||||||
|
url: 'http://www.lz4.org/' |
||||||
|
) |
||||||
|
|
||||||
|
install_headers( |
||||||
|
lz4_source_root / 'lib/lz4.h', |
||||||
|
lz4_source_root / 'lib/lz4hc.h', |
||||||
|
lz4_source_root / 'lib/lz4frame.h' |
||||||
|
) |
||||||
|
|
||||||
|
if get_option('default_library') != 'shared' |
||||||
|
install_headers(lz4_source_root / 'lib/lz4frame_static.h') |
||||||
|
endif |
@ -0,0 +1,67 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
cc = meson.get_compiler('c') |
||||||
|
|
||||||
|
pkgconfig = import('pkgconfig') |
||||||
|
|
||||||
|
lz4_source_root = '../../..' |
||||||
|
|
||||||
|
lz4_version = meson.project_version() |
||||||
|
|
||||||
|
lz4_h_file = lz4_source_root / 'lib/lz4.h' |
||||||
|
GetLz4LibraryVersion_py = find_program('GetLz4LibraryVersion.py') |
||||||
|
lz4_version = run_command(GetLz4LibraryVersion_py, lz4_h_file, check: true).stdout().strip() |
||||||
|
message('Project version is now: @0@'.format(lz4_version)) |
||||||
|
|
||||||
|
add_project_arguments('-DXXH_NAMESPACE=LZ4_', language: 'c') |
||||||
|
|
||||||
|
if get_option('debug') |
||||||
|
add_project_arguments(cc.get_supported_arguments([ |
||||||
|
'-Wcast-qual', |
||||||
|
'-Wcast-align', |
||||||
|
'-Wshadow', |
||||||
|
'-Wswitch-enum', |
||||||
|
'-Wdeclaration-after-statement', |
||||||
|
'-Wstrict-prototypes', |
||||||
|
'-Wundef', |
||||||
|
'-Wpointer-arith', |
||||||
|
'-Wstrict-aliasing=1', |
||||||
|
'-DLZ4_DEBUG=@0@'.format(get_option('debug-level')), |
||||||
|
] |
||||||
|
), |
||||||
|
language: 'c', |
||||||
|
) |
||||||
|
endif |
||||||
|
|
||||||
|
if get_option('memory-usage') > 0 |
||||||
|
add_project_arguments( |
||||||
|
'-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')), |
||||||
|
language: 'c' |
||||||
|
) |
||||||
|
endif |
||||||
|
|
||||||
|
subdir('lib') |
||||||
|
|
||||||
|
if get_option('programs') |
||||||
|
subdir('programs') |
||||||
|
endif |
||||||
|
|
||||||
|
if get_option('tests') |
||||||
|
subdir('tests') |
||||||
|
endif |
||||||
|
|
||||||
|
if get_option('contrib') |
||||||
|
subdir('contrib') |
||||||
|
endif |
||||||
|
|
||||||
|
if get_option('examples') |
||||||
|
subdir('examples') |
||||||
|
endif |
@ -0,0 +1,44 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
lz4_source_root = '../../../..' |
||||||
|
|
||||||
|
sources = files( |
||||||
|
lz4_source_root / 'programs/bench.c', |
||||||
|
lz4_source_root / 'programs/datagen.c', |
||||||
|
lz4_source_root / 'programs/lz4cli.c', |
||||||
|
lz4_source_root / 'programs/lz4io.c', |
||||||
|
) |
||||||
|
|
||||||
|
lz4 = executable( |
||||||
|
'lz4', |
||||||
|
sources, |
||||||
|
include_directories: include_directories(lz4_source_root / 'programs'), |
||||||
|
dependencies: [liblz4_internal_dep], |
||||||
|
export_dynamic: get_option('debug') and host_machine.system() == 'windows', |
||||||
|
install: true |
||||||
|
) |
||||||
|
|
||||||
|
install_man(lz4_source_root / 'programs/lz4.1') |
||||||
|
|
||||||
|
if meson.version().version_compare('>=0.61.0') |
||||||
|
foreach alias : ['lz4c', 'lz4cat', 'unlz4'] |
||||||
|
install_symlink( |
||||||
|
alias, |
||||||
|
install_dir: get_option('bindir'), |
||||||
|
pointing_to: 'lz4' |
||||||
|
) |
||||||
|
install_symlink( |
||||||
|
'@0@.1'.format(alias), |
||||||
|
install_dir: get_option('mandir') / 'man1', |
||||||
|
pointing_to: 'lz4.1' |
||||||
|
) |
||||||
|
endforeach |
||||||
|
endif |
@ -0,0 +1,52 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
lz4_source_root = '../../../..' |
||||||
|
|
||||||
|
exes = { |
||||||
|
'fullbench': { |
||||||
|
'sources': files(lz4_source_root / 'tests/fullbench.c'), |
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'), |
||||||
|
}, |
||||||
|
'fuzzer': { |
||||||
|
'sources': files(lz4_source_root / 'tests/fuzzer.c'), |
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'), |
||||||
|
}, |
||||||
|
'frametest': { |
||||||
|
'sources': files(lz4_source_root / 'tests/frametest.c'), |
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'), |
||||||
|
}, |
||||||
|
'roundTripTest': { |
||||||
|
'sources': files(lz4_source_root / 'tests/roundTripTest.c'), |
||||||
|
}, |
||||||
|
'datagen': { |
||||||
|
'sources': files(lz4_source_root / 'tests/datagencli.c'), |
||||||
|
'objects': lz4.extract_objects(lz4_source_root / 'programs/datagen.c'), |
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'), |
||||||
|
}, |
||||||
|
'checkFrame': { |
||||||
|
'sources': files(lz4_source_root / 'tests/checkFrame.c'), |
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'), |
||||||
|
}, |
||||||
|
'checkTag': { |
||||||
|
'sources': files(lz4_source_root / 'tests/checkTag.c'), |
||||||
|
}, |
||||||
|
} |
||||||
|
|
||||||
|
foreach e, attrs : exes |
||||||
|
executable( |
||||||
|
e, |
||||||
|
attrs.get('sources'), |
||||||
|
objects: attrs.get('objects', []), |
||||||
|
dependencies: [liblz4_internal_dep], |
||||||
|
include_directories: attrs.get('include_directories', []), |
||||||
|
install: false |
||||||
|
) |
||||||
|
endforeach |
@ -0,0 +1,24 @@ |
|||||||
|
# ############################################################################# |
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> |
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# This source code is licensed under both the BSD-style license (found in the |
||||||
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found |
||||||
|
# in the COPYING file in the root directory of this source tree). |
||||||
|
# ############################################################################# |
||||||
|
|
||||||
|
option('debug-level', type: 'integer', min: 0, max: 7, value: 1, |
||||||
|
description: 'Enable run-time debug. See lib/lz4hc.c') |
||||||
|
option('unstable', type: 'boolean', value: false, |
||||||
|
description: 'Expose unstable interfaces') |
||||||
|
option('programs', type: 'boolean', value: false, |
||||||
|
description: 'Enable programs build') |
||||||
|
option('tests', type: 'boolean', value: false, |
||||||
|
description: 'Enable tests build') |
||||||
|
option('contrib', type: 'boolean', value: false, |
||||||
|
description: 'Enable contrib build') |
||||||
|
option('examples', type: 'boolean', value: false, |
||||||
|
description: 'Enable examples build') |
||||||
|
option('memory-usage', type: 'integer', min: 0, value: 0, |
||||||
|
description: 'See LZ4_MEMORY_USAGE. 0 means use the LZ4 default') |
@ -0,0 +1,29 @@ |
|||||||
|
Snap Packaging |
||||||
|
-------------- |
||||||
|
|
||||||
|
This directory contains the config required to generate a snap package |
||||||
|
of lz4. Snaps are universal Linux packages that allow you to easily |
||||||
|
build your application from any source and ship it to any Linux |
||||||
|
distribution by publishing it to https://snapcraft.io/. A key attribute |
||||||
|
of a snap package is that it is (ideally) confined such that it |
||||||
|
executes within a controlled environment with all its dependencies |
||||||
|
bundled with it and does not share dependencies with of from any other |
||||||
|
package on the system (with a couple of minor exceptions). |
||||||
|
|
||||||
|
The basic anatomy and workflow is: |
||||||
|
|
||||||
|
* ensure snap.snapcraft.yaml is up-to-date e.g. with version info |
||||||
|
|
||||||
|
* build the snap by installing the snapcraft package and running it |
||||||
|
|
||||||
|
* push snap/* changes to the repo (excluding any crud generated by a build of course) |
||||||
|
|
||||||
|
* register yourself as owner of lz4 name in snapstore |
||||||
|
|
||||||
|
* publish new snap to the snap store |
||||||
|
|
||||||
|
* install snap by doing 'snap install lz4' on any Linux distro |
||||||
|
|
||||||
|
* all installed copies of lz4 will be automatically updated to your new version |
||||||
|
|
||||||
|
For more information on Snaps see https://docs.snapcraft.io and https://forum.snapcraft.io/ |
@ -0,0 +1,31 @@ |
|||||||
|
name: lz4 |
||||||
|
version: 1.9.3 |
||||||
|
summary: Extremely Fast Compression algorithm |
||||||
|
description: > |
||||||
|
LZ4 is lossless compression algorithm, providing compression |
||||||
|
speed > 500 MB/s per core, scalable with multi-cores CPU. It features an |
||||||
|
extremely fast decoder, with speed in multiple GB/s per core, typically |
||||||
|
reaching RAM speed limits on multi-core systems. |
||||||
|
. |
||||||
|
Speed can be tuned dynamically, selecting an "acceleration" factor which |
||||||
|
trades compression ratio for faster speed. On the other end, a high |
||||||
|
compression derivative, LZ4_HC, is also provided, trading CPU time for |
||||||
|
improved compression ratio. All versions feature the same decompression |
||||||
|
speed. |
||||||
|
. |
||||||
|
LZ4 is also compatible with dictionary compression, and can ingest any |
||||||
|
input file as dictionary, including those created by Zstandard Dictionary |
||||||
|
Builder. (note: only the final 64KB are used). |
||||||
|
. |
||||||
|
LZ4 library is provided as open-source software using BSD 2-Clause license. |
||||||
|
confinement: strict |
||||||
|
grade: stable |
||||||
|
|
||||||
|
apps: |
||||||
|
lz4: |
||||||
|
command: usr/local/bin/lz4 |
||||||
|
plugs: [home] |
||||||
|
parts: |
||||||
|
lz4: |
||||||
|
source: ../ |
||||||
|
plugin: make |
@ -0,0 +1,244 @@ |
|||||||
|
LZ4 Block Format Description |
||||||
|
============================ |
||||||
|
Last revised: 2022-07-31 . |
||||||
|
Author : Yann Collet |
||||||
|
|
||||||
|
|
||||||
|
This specification is intended for developers willing to |
||||||
|
produce or read LZ4 compressed data blocks |
||||||
|
using any programming language of their choice. |
||||||
|
|
||||||
|
LZ4 is an LZ77-type compressor with a fixed byte-oriented encoding format. |
||||||
|
There is no entropy encoder back-end nor framing layer. |
||||||
|
The latter is assumed to be handled by other parts of the system |
||||||
|
(see [LZ4 Frame format]). |
||||||
|
This design is assumed to favor simplicity and speed. |
||||||
|
|
||||||
|
This document describes only the Block Format, |
||||||
|
not how the compressor nor decompressor actually work. |
||||||
|
For more details on such topics, see later section "Implementation Notes". |
||||||
|
|
||||||
|
[LZ4 Frame format]: lz4_Frame_format.md |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Compressed block format |
||||||
|
----------------------- |
||||||
|
An LZ4 compressed block is composed of sequences. |
||||||
|
A sequence is a suite of literals (not-compressed bytes), |
||||||
|
followed by a match copy operation. |
||||||
|
|
||||||
|
Each sequence starts with a `token`. |
||||||
|
The `token` is a one byte value, separated into two 4-bits fields. |
||||||
|
Therefore each field ranges from 0 to 15. |
||||||
|
|
||||||
|
|
||||||
|
The first field uses the 4 high-bits of the token. |
||||||
|
It provides the length of literals to follow. |
||||||
|
|
||||||
|
If the field value is smaller than 15, |
||||||
|
then it represents the total nb of literals present in the sequence, |
||||||
|
including 0, in which case there is no literal. |
||||||
|
|
||||||
|
The value 15 is a special case: more bytes are required to indicate the full length. |
||||||
|
Each additional byte then represents a value from 0 to 255, |
||||||
|
which is added to the previous value to produce a total length. |
||||||
|
When the byte value is 255, another byte must be read and added, and so on. |
||||||
|
There can be any number of bytes of value `255` following `token`. |
||||||
|
The Block Format does not define any "size limit", |
||||||
|
though real implementations may feature some practical limits |
||||||
|
(see more details in later chapter "Implementation Notes"). |
||||||
|
|
||||||
|
Note : this format explains why a non-compressible input block is expanded by 0.4%. |
||||||
|
|
||||||
|
Example 1 : A literal length of 48 will be represented as : |
||||||
|
|
||||||
|
- 15 : value for the 4-bits High field |
||||||
|
- 33 : (=48-15) remaining length to reach 48 |
||||||
|
|
||||||
|
Example 2 : A literal length of 280 will be represented as : |
||||||
|
|
||||||
|
- 15 : value for the 4-bits High field |
||||||
|
- 255 : following byte is maxed, since 280-15 >= 255 |
||||||
|
- 10 : (=280 - 15 - 255) remaining length to reach 280 |
||||||
|
|
||||||
|
Example 3 : A literal length of 15 will be represented as : |
||||||
|
|
||||||
|
- 15 : value for the 4-bits High field |
||||||
|
- 0 : (=15-15) yes, the zero must be output |
||||||
|
|
||||||
|
Following `token` and optional length bytes, are the literals themselves. |
||||||
|
They are exactly as numerous as just decoded (length of literals). |
||||||
|
Reminder: it's possible that there are zero literals. |
||||||
|
|
||||||
|
|
||||||
|
Following the literals is the match copy operation. |
||||||
|
|
||||||
|
It starts by the `offset` value. |
||||||
|
This is a 2 bytes value, in little endian format |
||||||
|
(the 1st byte is the "low" byte, the 2nd one is the "high" byte). |
||||||
|
|
||||||
|
The `offset` represents the position of the match to be copied from the past. |
||||||
|
For example, 1 means "current position - 1 byte". |
||||||
|
The maximum `offset` value is 65535. 65536 and beyond cannot be coded. |
||||||
|
Note that 0 is an invalid `offset` value. |
||||||
|
The presence of a 0 `offset` value denotes an invalid (corrupted) block. |
||||||
|
|
||||||
|
Then the `matchlength` can be extracted. |
||||||
|
For this, we use the second `token` field, the low 4-bits. |
||||||
|
Such a value, obviously, ranges from 0 to 15. |
||||||
|
However here, 0 means that the copy operation is minimal. |
||||||
|
The minimum length of a match, called `minmatch`, is 4. |
||||||
|
As a consequence, a 0 value means 4 bytes. |
||||||
|
Similarly to literal length, any value smaller than 15 represents a length, |
||||||
|
to which 4 (`minmatch`) must be added, thus ranging from 4 to 18. |
||||||
|
A value of 15 is special, meaning 19+ bytes, |
||||||
|
to which one must read additional bytes, one at a time, |
||||||
|
with each byte value ranging from 0 to 255. |
||||||
|
They are added to total to provide the final match length. |
||||||
|
A 255 value means there is another byte to read and add. |
||||||
|
There is no limit to the number of optional `255` bytes that can be present, |
||||||
|
and therefore no limit to representable match length, |
||||||
|
though real-life implementations are likely going to enforce limits for practical reasons (see more details in "Implementation Notes" section below). |
||||||
|
|
||||||
|
Note: this format has a maximum achievable compression ratio of about ~250. |
||||||
|
|
||||||
|
Decoding the `matchlength` reaches the end of current sequence. |
||||||
|
Next byte will be the start of another sequence, and therefore a new `token`. |
||||||
|
|
||||||
|
|
||||||
|
End of block conditions |
||||||
|
------------------------- |
||||||
|
There are specific restrictions required to terminate an LZ4 block. |
||||||
|
|
||||||
|
1. The last sequence contains only literals. |
||||||
|
The block ends right after the literals (no `offset` field). |
||||||
|
2. The last 5 bytes of input are always literals. |
||||||
|
Therefore, the last sequence contains at least 5 bytes. |
||||||
|
- Special : if input is smaller than 5 bytes, |
||||||
|
there is only one sequence, it contains the whole input as literals. |
||||||
|
Even empty input can be represented, using a zero byte, |
||||||
|
interpreted as a final token without literal and without a match. |
||||||
|
3. The last match must start at least 12 bytes before the end of block. |
||||||
|
The last match is part of the _penultimate_ sequence. |
||||||
|
It is followed by the last sequence, which contains _only_ literals. |
||||||
|
- Note that, as a consequence, |
||||||
|
blocks < 12 bytes cannot be compressed. |
||||||
|
And as an extension, _independent_ blocks < 13 bytes cannot be compressed, |
||||||
|
because they must start by at least one literal, |
||||||
|
that the match can then copy afterwards. |
||||||
|
|
||||||
|
When a block does not respect these end conditions, |
||||||
|
a conformant decoder is allowed to reject the block as incorrect. |
||||||
|
|
||||||
|
These rules are in place to ensure compatibility with |
||||||
|
a wide range of historical decoders |
||||||
|
which rely on these conditions for their speed-oriented design. |
||||||
|
|
||||||
|
Implementation notes |
||||||
|
----------------------- |
||||||
|
The LZ4 Block Format only defines the compressed format, |
||||||
|
it does not tell how to create a decoder or an encoder, |
||||||
|
which design is left free to the imagination of the implementer. |
||||||
|
|
||||||
|
However, thanks to experience, there are a number of typical topics that |
||||||
|
most implementations will have to consider. |
||||||
|
This section tries to provide a few guidelines. |
||||||
|
|
||||||
|
#### Metadata |
||||||
|
|
||||||
|
An LZ4-compressed Block requires additional metadata for proper decoding. |
||||||
|
Typically, a decoder will require the compressed block's size, |
||||||
|
and an upper bound of decompressed size. |
||||||
|
Other variants exist, such as knowing the decompressed size, |
||||||
|
and having an upper bound of the input size. |
||||||
|
The Block Format does not specify how to transmit such information, |
||||||
|
which is considered an out-of-band information channel. |
||||||
|
That's because in many cases, the information is present in the environment. |
||||||
|
For example, databases must store the size of their compressed block for indexing, |
||||||
|
and know that their decompressed block can't be larger than a certain threshold. |
||||||
|
|
||||||
|
If you need a format which is "self-contained", |
||||||
|
and also transports the necessary metadata for proper decoding on any platform, |
||||||
|
consider employing the [LZ4 Frame format] instead. |
||||||
|
|
||||||
|
#### Large lengths |
||||||
|
|
||||||
|
While the Block Format does not define any maximum value for length fields, |
||||||
|
in practice, most implementations will feature some form of limit, |
||||||
|
since it's expected for such values to be stored into registers of fixed bit width. |
||||||
|
|
||||||
|
If length fields use 64-bit registers, |
||||||
|
then it can be assumed that there is no practical limit, |
||||||
|
as it would require a single continuous block of multiple petabytes to reach it, |
||||||
|
which is unreasonable by today's standard. |
||||||
|
|
||||||
|
If length fields use 32-bit registers, then it can be overflowed, |
||||||
|
but requires a compressed block of size > 16 MB. |
||||||
|
Therefore, implementations that do not deal with compressed blocks > 16 MB are safe. |
||||||
|
However, if such a case is allowed, |
||||||
|
then it's recommended to check that no large length overflows the register. |
||||||
|
|
||||||
|
If length fields use 16-bit registers, |
||||||
|
then it's definitely possible to overflow such register, |
||||||
|
with less than < 300 bytes of compressed data. |
||||||
|
|
||||||
|
A conformant decoder should be able to detect length overflows when it's possible, |
||||||
|
and simply error out when that happens. |
||||||
|
The input block might not be invalid, |
||||||
|
it's just not decodable by the local decoder implementation. |
||||||
|
|
||||||
|
Note that, in order to be compatible with the larger LZ4 ecosystem, |
||||||
|
it's recommended to be able to read and represent lengths of up to 4 MB, |
||||||
|
and to accept blocks of size up to 4 MB. |
||||||
|
Such limits are compatible with 32-bit length registers, |
||||||
|
and prevent overflow of 32-bit registers. |
||||||
|
|
||||||
|
#### Safe decoding |
||||||
|
|
||||||
|
If a decoder receives compressed data from any external source, |
||||||
|
it is recommended to ensure that the decoder is resilient to corrupted input, |
||||||
|
and made safe from buffer overflow manipulations. |
||||||
|
Always ensure that read and write operations |
||||||
|
remain within the limits of provided buffers. |
||||||
|
|
||||||
|
Of particular importance, ensure that the nb of bytes instructed to copy |
||||||
|
does not overflow neither the input nor the output buffers. |
||||||
|
Ensure also, when reading an offset value, that the resulting position to copy |
||||||
|
does not reach beyond the beginning of the buffer. |
||||||
|
Such a situation can happen during the first 64 KB of decoded data. |
||||||
|
|
||||||
|
For more safety, test the decoder with fuzzers |
||||||
|
to ensure it's resilient to improbable sequences of conditions. |
||||||
|
Combine them with sanitizers, in order to catch overflows (asan) |
||||||
|
or initialization issues (msan). |
||||||
|
|
||||||
|
Pay some attention to offset 0 scenario, which is invalid, |
||||||
|
and therefore must not be blindly decoded: |
||||||
|
a naive implementation could preserve destination buffer content, |
||||||
|
which could then result in information disclosure |
||||||
|
if such buffer was uninitialized and still containing private data. |
||||||
|
For reference, in such a scenario, the reference LZ4 decoder |
||||||
|
clears the match segment with `0` bytes, |
||||||
|
though other solutions are certainly possible. |
||||||
|
|
||||||
|
Finally, pay attention to the "overlap match" scenario, |
||||||
|
when `matchlength` is larger than `offset`. |
||||||
|
In which case, since `match_pos + matchlength > current_pos`, |
||||||
|
some of the later bytes to copy do not exist yet, |
||||||
|
and will be generated during the early stage of match copy operation. |
||||||
|
Such scenario must be handled with special care. |
||||||
|
A common case is an offset of 1, |
||||||
|
meaning the last byte is repeated `matchlength` times. |
||||||
|
|
||||||
|
#### Compression techniques |
||||||
|
|
||||||
|
The core of a LZ4 compressor is to detect duplicated data across past 64 KB. |
||||||
|
The format makes no assumption nor limits to the way a compressor |
||||||
|
searches and selects matches within the source data block. |
||||||
|
For example, an upper compression limit can be reached, |
||||||
|
using a technique called "full optimal parsing", at high cpu and memory cost. |
||||||
|
But multiple other techniques can be considered, |
||||||
|
featuring distinct time / performance trade-offs. |
||||||
|
As long as the specified format is respected, |
||||||
|
the result will be compatible with and decodable by any compliant decoder. |
@ -0,0 +1,432 @@ |
|||||||
|
LZ4 Frame Format Description |
||||||
|
============================ |
||||||
|
|
||||||
|
### Notices |
||||||
|
|
||||||
|
Copyright (c) 2013-2020 Yann Collet |
||||||
|
|
||||||
|
Permission is granted to copy and distribute this document |
||||||
|
for any purpose and without charge, |
||||||
|
including translations into other languages |
||||||
|
and incorporation into compilations, |
||||||
|
provided that the copyright notice and this notice are preserved, |
||||||
|
and that any substantive changes or deletions from the original |
||||||
|
are clearly marked. |
||||||
|
Distribution of this document is unlimited. |
||||||
|
|
||||||
|
### Version |
||||||
|
|
||||||
|
1.6.2 (12/08/2020) |
||||||
|
|
||||||
|
|
||||||
|
Introduction |
||||||
|
------------ |
||||||
|
|
||||||
|
The purpose of this document is to define a lossless compressed data format, |
||||||
|
that is independent of CPU type, operating system, |
||||||
|
file system and character set, suitable for |
||||||
|
File compression, Pipe and streaming compression |
||||||
|
using the [LZ4 algorithm](http://www.lz4.org). |
||||||
|
|
||||||
|
The data can be produced or consumed, |
||||||
|
even for an arbitrarily long sequentially presented input data stream, |
||||||
|
using only an a priori bounded amount of intermediate storage, |
||||||
|
and hence can be used in data communications. |
||||||
|
The format uses the LZ4 compression method, |
||||||
|
and optional [xxHash-32 checksum method](https://github.com/Cyan4973/xxHash), |
||||||
|
for detection of data corruption. |
||||||
|
|
||||||
|
The data format defined by this specification |
||||||
|
does not attempt to allow random access to compressed data. |
||||||
|
|
||||||
|
This specification is intended for use by implementers of software |
||||||
|
to compress data into LZ4 format and/or decompress data from LZ4 format. |
||||||
|
The text of the specification assumes a basic background in programming |
||||||
|
at the level of bits and other primitive data representations. |
||||||
|
|
||||||
|
Unless otherwise indicated below, |
||||||
|
a compliant compressor must produce data sets |
||||||
|
that conform to the specifications presented here. |
||||||
|
It doesn't need to support all options though. |
||||||
|
|
||||||
|
A compliant decompressor must be able to decompress |
||||||
|
at least one working set of parameters |
||||||
|
that conforms to the specifications presented here. |
||||||
|
It may also ignore checksums. |
||||||
|
Whenever it does not support a specific parameter within the compressed stream, |
||||||
|
it must produce a non-ambiguous error code |
||||||
|
and associated error message explaining which parameter is unsupported. |
||||||
|
|
||||||
|
|
||||||
|
General Structure of LZ4 Frame format |
||||||
|
------------------------------------- |
||||||
|
|
||||||
|
| MagicNb | F. Descriptor | Block | (...) | EndMark | C. Checksum | |
||||||
|
|:-------:|:-------------:| ----- | ----- | ------- | ----------- | |
||||||
|
| 4 bytes | 3-15 bytes | | | 4 bytes | 0-4 bytes | |
||||||
|
|
||||||
|
__Magic Number__ |
||||||
|
|
||||||
|
4 Bytes, Little endian format. |
||||||
|
Value : 0x184D2204 |
||||||
|
|
||||||
|
__Frame Descriptor__ |
||||||
|
|
||||||
|
3 to 15 Bytes, to be detailed in its own paragraph, |
||||||
|
as it is the most important part of the spec. |
||||||
|
|
||||||
|
The combined _Magic_Number_ and _Frame_Descriptor_ fields are sometimes |
||||||
|
called ___LZ4 Frame Header___. Its size varies between 7 and 19 bytes. |
||||||
|
|
||||||
|
__Data Blocks__ |
||||||
|
|
||||||
|
To be detailed in its own paragraph. |
||||||
|
That’s where compressed data is stored. |
||||||
|
|
||||||
|
__EndMark__ |
||||||
|
|
||||||
|
The flow of blocks ends when the last data block is followed by |
||||||
|
the 32-bit value `0x00000000`. |
||||||
|
|
||||||
|
__Content Checksum__ |
||||||
|
|
||||||
|
_Content_Checksum_ verify that the full content has been decoded correctly. |
||||||
|
The content checksum is the result of [xxHash-32 algorithm] |
||||||
|
digesting the original (decoded) data as input, and a seed of zero. |
||||||
|
Content checksum is only present when its associated flag |
||||||
|
is set in the frame descriptor. |
||||||
|
Content Checksum validates the result, |
||||||
|
that all blocks were fully transmitted in the correct order and without error, |
||||||
|
and also that the encoding/decoding process itself generated no distortion. |
||||||
|
Its usage is recommended. |
||||||
|
|
||||||
|
The combined _EndMark_ and _Content_Checksum_ fields might sometimes be |
||||||
|
referred to as ___LZ4 Frame Footer___. Its size varies between 4 and 8 bytes. |
||||||
|
|
||||||
|
__Frame Concatenation__ |
||||||
|
|
||||||
|
In some circumstances, it may be preferable to append multiple frames, |
||||||
|
for example in order to add new data to an existing compressed file |
||||||
|
without re-framing it. |
||||||
|
|
||||||
|
In such case, each frame has its own set of descriptor flags. |
||||||
|
Each frame is considered independent. |
||||||
|
The only relation between frames is their sequential order. |
||||||
|
|
||||||
|
The ability to decode multiple concatenated frames |
||||||
|
within a single stream or file |
||||||
|
is left outside of this specification. |
||||||
|
As an example, the reference lz4 command line utility behavior is |
||||||
|
to decode all concatenated frames in their sequential order. |
||||||
|
|
||||||
|
|
||||||
|
Frame Descriptor |
||||||
|
---------------- |
||||||
|
|
||||||
|
| FLG | BD | (Content Size) | (Dictionary ID) | HC | |
||||||
|
| ------- | ------- |:--------------:|:---------------:| ------- | |
||||||
|
| 1 byte | 1 byte | 0 - 8 bytes | 0 - 4 bytes | 1 byte | |
||||||
|
|
||||||
|
The descriptor uses a minimum of 3 bytes, |
||||||
|
and up to 15 bytes depending on optional parameters. |
||||||
|
|
||||||
|
__FLG byte__ |
||||||
|
|
||||||
|
| BitNb | 7-6 | 5 | 4 | 3 | 2 | 1 | 0 | |
||||||
|
| ------- |-------|-------|----------|------|----------|----------|------| |
||||||
|
|FieldName|Version|B.Indep|B.Checksum|C.Size|C.Checksum|*Reserved*|DictID| |
||||||
|
|
||||||
|
|
||||||
|
__BD byte__ |
||||||
|
|
||||||
|
| BitNb | 7 | 6-5-4 | 3-2-1-0 | |
||||||
|
| ------- | -------- | ------------- | -------- | |
||||||
|
|FieldName|*Reserved*| Block MaxSize |*Reserved*| |
||||||
|
|
||||||
|
In the tables, bit 7 is highest bit, while bit 0 is lowest. |
||||||
|
|
||||||
|
__Version Number__ |
||||||
|
|
||||||
|
2-bits field, must be set to `01`. |
||||||
|
Any other value cannot be decoded by this version of the specification. |
||||||
|
Other version numbers will use different flag layouts. |
||||||
|
|
||||||
|
__Block Independence flag__ |
||||||
|
|
||||||
|
If this flag is set to “1”, blocks are independent. |
||||||
|
If this flag is set to “0”, each block depends on previous ones |
||||||
|
(up to LZ4 window size, which is 64 KB). |
||||||
|
In such case, it’s necessary to decode all blocks in sequence. |
||||||
|
|
||||||
|
Block dependency improves compression ratio, especially for small blocks. |
||||||
|
On the other hand, it makes random access or multi-threaded decoding impossible. |
||||||
|
|
||||||
|
__Block checksum flag__ |
||||||
|
|
||||||
|
If this flag is set, each data block will be followed by a 4-bytes checksum, |
||||||
|
calculated by using the xxHash-32 algorithm on the raw (compressed) data block. |
||||||
|
The intention is to detect data corruption (storage or transmission errors) |
||||||
|
immediately, before decoding. |
||||||
|
Block checksum usage is optional. |
||||||
|
|
||||||
|
__Content Size flag__ |
||||||
|
|
||||||
|
If this flag is set, the uncompressed size of data included within the frame |
||||||
|
will be present as an 8 bytes unsigned little endian value, after the flags. |
||||||
|
Content Size usage is optional. |
||||||
|
|
||||||
|
__Content checksum flag__ |
||||||
|
|
||||||
|
If this flag is set, a 32-bits content checksum will be appended |
||||||
|
after the EndMark. |
||||||
|
|
||||||
|
__Dictionary ID flag__ |
||||||
|
|
||||||
|
If this flag is set, a 4-bytes Dict-ID field will be present, |
||||||
|
after the descriptor flags and the Content Size. |
||||||
|
|
||||||
|
__Block Maximum Size__ |
||||||
|
|
||||||
|
This information is useful to help the decoder allocate memory. |
||||||
|
Size here refers to the original (uncompressed) data size. |
||||||
|
Block Maximum Size is one value among the following table : |
||||||
|
|
||||||
|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
||||||
|
| --- | --- | --- | --- | ----- | ------ | ---- | ---- | |
||||||
|
| N/A | N/A | N/A | N/A | 64 KB | 256 KB | 1 MB | 4 MB | |
||||||
|
|
||||||
|
The decoder may refuse to allocate block sizes above any system-specific size. |
||||||
|
Unused values may be used in a future revision of the spec. |
||||||
|
A decoder conformant with the current version of the spec |
||||||
|
is only able to decode block sizes defined in this spec. |
||||||
|
|
||||||
|
__Reserved bits__ |
||||||
|
|
||||||
|
Value of reserved bits **must** be 0 (zero). |
||||||
|
Reserved bit might be used in a future version of the specification, |
||||||
|
typically enabling new optional features. |
||||||
|
When this happens, a decoder respecting the current specification version |
||||||
|
shall not be able to decode such a frame. |
||||||
|
|
||||||
|
__Content Size__ |
||||||
|
|
||||||
|
This is the original (uncompressed) size. |
||||||
|
This information is optional, and only present if the associated flag is set. |
||||||
|
Content size is provided using unsigned 8 Bytes, for a maximum of 16 Exabytes. |
||||||
|
Format is Little endian. |
||||||
|
This value is informational, typically for display or memory allocation. |
||||||
|
It can be skipped by a decoder, or used to validate content correctness. |
||||||
|
|
||||||
|
__Dictionary ID__ |
||||||
|
|
||||||
|
Dict-ID is only present if the associated flag is set. |
||||||
|
It's an unsigned 32-bits value, stored using little-endian convention. |
||||||
|
A dictionary is useful to compress short input sequences. |
||||||
|
The compressor can take advantage of the dictionary context |
||||||
|
to encode the input in a more compact manner. |
||||||
|
It works as a kind of “known prefix” which is used by |
||||||
|
both the compressor and the decompressor to “warm-up” reference tables. |
||||||
|
|
||||||
|
The decompressor can use Dict-ID identifier to determine |
||||||
|
which dictionary must be used to correctly decode data. |
||||||
|
The compressor and the decompressor must use exactly the same dictionary. |
||||||
|
It's presumed that the 32-bits dictID uniquely identifies a dictionary. |
||||||
|
|
||||||
|
Within a single frame, a single dictionary can be defined. |
||||||
|
When the frame descriptor defines independent blocks, |
||||||
|
each block will be initialized with the same dictionary. |
||||||
|
If the frame descriptor defines linked blocks, |
||||||
|
the dictionary will only be used once, at the beginning of the frame. |
||||||
|
|
||||||
|
__Header Checksum__ |
||||||
|
|
||||||
|
One-byte checksum of combined descriptor fields, including optional ones. |
||||||
|
The value is the second byte of `xxh32()` : ` (xxh32()>>8) & 0xFF ` |
||||||
|
using zero as a seed, and the full Frame Descriptor as an input |
||||||
|
(including optional fields when they are present). |
||||||
|
A wrong checksum indicates that the descriptor is erroneous. |
||||||
|
|
||||||
|
|
||||||
|
Data Blocks |
||||||
|
----------- |
||||||
|
|
||||||
|
| Block Size | data | (Block Checksum) | |
||||||
|
|:----------:| ------ |:----------------:| |
||||||
|
| 4 bytes | | 0 - 4 bytes | |
||||||
|
|
||||||
|
|
||||||
|
__Block Size__ |
||||||
|
|
||||||
|
This field uses 4-bytes, format is little-endian. |
||||||
|
|
||||||
|
If the highest bit is set (`1`), the block is uncompressed. |
||||||
|
|
||||||
|
If the highest bit is not set (`0`), the block is LZ4-compressed, |
||||||
|
using the [LZ4 block format specification](https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md). |
||||||
|
|
||||||
|
All other bits give the size, in bytes, of the data section. |
||||||
|
The size does not include the block checksum if present. |
||||||
|
|
||||||
|
_Block_Size_ shall never be larger than _Block_Maximum_Size_. |
||||||
|
Such an outcome could potentially happen for non-compressible sources. |
||||||
|
In such a case, such data block must be passed using uncompressed format. |
||||||
|
|
||||||
|
A value of `0x00000000` is invalid, and signifies an _EndMark_ instead. |
||||||
|
Note that this is different from a value of `0x80000000` (highest bit set), |
||||||
|
which is an uncompressed block of size 0 (empty), |
||||||
|
which is valid, and therefore doesn't end a frame. |
||||||
|
Note that, if _Block_checksum_ is enabled, |
||||||
|
even an empty block must be followed by a 32-bit block checksum. |
||||||
|
|
||||||
|
__Data__ |
||||||
|
|
||||||
|
Where the actual data to decode stands. |
||||||
|
It might be compressed or not, depending on previous field indications. |
||||||
|
|
||||||
|
When compressed, the data must respect the [LZ4 block format specification](https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md). |
||||||
|
|
||||||
|
Note that a block is not necessarily full. |
||||||
|
Uncompressed size of data can be any size __up to__ _Block_Maximum_Size_, |
||||||
|
so it may contain less data than the maximum block size. |
||||||
|
|
||||||
|
__Block checksum__ |
||||||
|
|
||||||
|
Only present if the associated flag is set. |
||||||
|
This is a 4-bytes checksum value, in little endian format, |
||||||
|
calculated by using the [xxHash-32 algorithm] on the __raw__ (undecoded) data block, |
||||||
|
and a seed of zero. |
||||||
|
The intention is to detect data corruption (storage or transmission errors) |
||||||
|
before decoding. |
||||||
|
|
||||||
|
_Block_checksum_ can be cumulative with _Content_checksum_. |
||||||
|
|
||||||
|
[xxHash-32 algorithm]: https://github.com/Cyan4973/xxHash/blob/release/doc/xxhash_spec.md |
||||||
|
|
||||||
|
|
||||||
|
Skippable Frames |
||||||
|
---------------- |
||||||
|
|
||||||
|
| Magic Number | Frame Size | User Data | |
||||||
|
|:------------:|:----------:| --------- | |
||||||
|
| 4 bytes | 4 bytes | | |
||||||
|
|
||||||
|
Skippable frames allow the integration of user-defined data |
||||||
|
into a flow of concatenated frames. |
||||||
|
Its design is pretty straightforward, |
||||||
|
with the sole objective to allow the decoder to quickly skip |
||||||
|
over user-defined data and continue decoding. |
||||||
|
|
||||||
|
For the purpose of facilitating identification, |
||||||
|
it is discouraged to start a flow of concatenated frames with a skippable frame. |
||||||
|
If there is a need to start such a flow with some user data |
||||||
|
encapsulated into a skippable frame, |
||||||
|
it’s recommended to start with a zero-byte LZ4 frame |
||||||
|
followed by a skippable frame. |
||||||
|
This will make it easier for file type identifiers. |
||||||
|
|
||||||
|
|
||||||
|
__Magic Number__ |
||||||
|
|
||||||
|
4 Bytes, Little endian format. |
||||||
|
Value : 0x184D2A5X, which means any value from 0x184D2A50 to 0x184D2A5F. |
||||||
|
All 16 values are valid to identify a skippable frame. |
||||||
|
|
||||||
|
__Frame Size__ |
||||||
|
|
||||||
|
This is the size, in bytes, of the following User Data |
||||||
|
(without including the magic number nor the size field itself). |
||||||
|
4 Bytes, Little endian format, unsigned 32-bits. |
||||||
|
This means User Data can’t be bigger than (2^32-1) Bytes. |
||||||
|
|
||||||
|
__User Data__ |
||||||
|
|
||||||
|
User Data can be anything. Data will just be skipped by the decoder. |
||||||
|
|
||||||
|
|
||||||
|
Legacy frame |
||||||
|
------------ |
||||||
|
|
||||||
|
The Legacy frame format was defined into the initial versions of “LZ4Demo”. |
||||||
|
Newer compressors should not use this format anymore, as it is too restrictive. |
||||||
|
|
||||||
|
Main characteristics of the legacy format : |
||||||
|
|
||||||
|
- Fixed block size : 8 MB. |
||||||
|
- All blocks must be completely filled, except the last one. |
||||||
|
- All blocks are always compressed, even when compression is detrimental. |
||||||
|
- The last block is detected either because |
||||||
|
it is followed by the “EOF” (End of File) mark, |
||||||
|
or because it is followed by a known Frame Magic Number. |
||||||
|
- No checksum |
||||||
|
- Convention is Little endian |
||||||
|
|
||||||
|
| MagicNb | B.CSize | CData | B.CSize | CData | (...) | EndMark | |
||||||
|
| ------- | ------- | ----- | ------- | ----- | ------- | ------- | |
||||||
|
| 4 bytes | 4 bytes | CSize | 4 bytes | CSize | x times | EOF | |
||||||
|
|
||||||
|
|
||||||
|
__Magic Number__ |
||||||
|
|
||||||
|
4 Bytes, Little endian format. |
||||||
|
Value : 0x184C2102 |
||||||
|
|
||||||
|
__Block Compressed Size__ |
||||||
|
|
||||||
|
This is the size, in bytes, of the following compressed data block. |
||||||
|
4 Bytes, Little endian format. |
||||||
|
|
||||||
|
__Data__ |
||||||
|
|
||||||
|
Where the actual compressed data stands. |
||||||
|
Data is always compressed, even when compression is detrimental. |
||||||
|
|
||||||
|
__EndMark__ |
||||||
|
|
||||||
|
End of legacy frame is implicit only. |
||||||
|
It must be followed by a standard EOF (End Of File) signal, |
||||||
|
whether it is a file or a stream. |
||||||
|
|
||||||
|
Alternatively, if the frame is followed by a valid Frame Magic Number, |
||||||
|
it is considered completed. |
||||||
|
This policy makes it possible to concatenate legacy frames. |
||||||
|
|
||||||
|
Any other value will be interpreted as a block size, |
||||||
|
and trigger an error if it does not fit within acceptable range. |
||||||
|
|
||||||
|
|
||||||
|
Version changes |
||||||
|
--------------- |
||||||
|
|
||||||
|
1.6.2 : clarifies specification of _EndMark_ |
||||||
|
|
||||||
|
1.6.1 : introduced terms "LZ4 Frame Header" and "LZ4 Frame Footer" |
||||||
|
|
||||||
|
1.6.0 : restored Dictionary ID field in Frame header |
||||||
|
|
||||||
|
1.5.1 : changed document format to MarkDown |
||||||
|
|
||||||
|
1.5 : removed Dictionary ID from specification |
||||||
|
|
||||||
|
1.4.1 : changed wording from “stream” to “frame” |
||||||
|
|
||||||
|
1.4 : added skippable streams, re-added stream checksum |
||||||
|
|
||||||
|
1.3 : modified header checksum |
||||||
|
|
||||||
|
1.2 : reduced choice of “block size”, to postpone decision on “dynamic size of BlockSize Field”. |
||||||
|
|
||||||
|
1.1 : optional fields are now part of the descriptor |
||||||
|
|
||||||
|
1.0 : changed “block size” specification, adding a compressed/uncompressed flag |
||||||
|
|
||||||
|
0.9 : reduced scale of “block maximum size” table |
||||||
|
|
||||||
|
0.8 : removed : high compression flag |
||||||
|
|
||||||
|
0.7 : removed : stream checksum |
||||||
|
|
||||||
|
0.6 : settled : stream size uses 8 bytes, endian convention is little endian |
||||||
|
|
||||||
|
0.5: added copyright notice |
||||||
|
|
||||||
|
0.4 : changed format to Google Doc compatible OpenDocument |
@ -0,0 +1,613 @@ |
|||||||
|
<html> |
||||||
|
<head> |
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
||||||
|
<title>1.9.4 Manual</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<h1>1.9.4 Manual</h1> |
||||||
|
<hr> |
||||||
|
<a name="Contents"></a><h2>Contents</h2> |
||||||
|
<ol> |
||||||
|
<li><a href="#Chapter1">Introduction</a></li> |
||||||
|
<li><a href="#Chapter2">Version</a></li> |
||||||
|
<li><a href="#Chapter3">Tuning parameter</a></li> |
||||||
|
<li><a href="#Chapter4">Simple Functions</a></li> |
||||||
|
<li><a href="#Chapter5">Advanced Functions</a></li> |
||||||
|
<li><a href="#Chapter6">Streaming Compression Functions</a></li> |
||||||
|
<li><a href="#Chapter7">Streaming Decompression Functions</a></li> |
||||||
|
<li><a href="#Chapter8">Experimental section</a></li> |
||||||
|
<li><a href="#Chapter9">Private Definitions</a></li> |
||||||
|
<li><a href="#Chapter10">Obsolete Functions</a></li> |
||||||
|
</ol> |
||||||
|
<hr> |
||||||
|
<a name="Chapter1"></a><h2>Introduction</h2><pre> |
||||||
|
LZ4 is lossless compression algorithm, providing compression speed >500 MB/s per core, |
||||||
|
scalable with multi-cores CPU. It features an extremely fast decoder, with speed in |
||||||
|
multiple GB/s per core, typically reaching RAM speed limits on multi-core systems. |
||||||
|
|
||||||
|
The LZ4 compression library provides in-memory compression and decompression functions. |
||||||
|
It gives full buffer control to user. |
||||||
|
Compression can be done in: |
||||||
|
- a single step (described as Simple Functions) |
||||||
|
- a single step, reusing a context (described in Advanced Functions) |
||||||
|
- unbounded multiple steps (described as Streaming compression) |
||||||
|
|
||||||
|
lz4.h generates and decodes LZ4-compressed blocks (doc/lz4_Block_format.md). |
||||||
|
Decompressing such a compressed block requires additional metadata. |
||||||
|
Exact metadata depends on exact decompression function. |
||||||
|
For the typical case of LZ4_decompress_safe(), |
||||||
|
metadata includes block's compressed size, and maximum bound of decompressed size. |
||||||
|
Each application is free to encode and pass such metadata in whichever way it wants. |
||||||
|
|
||||||
|
lz4.h only handle blocks, it can not generate Frames. |
||||||
|
|
||||||
|
Blocks are different from Frames (doc/lz4_Frame_format.md). |
||||||
|
Frames bundle both blocks and metadata in a specified manner. |
||||||
|
Embedding metadata is required for compressed data to be self-contained and portable. |
||||||
|
Frame format is delivered through a companion API, declared in lz4frame.h. |
||||||
|
The `lz4` CLI can only manage frames. |
||||||
|
<BR></pre> |
||||||
|
|
||||||
|
<pre><b>#if defined(LZ4_FREESTANDING) && (LZ4_FREESTANDING == 1) |
||||||
|
# define LZ4_HEAPMODE 0 |
||||||
|
# define LZ4HC_HEAPMODE 0 |
||||||
|
# define LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 1 |
||||||
|
# if !defined(LZ4_memcpy) |
||||||
|
# error "LZ4_FREESTANDING requires macro 'LZ4_memcpy'." |
||||||
|
# endif |
||||||
|
# if !defined(LZ4_memset) |
||||||
|
# error "LZ4_FREESTANDING requires macro 'LZ4_memset'." |
||||||
|
# endif |
||||||
|
# if !defined(LZ4_memmove) |
||||||
|
# error "LZ4_FREESTANDING requires macro 'LZ4_memmove'." |
||||||
|
# endif |
||||||
|
#elif ! defined(LZ4_FREESTANDING) |
||||||
|
# define LZ4_FREESTANDING 0 |
||||||
|
#endif |
||||||
|
</b><p> When this macro is set to 1, it enables "freestanding mode" that is |
||||||
|
suitable for typical freestanding environment which doesn't support |
||||||
|
standard C library. |
||||||
|
|
||||||
|
- LZ4_FREESTANDING is a compile-time switch. |
||||||
|
- It requires the following macros to be defined: |
||||||
|
LZ4_memcpy, LZ4_memmove, LZ4_memset. |
||||||
|
- It only enables LZ4/HC functions which don't use heap. |
||||||
|
All LZ4F_* functions are not supported. |
||||||
|
- See tests/freestanding.c to check its basic setup. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter2"></a><h2>Version</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>int LZ4_versionNumber (void); </b>/**< library version number; useful to check dll version; requires v1.3.0+ */<b> |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>const char* LZ4_versionString (void); </b>/**< library version string; useful to check dll version; requires v1.7.5+ */<b> |
||||||
|
</b></pre><BR> |
||||||
|
<a name="Chapter3"></a><h2>Tuning parameter</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>#ifndef LZ4_MEMORY_USAGE |
||||||
|
# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT |
||||||
|
#endif |
||||||
|
</b><p> Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; ) |
||||||
|
Increasing memory usage improves compression ratio, at the cost of speed. |
||||||
|
Reduced memory usage may improve speed at the cost of ratio, thanks to better cache locality. |
||||||
|
Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter4"></a><h2>Simple Functions</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity); |
||||||
|
</b><p> Compresses 'srcSize' bytes from buffer 'src' |
||||||
|
into already allocated 'dst' buffer of size 'dstCapacity'. |
||||||
|
Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize). |
||||||
|
It also runs faster, so it's a recommended setting. |
||||||
|
If the function cannot compress 'src' into a more limited 'dst' budget, |
||||||
|
compression stops *immediately*, and the function result is zero. |
||||||
|
In which case, 'dst' content is undefined (invalid). |
||||||
|
srcSize : max supported value is LZ4_MAX_INPUT_SIZE. |
||||||
|
dstCapacity : size of buffer 'dst' (which must be already allocated) |
||||||
|
@return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity) |
||||||
|
or 0 if compression fails |
||||||
|
Note : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer). |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity); |
||||||
|
</b><p> compressedSize : is the exact complete size of the compressed block. |
||||||
|
dstCapacity : is the size of destination buffer (which must be already allocated), presumed an upper bound of decompressed size. |
||||||
|
@return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity) |
||||||
|
If destination buffer is not large enough, decoding will stop and output an error code (negative value). |
||||||
|
If the source stream is detected malformed, the function will stop decoding and return a negative result. |
||||||
|
Note 1 : This function is protected against malicious data packets : |
||||||
|
it will never writes outside 'dst' buffer, nor read outside 'source' buffer, |
||||||
|
even if the compressed block is maliciously modified to order the decoder to do these actions. |
||||||
|
In such case, the decoder stops immediately, and considers the compressed block malformed. |
||||||
|
Note 2 : compressedSize and dstCapacity must be provided to the function, the compressed block does not contain them. |
||||||
|
The implementation is free to send / store / derive this information in whichever way is most beneficial. |
||||||
|
If there is a need for a different format which bundles together both compressed data and its metadata, consider looking at lz4frame.h instead. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter5"></a><h2>Advanced Functions</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>int LZ4_compressBound(int inputSize); |
||||||
|
</b><p> Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) |
||||||
|
This function is primarily useful for memory allocation purposes (destination buffer size). |
||||||
|
Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example). |
||||||
|
Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize) |
||||||
|
inputSize : max supported value is LZ4_MAX_INPUT_SIZE |
||||||
|
return : maximum output size in a "worst case" scenario |
||||||
|
or 0, if input size is incorrect (too large or negative) |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); |
||||||
|
</b><p> Same as LZ4_compress_default(), but allows selection of "acceleration" factor. |
||||||
|
The larger the acceleration value, the faster the algorithm, but also the lesser the compression. |
||||||
|
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed. |
||||||
|
An acceleration value of "1" is the same as regular LZ4_compress_default() |
||||||
|
Values <= 0 will be replaced by LZ4_ACCELERATION_DEFAULT (currently == 1, see lz4.c). |
||||||
|
Values > LZ4_ACCELERATION_MAX will be replaced by LZ4_ACCELERATION_MAX (currently == 65537, see lz4.c). |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_sizeofState(void); |
||||||
|
int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); |
||||||
|
</b><p> Same as LZ4_compress_fast(), using an externally allocated memory space for its state. |
||||||
|
Use LZ4_sizeofState() to know how much memory must be allocated, |
||||||
|
and allocate it on 8-bytes boundaries (using `malloc()` typically). |
||||||
|
Then, provide this buffer as `void* state` to compression function. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize); |
||||||
|
</b><p> Reverse the logic : compresses as much data as possible from 'src' buffer |
||||||
|
into already allocated buffer 'dst', of size >= 'targetDestSize'. |
||||||
|
This function either compresses the entire 'src' content into 'dst' if it's large enough, |
||||||
|
or fill 'dst' buffer completely with as much data as possible from 'src'. |
||||||
|
note: acceleration parameter is fixed to "default". |
||||||
|
|
||||||
|
*srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'. |
||||||
|
New value is necessarily <= input value. |
||||||
|
@return : Nb bytes written into 'dst' (necessarily <= targetDestSize) |
||||||
|
or 0 if compression fails. |
||||||
|
|
||||||
|
Note : from v1.8.2 to v1.9.1, this function had a bug (fixed un v1.9.2+): |
||||||
|
the produced compressed content could, in specific circumstances, |
||||||
|
require to be decompressed into a destination buffer larger |
||||||
|
by at least 1 byte than the content to decompress. |
||||||
|
If an application uses `LZ4_compress_destSize()`, |
||||||
|
it's highly recommended to update liblz4 to v1.9.2 or better. |
||||||
|
If this can't be done or ensured, |
||||||
|
the receiving decompression function should provide |
||||||
|
a dstCapacity which is > decompressedSize, by at least 1 byte. |
||||||
|
See https://github.com/lz4/lz4/issues/859 for details |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity); |
||||||
|
</b><p> Decompress an LZ4 compressed block, of size 'srcSize' at position 'src', |
||||||
|
into destination buffer 'dst' of size 'dstCapacity'. |
||||||
|
Up to 'targetOutputSize' bytes will be decoded. |
||||||
|
The function stops decoding on reaching this objective. |
||||||
|
This can be useful to boost performance |
||||||
|
whenever only the beginning of a block is required. |
||||||
|
|
||||||
|
@return : the number of bytes decoded in `dst` (necessarily <= targetOutputSize) |
||||||
|
If source stream is detected malformed, function returns a negative result. |
||||||
|
|
||||||
|
Note 1 : @return can be < targetOutputSize, if compressed block contains less data. |
||||||
|
|
||||||
|
Note 2 : targetOutputSize must be <= dstCapacity |
||||||
|
|
||||||
|
Note 3 : this function effectively stops decoding on reaching targetOutputSize, |
||||||
|
so dstCapacity is kind of redundant. |
||||||
|
This is because in older versions of this function, |
||||||
|
decoding operation would still write complete sequences. |
||||||
|
Therefore, there was no guarantee that it would stop writing at exactly targetOutputSize, |
||||||
|
it could write more bytes, though only up to dstCapacity. |
||||||
|
Some "margin" used to be required for this operation to work properly. |
||||||
|
Thankfully, this is no longer necessary. |
||||||
|
The function nonetheless keeps the same signature, in an effort to preserve API compatibility. |
||||||
|
|
||||||
|
Note 4 : If srcSize is the exact size of the block, |
||||||
|
then targetOutputSize can be any value, |
||||||
|
including larger than the block's decompressed size. |
||||||
|
The function will, at most, generate block's decompressed size. |
||||||
|
|
||||||
|
Note 5 : If srcSize is _larger_ than block's compressed size, |
||||||
|
then targetOutputSize **MUST** be <= block's decompressed size. |
||||||
|
Otherwise, *silent corruption will occur*. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter6"></a><h2>Streaming Compression Functions</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>void LZ4_resetStream_fast (LZ4_stream_t* streamPtr); |
||||||
|
</b><p> Use this to prepare an LZ4_stream_t for a new chain of dependent blocks |
||||||
|
(e.g., LZ4_compress_fast_continue()). |
||||||
|
|
||||||
|
An LZ4_stream_t must be initialized once before usage. |
||||||
|
This is automatically done when created by LZ4_createStream(). |
||||||
|
However, should the LZ4_stream_t be simply declared on stack (for example), |
||||||
|
it's necessary to initialize it first, using LZ4_initStream(). |
||||||
|
|
||||||
|
After init, start any new stream with LZ4_resetStream_fast(). |
||||||
|
A same LZ4_stream_t can be re-used multiple times consecutively |
||||||
|
and compress multiple streams, |
||||||
|
provided that it starts each new stream with LZ4_resetStream_fast(). |
||||||
|
|
||||||
|
LZ4_resetStream_fast() is much faster than LZ4_initStream(), |
||||||
|
but is not compatible with memory regions containing garbage data. |
||||||
|
|
||||||
|
Note: it's only useful to call LZ4_resetStream_fast() |
||||||
|
in the context of streaming compression. |
||||||
|
The *extState* functions perform their own resets. |
||||||
|
Invoking LZ4_resetStream_fast() before is redundant, and even counterproductive. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize); |
||||||
|
</b><p> Use this function to reference a static dictionary into LZ4_stream_t. |
||||||
|
The dictionary must remain available during compression. |
||||||
|
LZ4_loadDict() triggers a reset, so any previous data will be forgotten. |
||||||
|
The same dictionary will have to be loaded on decompression side for successful decoding. |
||||||
|
Dictionary are useful for better compression of small data (KB range). |
||||||
|
While LZ4 accept any input as dictionary, |
||||||
|
results are generally better when using Zstandard's Dictionary Builder. |
||||||
|
Loading a size of 0 is allowed, and is the same as reset. |
||||||
|
@return : loaded dictionary size, in bytes (necessarily <= 64 KB) |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); |
||||||
|
</b><p> Compress 'src' content using data from previously compressed blocks, for better compression ratio. |
||||||
|
'dst' buffer must be already allocated. |
||||||
|
If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster. |
||||||
|
|
||||||
|
@return : size of compressed block |
||||||
|
or 0 if there is an error (typically, cannot fit into 'dst'). |
||||||
|
|
||||||
|
Note 1 : Each invocation to LZ4_compress_fast_continue() generates a new block. |
||||||
|
Each block has precise boundaries. |
||||||
|
Each block must be decompressed separately, calling LZ4_decompress_*() with relevant metadata. |
||||||
|
It's not possible to append blocks together and expect a single invocation of LZ4_decompress_*() to decompress them together. |
||||||
|
|
||||||
|
Note 2 : The previous 64KB of source data is __assumed__ to remain present, unmodified, at same address in memory ! |
||||||
|
|
||||||
|
Note 3 : When input is structured as a double-buffer, each buffer can have any size, including < 64 KB. |
||||||
|
Make sure that buffers are separated, by at least one byte. |
||||||
|
This construction ensures that each block only depends on previous block. |
||||||
|
|
||||||
|
Note 4 : If input buffer is a ring-buffer, it can have any size, including < 64 KB. |
||||||
|
|
||||||
|
Note 5 : After an error, the stream status is undefined (invalid), it can only be reset or freed. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize); |
||||||
|
</b><p> If last 64KB data cannot be guaranteed to remain available at its current memory location, |
||||||
|
save it into a safer place (char* safeBuffer). |
||||||
|
This is schematically equivalent to a memcpy() followed by LZ4_loadDict(), |
||||||
|
but is much faster, because LZ4_saveDict() doesn't need to rebuild tables. |
||||||
|
@return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter7"></a><h2>Streaming Decompression Functions</h2><pre> Bufferless synchronous API |
||||||
|
<BR></pre> |
||||||
|
|
||||||
|
<pre><b>#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) |
||||||
|
LZ4_streamDecode_t* LZ4_createStreamDecode(void); |
||||||
|
int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream); |
||||||
|
#endif </b>/* !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) */<b> |
||||||
|
</b><p> creation / destruction of streaming decompression tracking context. |
||||||
|
A tracking context can be re-used multiple times. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize); |
||||||
|
</b><p> An LZ4_streamDecode_t context can be allocated once and re-used multiple times. |
||||||
|
Use this function to start decompression of a new stream of blocks. |
||||||
|
A dictionary can optionally be set. Use NULL or size 0 for a reset order. |
||||||
|
Dictionary is presumed stable : it must remain accessible and unmodified during next decompression. |
||||||
|
@return : 1 if OK, 0 if error |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int LZ4_decoderRingBufferSize(int maxBlockSize); |
||||||
|
#define LZ4_DECODER_RING_BUFFER_SIZE(maxBlockSize) (65536 + 14 + (maxBlockSize)) </b>/* for static allocation; maxBlockSize presumed valid */<b> |
||||||
|
</b><p> Note : in a ring buffer scenario (optional), |
||||||
|
blocks are presumed decompressed next to each other |
||||||
|
up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize), |
||||||
|
at which stage it resumes from beginning of ring buffer. |
||||||
|
When setting such a ring buffer for streaming decompression, |
||||||
|
provides the minimum size of this ring buffer |
||||||
|
to be compatible with any source respecting maxBlockSize condition. |
||||||
|
@return : minimum ring buffer size, |
||||||
|
or 0 if there is an error (invalid maxBlockSize). |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int |
||||||
|
LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, |
||||||
|
const char* src, char* dst, |
||||||
|
int srcSize, int dstCapacity); |
||||||
|
</b><p> These decoding functions allow decompression of consecutive blocks in "streaming" mode. |
||||||
|
A block is an unsplittable entity, it must be presented entirely to a decompression function. |
||||||
|
Decompression functions only accepts one block at a time. |
||||||
|
The last 64KB of previously decoded data *must* remain available and unmodified at the memory position where they were decoded. |
||||||
|
If less than 64KB of data has been decoded, all the data must be present. |
||||||
|
|
||||||
|
Special : if decompression side sets a ring buffer, it must respect one of the following conditions : |
||||||
|
- Decompression buffer size is _at least_ LZ4_decoderRingBufferSize(maxBlockSize). |
||||||
|
maxBlockSize is the maximum size of any single block. It can have any value > 16 bytes. |
||||||
|
In which case, encoding and decoding buffers do not need to be synchronized. |
||||||
|
Actually, data can be produced by any source compliant with LZ4 format specification, and respecting maxBlockSize. |
||||||
|
- Synchronized mode : |
||||||
|
Decompression buffer size is _exactly_ the same as compression buffer size, |
||||||
|
and follows exactly same update rule (block boundaries at same positions), |
||||||
|
and decoding function is provided with exact decompressed size of each block (exception for last block of the stream), |
||||||
|
_then_ decoding & encoding ring buffer can have any size, including small ones ( < 64 KB). |
||||||
|
- Decompression buffer is larger than encoding buffer, by a minimum of maxBlockSize more bytes. |
||||||
|
In which case, encoding and decoding buffers do not need to be synchronized, |
||||||
|
and encoding ring buffer can have any size, including small ones ( < 64 KB). |
||||||
|
|
||||||
|
Whenever these conditions are not possible, |
||||||
|
save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression, |
||||||
|
then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block. |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>int |
||||||
|
LZ4_decompress_safe_usingDict(const char* src, char* dst, |
||||||
|
int srcSize, int dstCapacity, |
||||||
|
const char* dictStart, int dictSize); |
||||||
|
</b><p> These decoding functions work the same as |
||||||
|
a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue() |
||||||
|
They are stand-alone, and don't need an LZ4_streamDecode_t structure. |
||||||
|
Dictionary is presumed stable : it must remain accessible and unmodified during decompression. |
||||||
|
Performance tip : Decompression speed can be substantially increased |
||||||
|
when dst == dictStart + dictSize. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter8"></a><h2>Experimental section</h2><pre> |
||||||
|
Symbols declared in this section must be considered unstable. Their |
||||||
|
signatures or semantics may change, or they may be removed altogether in the |
||||||
|
future. They are therefore only safe to depend on when the caller is |
||||||
|
statically linked against the library. |
||||||
|
|
||||||
|
To protect against unsafe usage, not only are the declarations guarded, |
||||||
|
the definitions are hidden by default |
||||||
|
when building LZ4 as a shared/dynamic library. |
||||||
|
|
||||||
|
In order to access these declarations, |
||||||
|
define LZ4_STATIC_LINKING_ONLY in your application |
||||||
|
before including LZ4's headers. |
||||||
|
|
||||||
|
In order to make their implementations accessible dynamically, you must |
||||||
|
define LZ4_PUBLISH_STATIC_FUNCTIONS when building the LZ4 library. |
||||||
|
<BR></pre> |
||||||
|
|
||||||
|
<pre><b>LZ4LIB_STATIC_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); |
||||||
|
</b><p> A variant of LZ4_compress_fast_extState(). |
||||||
|
|
||||||
|
Using this variant avoids an expensive initialization step. |
||||||
|
It is only safe to call if the state buffer is known to be correctly initialized already |
||||||
|
(see above comment on LZ4_resetStream_fast() for a definition of "correctly initialized"). |
||||||
|
From a high level, the difference is that |
||||||
|
this function initializes the provided state with a call to something like LZ4_resetStream_fast() |
||||||
|
while LZ4_compress_fast_extState() starts with a call to LZ4_resetStream(). |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4LIB_STATIC_API void |
||||||
|
LZ4_attach_dictionary(LZ4_stream_t* workingStream, |
||||||
|
const LZ4_stream_t* dictionaryStream); |
||||||
|
</b><p> This is an experimental API that allows |
||||||
|
efficient use of a static dictionary many times. |
||||||
|
|
||||||
|
Rather than re-loading the dictionary buffer into a working context before |
||||||
|
each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a |
||||||
|
working LZ4_stream_t, this function introduces a no-copy setup mechanism, |
||||||
|
in which the working stream references the dictionary stream in-place. |
||||||
|
|
||||||
|
Several assumptions are made about the state of the dictionary stream. |
||||||
|
Currently, only streams which have been prepared by LZ4_loadDict() should |
||||||
|
be expected to work. |
||||||
|
|
||||||
|
Alternatively, the provided dictionaryStream may be NULL, |
||||||
|
in which case any existing dictionary stream is unset. |
||||||
|
|
||||||
|
If a dictionary is provided, it replaces any pre-existing stream history. |
||||||
|
The dictionary contents are the only history that can be referenced and |
||||||
|
logically immediately precede the data compressed in the first subsequent |
||||||
|
compression call. |
||||||
|
|
||||||
|
The dictionary will only remain attached to the working stream through the |
||||||
|
first compression call, at the end of which it is cleared. The dictionary |
||||||
|
stream (and source buffer) must remain in-place / accessible / unchanged |
||||||
|
through the completion of the first compression call on the stream. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b></b><p> |
||||||
|
It's possible to have input and output sharing the same buffer, |
||||||
|
for highly constrained memory environments. |
||||||
|
In both cases, it requires input to lay at the end of the buffer, |
||||||
|
and decompression to start at beginning of the buffer. |
||||||
|
Buffer size must feature some margin, hence be larger than final size. |
||||||
|
|
||||||
|
|<------------------------buffer--------------------------------->| |
||||||
|
|<-----------compressed data--------->| |
||||||
|
|<-----------decompressed size------------------>| |
||||||
|
|<----margin---->| |
||||||
|
|
||||||
|
This technique is more useful for decompression, |
||||||
|
since decompressed size is typically larger, |
||||||
|
and margin is short. |
||||||
|
|
||||||
|
In-place decompression will work inside any buffer |
||||||
|
which size is >= LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize). |
||||||
|
This presumes that decompressedSize > compressedSize. |
||||||
|
Otherwise, it means compression actually expanded data, |
||||||
|
and it would be more efficient to store such data with a flag indicating it's not compressed. |
||||||
|
This can happen when data is not compressible (already compressed, or encrypted). |
||||||
|
|
||||||
|
For in-place compression, margin is larger, as it must be able to cope with both |
||||||
|
history preservation, requiring input data to remain unmodified up to LZ4_DISTANCE_MAX, |
||||||
|
and data expansion, which can happen when input is not compressible. |
||||||
|
As a consequence, buffer size requirements are much higher, |
||||||
|
and memory savings offered by in-place compression are more limited. |
||||||
|
|
||||||
|
There are ways to limit this cost for compression : |
||||||
|
- Reduce history size, by modifying LZ4_DISTANCE_MAX. |
||||||
|
Note that it is a compile-time constant, so all compressions will apply this limit. |
||||||
|
Lower values will reduce compression ratio, except when input_size < LZ4_DISTANCE_MAX, |
||||||
|
so it's a reasonable trick when inputs are known to be small. |
||||||
|
- Require the compressor to deliver a "maximum compressed size". |
||||||
|
This is the `dstCapacity` parameter in `LZ4_compress*()`. |
||||||
|
When this size is < LZ4_COMPRESSBOUND(inputSize), then compression can fail, |
||||||
|
in which case, the return code will be 0 (zero). |
||||||
|
The caller must be ready for these cases to happen, |
||||||
|
and typically design a backup scheme to send data uncompressed. |
||||||
|
The combination of both techniques can significantly reduce |
||||||
|
the amount of margin required for in-place compression. |
||||||
|
|
||||||
|
In-place compression can work in any buffer |
||||||
|
which size is >= (maxCompressedSize) |
||||||
|
with maxCompressedSize == LZ4_COMPRESSBOUND(srcSize) for guaranteed compression success. |
||||||
|
LZ4_COMPRESS_INPLACE_BUFFER_SIZE() depends on both maxCompressedSize and LZ4_DISTANCE_MAX, |
||||||
|
so it's possible to reduce memory requirements by playing with them. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>#define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) ((decompressedSize) + LZ4_DECOMPRESS_INPLACE_MARGIN(decompressedSize)) </b>/**< note: presumes that compressedSize < decompressedSize. note2: margin is overestimated a bit, since it could use compressedSize instead */<b> |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>#define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) ((maxCompressedSize) + LZ4_COMPRESS_INPLACE_MARGIN) </b>/**< maxCompressedSize is generally LZ4_COMPRESSBOUND(inputSize), but can be set to any lower value, with the risk that compression can fail (return code 0(zero)) */<b> |
||||||
|
</b></pre><BR> |
||||||
|
<a name="Chapter9"></a><h2>Private Definitions</h2><pre> |
||||||
|
Do not use these definitions directly. |
||||||
|
They are only exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`. |
||||||
|
Accessing members will expose user code to API and/or ABI break in future versions of the library. |
||||||
|
<BR></pre> |
||||||
|
|
||||||
|
<pre><b></b><p> Never ever use below internal definitions directly ! |
||||||
|
These definitions are not API/ABI safe, and may change in future versions. |
||||||
|
If you need static allocation, declare or allocate an LZ4_stream_t object. |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4_stream_t* LZ4_initStream (void* buffer, size_t size); |
||||||
|
</b><p> An LZ4_stream_t structure must be initialized at least once. |
||||||
|
This is automatically done when invoking LZ4_createStream(), |
||||||
|
but it's not when the structure is simply declared on stack (for example). |
||||||
|
|
||||||
|
Use LZ4_initStream() to properly initialize a newly declared LZ4_stream_t. |
||||||
|
It can also initialize any arbitrary buffer of sufficient size, |
||||||
|
and will @return a pointer of proper type upon initialization. |
||||||
|
|
||||||
|
Note : initialization fails if size and alignment conditions are not respected. |
||||||
|
In which case, the function will @return NULL. |
||||||
|
Note2: An LZ4_stream_t structure guarantees correct alignment and size. |
||||||
|
Note3: Before v1.9.0, use LZ4_resetStream() instead |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>typedef struct { |
||||||
|
const LZ4_byte* externalDict; |
||||||
|
const LZ4_byte* prefixEnd; |
||||||
|
size_t extDictSize; |
||||||
|
size_t prefixSize; |
||||||
|
} LZ4_streamDecode_t_internal; |
||||||
|
</b><p> Never ever use below internal definitions directly ! |
||||||
|
These definitions are not API/ABI safe, and may change in future versions. |
||||||
|
If you need static allocation, declare or allocate an LZ4_streamDecode_t object. |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter10"></a><h2>Obsolete Functions</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS |
||||||
|
# define LZ4_DEPRECATED(message) </b>/* disable deprecation warnings */<b> |
||||||
|
#else |
||||||
|
# if defined (__cplusplus) && (__cplusplus >= 201402) </b>/* C++14 or greater */<b> |
||||||
|
# define LZ4_DEPRECATED(message) [[deprecated(message)]] |
||||||
|
# elif defined(_MSC_VER) |
||||||
|
# define LZ4_DEPRECATED(message) __declspec(deprecated(message)) |
||||||
|
# elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45)) |
||||||
|
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) |
||||||
|
# elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31) |
||||||
|
# define LZ4_DEPRECATED(message) __attribute__((deprecated)) |
||||||
|
# else |
||||||
|
# pragma message("WARNING: LZ4_DEPRECATED needs custom implementation for this compiler") |
||||||
|
# define LZ4_DEPRECATED(message) </b>/* disabled */<b> |
||||||
|
# endif |
||||||
|
#endif </b>/* LZ4_DISABLE_DEPRECATE_WARNINGS */<b> |
||||||
|
</b><p> |
||||||
|
Deprecated functions make the compiler generate a warning when invoked. |
||||||
|
This is meant to invite users to update their source code. |
||||||
|
Should deprecation warnings be a problem, it is generally possible to disable them, |
||||||
|
typically with -Wno-deprecated-declarations for gcc |
||||||
|
or _CRT_SECURE_NO_WARNINGS in Visual. |
||||||
|
|
||||||
|
Another method is to define LZ4_DISABLE_DEPRECATE_WARNINGS |
||||||
|
before including the header file. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* src, char* dest, int srcSize); |
||||||
|
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* src, char* dest, int srcSize, int maxOutputSize); |
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize); |
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); |
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize); |
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize); |
||||||
|
</b><p></p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize); |
||||||
|
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); |
||||||
|
</b><p></p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize); |
||||||
|
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize); |
||||||
|
</b><p></p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead") |
||||||
|
int LZ4_decompress_fast (const char* src, char* dst, int originalSize); |
||||||
|
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_continue() instead") |
||||||
|
int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize); |
||||||
|
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_usingDict() instead") |
||||||
|
int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize); |
||||||
|
</b><p> These functions used to be faster than LZ4_decompress_safe(), |
||||||
|
but this is no longer the case. They are now slower. |
||||||
|
This is because LZ4_decompress_fast() doesn't know the input size, |
||||||
|
and therefore must progress more cautiously into the input buffer to not read beyond the end of block. |
||||||
|
On top of that `LZ4_decompress_fast()` is not protected vs malformed or malicious inputs, making it a security liability. |
||||||
|
As a consequence, LZ4_decompress_fast() is strongly discouraged, and deprecated. |
||||||
|
|
||||||
|
The last remaining LZ4_decompress_fast() specificity is that |
||||||
|
it can decompress a block without knowing its compressed size. |
||||||
|
Such functionality can be achieved in a more secure manner |
||||||
|
by employing LZ4_decompress_safe_partial(). |
||||||
|
|
||||||
|
Parameters: |
||||||
|
originalSize : is the uncompressed size to regenerate. |
||||||
|
`dst` must be already allocated, its size must be >= 'originalSize' bytes. |
||||||
|
@return : number of bytes read from source buffer (== compressed size). |
||||||
|
The function expects to finish at block's end exactly. |
||||||
|
If the source stream is detected malformed, the function stops decoding and returns a negative result. |
||||||
|
note : LZ4_decompress_fast*() requires originalSize. Thanks to this information, it never writes past the output buffer. |
||||||
|
However, since it doesn't know its 'src' size, it may read an unknown amount of input, past input buffer bounds. |
||||||
|
Also, since match offsets are not validated, match reads from 'src' may underflow too. |
||||||
|
These issues never happen if input (compressed) data is correct. |
||||||
|
But they may happen if input data is invalid (error or intentional tampering). |
||||||
|
As a consequence, use these functions in trusted environments with trusted data **only**. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>void LZ4_resetStream (LZ4_stream_t* streamPtr); |
||||||
|
</b><p> An LZ4_stream_t structure must be initialized at least once. |
||||||
|
This is done with LZ4_initStream(), or LZ4_resetStream(). |
||||||
|
Consider switching to LZ4_initStream(), |
||||||
|
invoking LZ4_resetStream() will trigger deprecation warnings in the future. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
</html> |
||||||
|
</body> |
@ -0,0 +1,455 @@ |
|||||||
|
<html> |
||||||
|
<head> |
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
||||||
|
<title>1.9.4 Manual</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<h1>1.9.4 Manual</h1> |
||||||
|
<hr> |
||||||
|
<a name="Contents"></a><h2>Contents</h2> |
||||||
|
<ol> |
||||||
|
<li><a href="#Chapter1">Introduction</a></li> |
||||||
|
<li><a href="#Chapter2">Compiler specifics</a></li> |
||||||
|
<li><a href="#Chapter3">Error management</a></li> |
||||||
|
<li><a href="#Chapter4">Frame compression types</a></li> |
||||||
|
<li><a href="#Chapter5">Simple compression function</a></li> |
||||||
|
<li><a href="#Chapter6">Advanced compression functions</a></li> |
||||||
|
<li><a href="#Chapter7">Resource Management</a></li> |
||||||
|
<li><a href="#Chapter8">Compression</a></li> |
||||||
|
<li><a href="#Chapter9">Decompression functions</a></li> |
||||||
|
<li><a href="#Chapter10">Streaming decompression functions</a></li> |
||||||
|
<li><a href="#Chapter11">Bulk processing dictionary API</a></li> |
||||||
|
</ol> |
||||||
|
<hr> |
||||||
|
<a name="Chapter1"></a><h2>Introduction</h2><pre> |
||||||
|
lz4frame.h implements LZ4 frame specification: see doc/lz4_Frame_format.md . |
||||||
|
LZ4 Frames are compatible with `lz4` CLI, |
||||||
|
and designed to be interoperable with any system. |
||||||
|
<BR></pre> |
||||||
|
|
||||||
|
<a name="Chapter2"></a><h2>Compiler specifics</h2><pre></pre> |
||||||
|
|
||||||
|
<a name="Chapter3"></a><h2>Error management</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>unsigned LZ4F_isError(LZ4F_errorCode_t code); </b>/**< tells when a function result is an error code */<b> |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>const char* LZ4F_getErrorName(LZ4F_errorCode_t code); </b>/**< return error code string; for debugging */<b> |
||||||
|
</b></pre><BR> |
||||||
|
<a name="Chapter4"></a><h2>Frame compression types</h2><pre> |
||||||
|
<BR></pre> |
||||||
|
|
||||||
|
<pre><b>typedef enum { |
||||||
|
LZ4F_default=0, |
||||||
|
LZ4F_max64KB=4, |
||||||
|
LZ4F_max256KB=5, |
||||||
|
LZ4F_max1MB=6, |
||||||
|
LZ4F_max4MB=7 |
||||||
|
LZ4F_OBSOLETE_ENUM(max64KB) |
||||||
|
LZ4F_OBSOLETE_ENUM(max256KB) |
||||||
|
LZ4F_OBSOLETE_ENUM(max1MB) |
||||||
|
LZ4F_OBSOLETE_ENUM(max4MB) |
||||||
|
} LZ4F_blockSizeID_t; |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>typedef enum { |
||||||
|
LZ4F_blockLinked=0, |
||||||
|
LZ4F_blockIndependent |
||||||
|
LZ4F_OBSOLETE_ENUM(blockLinked) |
||||||
|
LZ4F_OBSOLETE_ENUM(blockIndependent) |
||||||
|
} LZ4F_blockMode_t; |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>typedef enum { |
||||||
|
LZ4F_noContentChecksum=0, |
||||||
|
LZ4F_contentChecksumEnabled |
||||||
|
LZ4F_OBSOLETE_ENUM(noContentChecksum) |
||||||
|
LZ4F_OBSOLETE_ENUM(contentChecksumEnabled) |
||||||
|
} LZ4F_contentChecksum_t; |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>typedef enum { |
||||||
|
LZ4F_noBlockChecksum=0, |
||||||
|
LZ4F_blockChecksumEnabled |
||||||
|
} LZ4F_blockChecksum_t; |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>typedef enum { |
||||||
|
LZ4F_frame=0, |
||||||
|
LZ4F_skippableFrame |
||||||
|
LZ4F_OBSOLETE_ENUM(skippableFrame) |
||||||
|
} LZ4F_frameType_t; |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>typedef struct { |
||||||
|
LZ4F_blockSizeID_t blockSizeID; </b>/* max64KB, max256KB, max1MB, max4MB; 0 == default */<b> |
||||||
|
LZ4F_blockMode_t blockMode; </b>/* LZ4F_blockLinked, LZ4F_blockIndependent; 0 == default */<b> |
||||||
|
LZ4F_contentChecksum_t contentChecksumFlag; </b>/* 1: frame terminated with 32-bit checksum of decompressed data; 0: disabled (default) */<b> |
||||||
|
LZ4F_frameType_t frameType; </b>/* read-only field : LZ4F_frame or LZ4F_skippableFrame */<b> |
||||||
|
unsigned long long contentSize; </b>/* Size of uncompressed content ; 0 == unknown */<b> |
||||||
|
unsigned dictID; </b>/* Dictionary ID, sent by compressor to help decoder select correct dictionary; 0 == no dictID provided */<b> |
||||||
|
LZ4F_blockChecksum_t blockChecksumFlag; </b>/* 1: each block followed by a checksum of block's compressed data; 0: disabled (default) */<b> |
||||||
|
} LZ4F_frameInfo_t; |
||||||
|
</b><p> makes it possible to set or read frame parameters. |
||||||
|
Structure must be first init to 0, using memset() or LZ4F_INIT_FRAMEINFO, |
||||||
|
setting all parameters to default. |
||||||
|
It's then possible to update selectively some parameters |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>typedef struct { |
||||||
|
LZ4F_frameInfo_t frameInfo; |
||||||
|
int compressionLevel; </b>/* 0: default (fast mode); values > LZ4HC_CLEVEL_MAX count as LZ4HC_CLEVEL_MAX; values < 0 trigger "fast acceleration" */<b> |
||||||
|
unsigned autoFlush; </b>/* 1: always flush; reduces usage of internal buffers */<b> |
||||||
|
unsigned favorDecSpeed; </b>/* 1: parser favors decompression speed vs compression ratio. Only works for high compression modes (>= LZ4HC_CLEVEL_OPT_MIN) */ /* v1.8.2+ */<b> |
||||||
|
unsigned reserved[3]; </b>/* must be zero for forward compatibility */<b> |
||||||
|
} LZ4F_preferences_t; |
||||||
|
</b><p> makes it possible to supply advanced compression instructions to streaming interface. |
||||||
|
Structure must be first init to 0, using memset() or LZ4F_INIT_PREFERENCES, |
||||||
|
setting all parameters to default. |
||||||
|
All reserved fields must be set to zero. |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter5"></a><h2>Simple compression function</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr); |
||||||
|
</b><p> Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences. |
||||||
|
`preferencesPtr` is optional. It can be replaced by NULL, in which case, the function will assume default preferences. |
||||||
|
Note : this result is only usable with LZ4F_compressFrame(). |
||||||
|
It may also be relevant to LZ4F_compressUpdate() _only if_ no flush() operation is ever performed. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity, |
||||||
|
const void* srcBuffer, size_t srcSize, |
||||||
|
const LZ4F_preferences_t* preferencesPtr); |
||||||
|
</b><p> Compress an entire srcBuffer into a valid LZ4 frame. |
||||||
|
dstCapacity MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr). |
||||||
|
The LZ4F_preferences_t structure is optional : you can provide NULL as argument. All preferences will be set to default. |
||||||
|
@return : number of bytes written into dstBuffer. |
||||||
|
or an error code if it fails (can be tested using LZ4F_isError()) |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter6"></a><h2>Advanced compression functions</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>typedef struct { |
||||||
|
unsigned stableSrc; </b>/* 1 == src content will remain present on future calls to LZ4F_compress(); skip copying src content within tmp buffer */<b> |
||||||
|
unsigned reserved[3]; |
||||||
|
} LZ4F_compressOptions_t; |
||||||
|
</b></pre><BR> |
||||||
|
<a name="Chapter7"></a><h2>Resource Management</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_cctx** cctxPtr, unsigned version); |
||||||
|
LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx); |
||||||
|
</b><p> The first thing to do is to create a compressionContext object, |
||||||
|
which will keep track of operation state during streaming compression. |
||||||
|
This is achieved using LZ4F_createCompressionContext(), which takes as argument a version, |
||||||
|
and a pointer to LZ4F_cctx*, to write the resulting pointer into. |
||||||
|
@version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL. |
||||||
|
The function provides a pointer to a fully allocated LZ4F_cctx object. |
||||||
|
@cctxPtr MUST be != NULL. |
||||||
|
If @return != zero, context creation failed. |
||||||
|
A created compression context can be employed multiple times for consecutive streaming operations. |
||||||
|
Once all streaming compression jobs are completed, |
||||||
|
the state object can be released using LZ4F_freeCompressionContext(). |
||||||
|
Note1 : LZ4F_freeCompressionContext() is always successful. Its return value can be ignored. |
||||||
|
Note2 : LZ4F_freeCompressionContext() works fine with NULL input pointers (do nothing). |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter8"></a><h2>Compression</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_compressBegin(LZ4F_cctx* cctx, |
||||||
|
void* dstBuffer, size_t dstCapacity, |
||||||
|
const LZ4F_preferences_t* prefsPtr); |
||||||
|
</b><p> will write the frame header into dstBuffer. |
||||||
|
dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. |
||||||
|
`prefsPtr` is optional : you can provide NULL as argument, all preferences will then be set to default. |
||||||
|
@return : number of bytes written into dstBuffer for the header |
||||||
|
or an error code (which can be tested using LZ4F_isError()) |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* prefsPtr); |
||||||
|
</b><p> Provides minimum dstCapacity required to guarantee success of |
||||||
|
LZ4F_compressUpdate(), given a srcSize and preferences, for a worst case scenario. |
||||||
|
When srcSize==0, LZ4F_compressBound() provides an upper bound for LZ4F_flush() and LZ4F_compressEnd() instead. |
||||||
|
Note that the result is only valid for a single invocation of LZ4F_compressUpdate(). |
||||||
|
When invoking LZ4F_compressUpdate() multiple times, |
||||||
|
if the output buffer is gradually filled up instead of emptied and re-used from its start, |
||||||
|
one must check if there is enough remaining capacity before each invocation, using LZ4F_compressBound(). |
||||||
|
@return is always the same for a srcSize and prefsPtr. |
||||||
|
prefsPtr is optional : when NULL is provided, preferences will be set to cover worst case scenario. |
||||||
|
tech details : |
||||||
|
@return if automatic flushing is not enabled, includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes. |
||||||
|
It also includes frame footer (ending + checksum), since it might be generated by LZ4F_compressEnd(). |
||||||
|
@return doesn't include frame header, as it was already generated by LZ4F_compressBegin(). |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_compressUpdate(LZ4F_cctx* cctx, |
||||||
|
void* dstBuffer, size_t dstCapacity, |
||||||
|
const void* srcBuffer, size_t srcSize, |
||||||
|
const LZ4F_compressOptions_t* cOptPtr); |
||||||
|
</b><p> LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. |
||||||
|
Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations. |
||||||
|
This value is provided by LZ4F_compressBound(). |
||||||
|
If this condition is not respected, LZ4F_compress() will fail (result is an errorCode). |
||||||
|
After an error, the state is left in a UB state, and must be re-initialized or freed. |
||||||
|
If previously an uncompressed block was written, buffered data is flushed |
||||||
|
before appending compressed data is continued. |
||||||
|
`cOptPtr` is optional : NULL can be provided, in which case all options are set to default. |
||||||
|
@return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). |
||||||
|
or an error code if it fails (which can be tested using LZ4F_isError()) |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_flush(LZ4F_cctx* cctx, |
||||||
|
void* dstBuffer, size_t dstCapacity, |
||||||
|
const LZ4F_compressOptions_t* cOptPtr); |
||||||
|
</b><p> When data must be generated and sent immediately, without waiting for a block to be completely filled, |
||||||
|
it's possible to call LZ4_flush(). It will immediately compress any data buffered within cctx. |
||||||
|
`dstCapacity` must be large enough to ensure the operation will be successful. |
||||||
|
`cOptPtr` is optional : it's possible to provide NULL, all options will be set to default. |
||||||
|
@return : nb of bytes written into dstBuffer (can be zero, when there is no data stored within cctx) |
||||||
|
or an error code if it fails (which can be tested using LZ4F_isError()) |
||||||
|
Note : LZ4F_flush() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr). |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_compressEnd(LZ4F_cctx* cctx, |
||||||
|
void* dstBuffer, size_t dstCapacity, |
||||||
|
const LZ4F_compressOptions_t* cOptPtr); |
||||||
|
</b><p> To properly finish an LZ4 frame, invoke LZ4F_compressEnd(). |
||||||
|
It will flush whatever data remained within `cctx` (like LZ4_flush()) |
||||||
|
and properly finalize the frame, with an endMark and a checksum. |
||||||
|
`cOptPtr` is optional : NULL can be provided, in which case all options will be set to default. |
||||||
|
@return : nb of bytes written into dstBuffer, necessarily >= 4 (endMark), |
||||||
|
or an error code if it fails (which can be tested using LZ4F_isError()) |
||||||
|
Note : LZ4F_compressEnd() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr). |
||||||
|
A successful call to LZ4F_compressEnd() makes `cctx` available again for another compression task. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter9"></a><h2>Decompression functions</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>typedef struct { |
||||||
|
unsigned stableDst; /* pledges that last 64KB decompressed data will remain available unmodified between invocations. |
||||||
|
* This optimization skips storage operations in tmp buffers. */ |
||||||
|
unsigned skipChecksums; /* disable checksum calculation and verification, even when one is present in frame, to save CPU time. |
||||||
|
* Setting this option to 1 once disables all checksums for the rest of the frame. */ |
||||||
|
unsigned reserved1; </b>/* must be set to zero for forward compatibility */<b> |
||||||
|
unsigned reserved0; </b>/* idem */<b> |
||||||
|
} LZ4F_decompressOptions_t; |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx** dctxPtr, unsigned version); |
||||||
|
LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx); |
||||||
|
</b><p> Create an LZ4F_dctx object, to track all decompression operations. |
||||||
|
@version provided MUST be LZ4F_VERSION. |
||||||
|
@dctxPtr MUST be valid. |
||||||
|
The function fills @dctxPtr with the value of a pointer to an allocated and initialized LZ4F_dctx object. |
||||||
|
The @return is an errorCode, which can be tested using LZ4F_isError(). |
||||||
|
dctx memory can be released using LZ4F_freeDecompressionContext(); |
||||||
|
Result of LZ4F_freeDecompressionContext() indicates current state of decompressionContext when being released. |
||||||
|
That is, it should be == 0 if decompression has been completed fully and correctly. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter10"></a><h2>Streaming decompression functions</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>size_t LZ4F_headerSize(const void* src, size_t srcSize); |
||||||
|
</b><p> Provide the header size of a frame starting at `src`. |
||||||
|
`srcSize` must be >= LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH, |
||||||
|
which is enough to decode the header length. |
||||||
|
@return : size of frame header |
||||||
|
or an error code, which can be tested using LZ4F_isError() |
||||||
|
note : Frame header size is variable, but is guaranteed to be |
||||||
|
>= LZ4F_HEADER_SIZE_MIN bytes, and <= LZ4F_HEADER_SIZE_MAX bytes. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>size_t |
||||||
|
LZ4F_getFrameInfo(LZ4F_dctx* dctx, |
||||||
|
LZ4F_frameInfo_t* frameInfoPtr, |
||||||
|
const void* srcBuffer, size_t* srcSizePtr); |
||||||
|
</b><p> This function extracts frame parameters (max blockSize, dictID, etc.). |
||||||
|
Its usage is optional: user can also invoke LZ4F_decompress() directly. |
||||||
|
|
||||||
|
Extracted information will fill an existing LZ4F_frameInfo_t structure. |
||||||
|
This can be useful for allocation and dictionary identification purposes. |
||||||
|
|
||||||
|
LZ4F_getFrameInfo() can work in the following situations : |
||||||
|
|
||||||
|
1) At the beginning of a new frame, before any invocation of LZ4F_decompress(). |
||||||
|
It will decode header from `srcBuffer`, |
||||||
|
consuming the header and starting the decoding process. |
||||||
|
|
||||||
|
Input size must be large enough to contain the full frame header. |
||||||
|
Frame header size can be known beforehand by LZ4F_headerSize(). |
||||||
|
Frame header size is variable, but is guaranteed to be >= LZ4F_HEADER_SIZE_MIN bytes, |
||||||
|
and not more than <= LZ4F_HEADER_SIZE_MAX bytes. |
||||||
|
Hence, blindly providing LZ4F_HEADER_SIZE_MAX bytes or more will always work. |
||||||
|
It's allowed to provide more input data than the header size, |
||||||
|
LZ4F_getFrameInfo() will only consume the header. |
||||||
|
|
||||||
|
If input size is not large enough, |
||||||
|
aka if it's smaller than header size, |
||||||
|
function will fail and return an error code. |
||||||
|
|
||||||
|
2) After decoding has been started, |
||||||
|
it's possible to invoke LZ4F_getFrameInfo() anytime |
||||||
|
to extract already decoded frame parameters stored within dctx. |
||||||
|
|
||||||
|
Note that, if decoding has barely started, |
||||||
|
and not yet read enough information to decode the header, |
||||||
|
LZ4F_getFrameInfo() will fail. |
||||||
|
|
||||||
|
The number of bytes consumed from srcBuffer will be updated in *srcSizePtr (necessarily <= original value). |
||||||
|
LZ4F_getFrameInfo() only consumes bytes when decoding has not yet started, |
||||||
|
and when decoding the header has been successful. |
||||||
|
Decompression must then resume from (srcBuffer + *srcSizePtr). |
||||||
|
|
||||||
|
@return : a hint about how many srcSize bytes LZ4F_decompress() expects for next call, |
||||||
|
or an error code which can be tested using LZ4F_isError(). |
||||||
|
note 1 : in case of error, dctx is not modified. Decoding operation can resume from beginning safely. |
||||||
|
note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>size_t |
||||||
|
LZ4F_decompress(LZ4F_dctx* dctx, |
||||||
|
void* dstBuffer, size_t* dstSizePtr, |
||||||
|
const void* srcBuffer, size_t* srcSizePtr, |
||||||
|
const LZ4F_decompressOptions_t* dOptPtr); |
||||||
|
</b><p> Call this function repetitively to regenerate data compressed in `srcBuffer`. |
||||||
|
|
||||||
|
The function requires a valid dctx state. |
||||||
|
It will read up to *srcSizePtr bytes from srcBuffer, |
||||||
|
and decompress data into dstBuffer, of capacity *dstSizePtr. |
||||||
|
|
||||||
|
The nb of bytes consumed from srcBuffer will be written into *srcSizePtr (necessarily <= original value). |
||||||
|
The nb of bytes decompressed into dstBuffer will be written into *dstSizePtr (necessarily <= original value). |
||||||
|
|
||||||
|
The function does not necessarily read all input bytes, so always check value in *srcSizePtr. |
||||||
|
Unconsumed source data must be presented again in subsequent invocations. |
||||||
|
|
||||||
|
`dstBuffer` can freely change between each consecutive function invocation. |
||||||
|
`dstBuffer` content will be overwritten. |
||||||
|
|
||||||
|
@return : an hint of how many `srcSize` bytes LZ4F_decompress() expects for next call. |
||||||
|
Schematically, it's the size of the current (or remaining) compressed block + header of next block. |
||||||
|
Respecting the hint provides some small speed benefit, because it skips intermediate buffers. |
||||||
|
This is just a hint though, it's always possible to provide any srcSize. |
||||||
|
|
||||||
|
When a frame is fully decoded, @return will be 0 (no more data expected). |
||||||
|
When provided with more bytes than necessary to decode a frame, |
||||||
|
LZ4F_decompress() will stop reading exactly at end of current frame, and @return 0. |
||||||
|
|
||||||
|
If decompression failed, @return is an error code, which can be tested using LZ4F_isError(). |
||||||
|
After a decompression error, the `dctx` context is not resumable. |
||||||
|
Use LZ4F_resetDecompressionContext() to return to clean state. |
||||||
|
|
||||||
|
After a frame is fully decoded, dctx can be used again to decompress another frame. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>void LZ4F_resetDecompressionContext(LZ4F_dctx* dctx); </b>/* always successful */<b> |
||||||
|
</b><p> In case of an error, the context is left in "undefined" state. |
||||||
|
In which case, it's necessary to reset it, before re-using it. |
||||||
|
This method can also be used to abruptly stop any unfinished decompression, |
||||||
|
and start a new one using same context resources. |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM) |
||||||
|
_LZ4F_dummy_error_enum_for_c89_never_used } LZ4F_errorCodes; |
||||||
|
</b></pre><BR> |
||||||
|
<pre><b>LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(LZ4F_blockSizeID_t blockSizeID); |
||||||
|
</b><p> Return, in scalar format (size_t), |
||||||
|
the maximum block size associated with blockSizeID. |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4FLIB_STATIC_API size_t |
||||||
|
LZ4F_uncompressedUpdate(LZ4F_cctx* cctx, |
||||||
|
void* dstBuffer, size_t dstCapacity, |
||||||
|
const void* srcBuffer, size_t srcSize, |
||||||
|
const LZ4F_compressOptions_t* cOptPtr); |
||||||
|
</b><p> LZ4F_uncompressedUpdate() can be called repetitively to add as much data uncompressed data as necessary. |
||||||
|
Important rule: dstCapacity MUST be large enough to store the entire source buffer as |
||||||
|
no compression is done for this operation |
||||||
|
If this condition is not respected, LZ4F_uncompressedUpdate() will fail (result is an errorCode). |
||||||
|
After an error, the state is left in a UB state, and must be re-initialized or freed. |
||||||
|
If previously a compressed block was written, buffered data is flushed |
||||||
|
before appending uncompressed data is continued. |
||||||
|
This is only supported when LZ4F_blockIndependent is used |
||||||
|
`cOptPtr` is optional : NULL can be provided, in which case all options are set to default. |
||||||
|
@return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). |
||||||
|
or an error code if it fails (which can be tested using LZ4F_isError()) |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<a name="Chapter11"></a><h2>Bulk processing dictionary API</h2><pre></pre> |
||||||
|
|
||||||
|
<pre><b>LZ4FLIB_STATIC_API LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize); |
||||||
|
LZ4FLIB_STATIC_API void LZ4F_freeCDict(LZ4F_CDict* CDict); |
||||||
|
</b><p> When compressing multiple messages / blocks using the same dictionary, it's recommended to load it just once. |
||||||
|
LZ4_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. |
||||||
|
LZ4_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. |
||||||
|
`dictBuffer` can be released after LZ4_CDict creation, since its content is copied within CDict |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4FLIB_STATIC_API size_t |
||||||
|
LZ4F_compressFrame_usingCDict(LZ4F_cctx* cctx, |
||||||
|
void* dst, size_t dstCapacity, |
||||||
|
const void* src, size_t srcSize, |
||||||
|
const LZ4F_CDict* cdict, |
||||||
|
const LZ4F_preferences_t* preferencesPtr); |
||||||
|
</b><p> Compress an entire srcBuffer into a valid LZ4 frame using a digested Dictionary. |
||||||
|
cctx must point to a context created by LZ4F_createCompressionContext(). |
||||||
|
If cdict==NULL, compress without a dictionary. |
||||||
|
dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr). |
||||||
|
If this condition is not respected, function will fail (@return an errorCode). |
||||||
|
The LZ4F_preferences_t structure is optional : you may provide NULL as argument, |
||||||
|
but it's not recommended, as it's the only way to provide dictID in the frame header. |
||||||
|
@return : number of bytes written into dstBuffer. |
||||||
|
or an error code if it fails (can be tested using LZ4F_isError()) |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4FLIB_STATIC_API size_t |
||||||
|
LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctx, |
||||||
|
void* dstBuffer, size_t dstCapacity, |
||||||
|
const LZ4F_CDict* cdict, |
||||||
|
const LZ4F_preferences_t* prefsPtr); |
||||||
|
</b><p> Inits streaming dictionary compression, and writes the frame header into dstBuffer. |
||||||
|
dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. |
||||||
|
`prefsPtr` is optional : you may provide NULL as argument, |
||||||
|
however, it's the only way to provide dictID in the frame header. |
||||||
|
@return : number of bytes written into dstBuffer for the header, |
||||||
|
or an error code (which can be tested using LZ4F_isError()) |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>LZ4FLIB_STATIC_API size_t |
||||||
|
LZ4F_decompress_usingDict(LZ4F_dctx* dctxPtr, |
||||||
|
void* dstBuffer, size_t* dstSizePtr, |
||||||
|
const void* srcBuffer, size_t* srcSizePtr, |
||||||
|
const void* dict, size_t dictSize, |
||||||
|
const LZ4F_decompressOptions_t* decompressOptionsPtr); |
||||||
|
</b><p> Same as LZ4F_decompress(), using a predefined dictionary. |
||||||
|
Dictionary is used "in place", without any preprocessing. |
||||||
|
It must remain accessible throughout the entire frame decoding. |
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
<pre><b>typedef void* (*LZ4F_AllocFunction) (void* opaqueState, size_t size); |
||||||
|
typedef void* (*LZ4F_CallocFunction) (void* opaqueState, size_t size); |
||||||
|
typedef void (*LZ4F_FreeFunction) (void* opaqueState, void* address); |
||||||
|
typedef struct { |
||||||
|
LZ4F_AllocFunction customAlloc; |
||||||
|
LZ4F_CallocFunction customCalloc; </b>/* optional; when not defined, uses customAlloc + memset */<b> |
||||||
|
LZ4F_FreeFunction customFree; |
||||||
|
void* opaqueState; |
||||||
|
} LZ4F_CustomMem; |
||||||
|
static |
||||||
|
#ifdef __GNUC__ |
||||||
|
__attribute__((__unused__)) |
||||||
|
#endif |
||||||
|
LZ4F_CustomMem const LZ4F_defaultCMem = { NULL, NULL, NULL, NULL }; </b>/**< this constant defers to stdlib's functions */<b> |
||||||
|
</b><p> These prototypes make it possible to pass custom allocation/free functions. |
||||||
|
LZ4F_customMem is provided at state creation time, using LZ4F_create*_advanced() listed below. |
||||||
|
All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones. |
||||||
|
|
||||||
|
</p></pre><BR> |
||||||
|
|
||||||
|
</html> |
||||||
|
</body> |
@ -0,0 +1,11 @@ |
|||||||
|
/Makefile.lz4* |
||||||
|
/printVersion |
||||||
|
/doubleBuffer |
||||||
|
/dictionaryRandomAccess |
||||||
|
/ringBuffer |
||||||
|
/ringBufferHC |
||||||
|
/lineCompress |
||||||
|
/frameCompress |
||||||
|
/fileCompress |
||||||
|
/simpleBuffer |
||||||
|
/*.exe |
@ -0,0 +1,339 @@ |
|||||||
|
GNU GENERAL PUBLIC LICENSE |
||||||
|
Version 2, June 1991 |
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc., |
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
Everyone is permitted to copy and distribute verbatim copies |
||||||
|
of this license document, but changing it is not allowed. |
||||||
|
|
||||||
|
Preamble |
||||||
|
|
||||||
|
The licenses for most software are designed to take away your |
||||||
|
freedom to share and change it. By contrast, the GNU General Public |
||||||
|
License is intended to guarantee your freedom to share and change free |
||||||
|
software--to make sure the software is free for all its users. This |
||||||
|
General Public License applies to most of the Free Software |
||||||
|
Foundation's software and to any other program whose authors commit to |
||||||
|
using it. (Some other Free Software Foundation software is covered by |
||||||
|
the GNU Lesser General Public License instead.) You can apply it to |
||||||
|
your programs, too. |
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not |
||||||
|
price. Our General Public Licenses are designed to make sure that you |
||||||
|
have the freedom to distribute copies of free software (and charge for |
||||||
|
this service if you wish), that you receive source code or can get it |
||||||
|
if you want it, that you can change the software or use pieces of it |
||||||
|
in new free programs; and that you know you can do these things. |
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid |
||||||
|
anyone to deny you these rights or to ask you to surrender the rights. |
||||||
|
These restrictions translate to certain responsibilities for you if you |
||||||
|
distribute copies of the software, or if you modify it. |
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether |
||||||
|
gratis or for a fee, you must give the recipients all the rights that |
||||||
|
you have. You must make sure that they, too, receive or can get the |
||||||
|
source code. And you must show them these terms so they know their |
||||||
|
rights. |
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and |
||||||
|
(2) offer you this license which gives you legal permission to copy, |
||||||
|
distribute and/or modify the software. |
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain |
||||||
|
that everyone understands that there is no warranty for this free |
||||||
|
software. If the software is modified by someone else and passed on, we |
||||||
|
want its recipients to know that what they have is not the original, so |
||||||
|
that any problems introduced by others will not reflect on the original |
||||||
|
authors' reputations. |
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software |
||||||
|
patents. We wish to avoid the danger that redistributors of a free |
||||||
|
program will individually obtain patent licenses, in effect making the |
||||||
|
program proprietary. To prevent this, we have made it clear that any |
||||||
|
patent must be licensed for everyone's free use or not licensed at all. |
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and |
||||||
|
modification follow. |
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE |
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains |
||||||
|
a notice placed by the copyright holder saying it may be distributed |
||||||
|
under the terms of this General Public License. The "Program", below, |
||||||
|
refers to any such program or work, and a "work based on the Program" |
||||||
|
means either the Program or any derivative work under copyright law: |
||||||
|
that is to say, a work containing the Program or a portion of it, |
||||||
|
either verbatim or with modifications and/or translated into another |
||||||
|
language. (Hereinafter, translation is included without limitation in |
||||||
|
the term "modification".) Each licensee is addressed as "you". |
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not |
||||||
|
covered by this License; they are outside its scope. The act of |
||||||
|
running the Program is not restricted, and the output from the Program |
||||||
|
is covered only if its contents constitute a work based on the |
||||||
|
Program (independent of having been made by running the Program). |
||||||
|
Whether that is true depends on what the Program does. |
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's |
||||||
|
source code as you receive it, in any medium, provided that you |
||||||
|
conspicuously and appropriately publish on each copy an appropriate |
||||||
|
copyright notice and disclaimer of warranty; keep intact all the |
||||||
|
notices that refer to this License and to the absence of any warranty; |
||||||
|
and give any other recipients of the Program a copy of this License |
||||||
|
along with the Program. |
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and |
||||||
|
you may at your option offer warranty protection in exchange for a fee. |
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion |
||||||
|
of it, thus forming a work based on the Program, and copy and |
||||||
|
distribute such modifications or work under the terms of Section 1 |
||||||
|
above, provided that you also meet all of these conditions: |
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices |
||||||
|
stating that you changed the files and the date of any change. |
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in |
||||||
|
whole or in part contains or is derived from the Program or any |
||||||
|
part thereof, to be licensed as a whole at no charge to all third |
||||||
|
parties under the terms of this License. |
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively |
||||||
|
when run, you must cause it, when started running for such |
||||||
|
interactive use in the most ordinary way, to print or display an |
||||||
|
announcement including an appropriate copyright notice and a |
||||||
|
notice that there is no warranty (or else, saying that you provide |
||||||
|
a warranty) and that users may redistribute the program under |
||||||
|
these conditions, and telling the user how to view a copy of this |
||||||
|
License. (Exception: if the Program itself is interactive but |
||||||
|
does not normally print such an announcement, your work based on |
||||||
|
the Program is not required to print an announcement.) |
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If |
||||||
|
identifiable sections of that work are not derived from the Program, |
||||||
|
and can be reasonably considered independent and separate works in |
||||||
|
themselves, then this License, and its terms, do not apply to those |
||||||
|
sections when you distribute them as separate works. But when you |
||||||
|
distribute the same sections as part of a whole which is a work based |
||||||
|
on the Program, the distribution of the whole must be on the terms of |
||||||
|
this License, whose permissions for other licensees extend to the |
||||||
|
entire whole, and thus to each and every part regardless of who wrote it. |
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest |
||||||
|
your rights to work written entirely by you; rather, the intent is to |
||||||
|
exercise the right to control the distribution of derivative or |
||||||
|
collective works based on the Program. |
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program |
||||||
|
with the Program (or with a work based on the Program) on a volume of |
||||||
|
a storage or distribution medium does not bring the other work under |
||||||
|
the scope of this License. |
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it, |
||||||
|
under Section 2) in object code or executable form under the terms of |
||||||
|
Sections 1 and 2 above provided that you also do one of the following: |
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable |
||||||
|
source code, which must be distributed under the terms of Sections |
||||||
|
1 and 2 above on a medium customarily used for software interchange; or, |
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three |
||||||
|
years, to give any third party, for a charge no more than your |
||||||
|
cost of physically performing source distribution, a complete |
||||||
|
machine-readable copy of the corresponding source code, to be |
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium |
||||||
|
customarily used for software interchange; or, |
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer |
||||||
|
to distribute corresponding source code. (This alternative is |
||||||
|
allowed only for noncommercial distribution and only if you |
||||||
|
received the program in object code or executable form with such |
||||||
|
an offer, in accord with Subsection b above.) |
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for |
||||||
|
making modifications to it. For an executable work, complete source |
||||||
|
code means all the source code for all modules it contains, plus any |
||||||
|
associated interface definition files, plus the scripts used to |
||||||
|
control compilation and installation of the executable. However, as a |
||||||
|
special exception, the source code distributed need not include |
||||||
|
anything that is normally distributed (in either source or binary |
||||||
|
form) with the major components (compiler, kernel, and so on) of the |
||||||
|
operating system on which the executable runs, unless that component |
||||||
|
itself accompanies the executable. |
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering |
||||||
|
access to copy from a designated place, then offering equivalent |
||||||
|
access to copy the source code from the same place counts as |
||||||
|
distribution of the source code, even though third parties are not |
||||||
|
compelled to copy the source along with the object code. |
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program |
||||||
|
except as expressly provided under this License. Any attempt |
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is |
||||||
|
void, and will automatically terminate your rights under this License. |
||||||
|
However, parties who have received copies, or rights, from you under |
||||||
|
this License will not have their licenses terminated so long as such |
||||||
|
parties remain in full compliance. |
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not |
||||||
|
signed it. However, nothing else grants you permission to modify or |
||||||
|
distribute the Program or its derivative works. These actions are |
||||||
|
prohibited by law if you do not accept this License. Therefore, by |
||||||
|
modifying or distributing the Program (or any work based on the |
||||||
|
Program), you indicate your acceptance of this License to do so, and |
||||||
|
all its terms and conditions for copying, distributing or modifying |
||||||
|
the Program or works based on it. |
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the |
||||||
|
Program), the recipient automatically receives a license from the |
||||||
|
original licensor to copy, distribute or modify the Program subject to |
||||||
|
these terms and conditions. You may not impose any further |
||||||
|
restrictions on the recipients' exercise of the rights granted herein. |
||||||
|
You are not responsible for enforcing compliance by third parties to |
||||||
|
this License. |
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent |
||||||
|
infringement or for any other reason (not limited to patent issues), |
||||||
|
conditions are imposed on you (whether by court order, agreement or |
||||||
|
otherwise) that contradict the conditions of this License, they do not |
||||||
|
excuse you from the conditions of this License. If you cannot |
||||||
|
distribute so as to satisfy simultaneously your obligations under this |
||||||
|
License and any other pertinent obligations, then as a consequence you |
||||||
|
may not distribute the Program at all. For example, if a patent |
||||||
|
license would not permit royalty-free redistribution of the Program by |
||||||
|
all those who receive copies directly or indirectly through you, then |
||||||
|
the only way you could satisfy both it and this License would be to |
||||||
|
refrain entirely from distribution of the Program. |
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under |
||||||
|
any particular circumstance, the balance of the section is intended to |
||||||
|
apply and the section as a whole is intended to apply in other |
||||||
|
circumstances. |
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any |
||||||
|
patents or other property right claims or to contest validity of any |
||||||
|
such claims; this section has the sole purpose of protecting the |
||||||
|
integrity of the free software distribution system, which is |
||||||
|
implemented by public license practices. Many people have made |
||||||
|
generous contributions to the wide range of software distributed |
||||||
|
through that system in reliance on consistent application of that |
||||||
|
system; it is up to the author/donor to decide if he or she is willing |
||||||
|
to distribute software through any other system and a licensee cannot |
||||||
|
impose that choice. |
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to |
||||||
|
be a consequence of the rest of this License. |
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in |
||||||
|
certain countries either by patents or by copyrighted interfaces, the |
||||||
|
original copyright holder who places the Program under this License |
||||||
|
may add an explicit geographical distribution limitation excluding |
||||||
|
those countries, so that distribution is permitted only in or among |
||||||
|
countries not thus excluded. In such case, this License incorporates |
||||||
|
the limitation as if written in the body of this License. |
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions |
||||||
|
of the General Public License from time to time. Such new versions will |
||||||
|
be similar in spirit to the present version, but may differ in detail to |
||||||
|
address new problems or concerns. |
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program |
||||||
|
specifies a version number of this License which applies to it and "any |
||||||
|
later version", you have the option of following the terms and conditions |
||||||
|
either of that version or of any later version published by the Free |
||||||
|
Software Foundation. If the Program does not specify a version number of |
||||||
|
this License, you may choose any version ever published by the Free Software |
||||||
|
Foundation. |
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free |
||||||
|
programs whose distribution conditions are different, write to the author |
||||||
|
to ask for permission. For software which is copyrighted by the Free |
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes |
||||||
|
make exceptions for this. Our decision will be guided by the two goals |
||||||
|
of preserving the free status of all derivatives of our free software and |
||||||
|
of promoting the sharing and reuse of software generally. |
||||||
|
|
||||||
|
NO WARRANTY |
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
||||||
|
REPAIR OR CORRECTION. |
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
||||||
|
POSSIBILITY OF SUCH DAMAGES. |
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS |
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs |
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest |
||||||
|
possible use to the public, the best way to achieve this is to make it |
||||||
|
free software which everyone can redistribute and change under these terms. |
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest |
||||||
|
to attach them to the start of each source file to most effectively |
||||||
|
convey the exclusion of warranty; and each file should have at least |
||||||
|
the "copyright" line and a pointer to where the full notice is found. |
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.> |
||||||
|
Copyright (C) <year> <name of author> |
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation; either version 2 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along |
||||||
|
with this program; if not, write to the Free Software Foundation, Inc., |
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail. |
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this |
||||||
|
when it starts in an interactive mode: |
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author |
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
||||||
|
This is free software, and you are welcome to redistribute it |
||||||
|
under certain conditions; type `show c' for details. |
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate |
||||||
|
parts of the General Public License. Of course, the commands you use may |
||||||
|
be called something other than `show w' and `show c'; they could even be |
||||||
|
mouse-clicks or menu items--whatever suits your program. |
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your |
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if |
||||||
|
necessary. Here is a sample; alter the names: |
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker. |
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989 |
||||||
|
Ty Coon, President of Vice |
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into |
||||||
|
proprietary programs. If your program is a subroutine library, you may |
||||||
|
consider it more useful to permit linking proprietary applications with the |
||||||
|
library. If this is what you want to do, use the GNU Lesser General |
||||||
|
Public License instead of this License. |
@ -0,0 +1,232 @@ |
|||||||
|
// LZ4 HC streaming API example : ring buffer
|
||||||
|
// Based on a previous example by Takayuki Matsuoka
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************
|
||||||
|
* Compiler Options |
||||||
|
**************************************/ |
||||||
|
#if defined(_MSC_VER) && (_MSC_VER <= 1800) /* Visual Studio <= 2013 */ |
||||||
|
# define _CRT_SECURE_NO_WARNINGS |
||||||
|
# define snprintf sprintf_s |
||||||
|
#endif |
||||||
|
|
||||||
|
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) |
||||||
|
#ifdef __GNUC__ |
||||||
|
# pragma GCC diagnostic ignored "-Wmissing-braces" /* GCC bug 53119 : doesn't accept { 0 } as initializer (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119) */ |
||||||
|
#endif |
||||||
|
|
||||||
|
|
||||||
|
/**************************************
|
||||||
|
* Includes |
||||||
|
**************************************/ |
||||||
|
#include "lz4hc.h" |
||||||
|
#include "lz4.h" |
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
#include <stdint.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
#include <assert.h> |
||||||
|
|
||||||
|
enum { |
||||||
|
MESSAGE_MAX_BYTES = 1024, |
||||||
|
RING_BUFFER_BYTES = 1024 * 8 + MESSAGE_MAX_BYTES, |
||||||
|
DEC_BUFFER_BYTES = RING_BUFFER_BYTES + MESSAGE_MAX_BYTES // Intentionally larger to test unsynchronized ring buffers
|
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
size_t write_int32(FILE* fp, int32_t i) { |
||||||
|
return fwrite(&i, sizeof(i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t write_bin(FILE* fp, const void* array, int arrayBytes) { |
||||||
|
assert(arrayBytes >= 0); |
||||||
|
return fwrite(array, 1, (size_t)arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t read_int32(FILE* fp, int32_t* i) { |
||||||
|
return fread(i, sizeof(*i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t read_bin(FILE* fp, void* array, int arrayBytes) { |
||||||
|
assert(arrayBytes >= 0); |
||||||
|
return fread(array, 1, (size_t)arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_compress(FILE* outFp, FILE* inpFp) |
||||||
|
{ |
||||||
|
LZ4_streamHC_t lz4Stream_body = { 0 }; |
||||||
|
LZ4_streamHC_t* lz4Stream = &lz4Stream_body; |
||||||
|
|
||||||
|
static char inpBuf[RING_BUFFER_BYTES]; |
||||||
|
int inpOffset = 0; |
||||||
|
|
||||||
|
for(;;) { |
||||||
|
// Read random length ([1,MESSAGE_MAX_BYTES]) data to the ring buffer.
|
||||||
|
char* const inpPtr = &inpBuf[inpOffset]; |
||||||
|
const int randomLength = (rand() % MESSAGE_MAX_BYTES) + 1; |
||||||
|
const int inpBytes = (int) read_bin(inpFp, inpPtr, randomLength); |
||||||
|
if (0 == inpBytes) break; |
||||||
|
|
||||||
|
#define CMPBUFSIZE (LZ4_COMPRESSBOUND(MESSAGE_MAX_BYTES)) |
||||||
|
{ char cmpBuf[CMPBUFSIZE]; |
||||||
|
const int cmpBytes = LZ4_compress_HC_continue(lz4Stream, inpPtr, cmpBuf, inpBytes, CMPBUFSIZE); |
||||||
|
|
||||||
|
if(cmpBytes <= 0) break; |
||||||
|
write_int32(outFp, cmpBytes); |
||||||
|
write_bin(outFp, cmpBuf, cmpBytes); |
||||||
|
|
||||||
|
inpOffset += inpBytes; |
||||||
|
|
||||||
|
// Wraparound the ringbuffer offset
|
||||||
|
if(inpOffset >= RING_BUFFER_BYTES - MESSAGE_MAX_BYTES) |
||||||
|
inpOffset = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
write_int32(outFp, 0); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_decompress(FILE* outFp, FILE* inpFp) |
||||||
|
{ |
||||||
|
static char decBuf[DEC_BUFFER_BYTES]; |
||||||
|
int decOffset = 0; |
||||||
|
LZ4_streamDecode_t lz4StreamDecode_body = { 0 }; |
||||||
|
LZ4_streamDecode_t* lz4StreamDecode = &lz4StreamDecode_body; |
||||||
|
|
||||||
|
for(;;) { |
||||||
|
int cmpBytes = 0; |
||||||
|
char cmpBuf[CMPBUFSIZE]; |
||||||
|
|
||||||
|
{ const size_t r0 = read_int32(inpFp, &cmpBytes); |
||||||
|
size_t r1; |
||||||
|
if(r0 != 1 || cmpBytes <= 0) |
||||||
|
break; |
||||||
|
|
||||||
|
r1 = read_bin(inpFp, cmpBuf, cmpBytes); |
||||||
|
if(r1 != (size_t) cmpBytes) |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
{ char* const decPtr = &decBuf[decOffset]; |
||||||
|
const int decBytes = LZ4_decompress_safe_continue( |
||||||
|
lz4StreamDecode, cmpBuf, decPtr, cmpBytes, MESSAGE_MAX_BYTES); |
||||||
|
if(decBytes <= 0) |
||||||
|
break; |
||||||
|
|
||||||
|
decOffset += decBytes; |
||||||
|
write_bin(outFp, decPtr, decBytes); |
||||||
|
|
||||||
|
// Wraparound the ringbuffer offset
|
||||||
|
if(decOffset >= DEC_BUFFER_BYTES - MESSAGE_MAX_BYTES) |
||||||
|
decOffset = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// Compare 2 files content
|
||||||
|
// return 0 if identical
|
||||||
|
// return ByteNb>0 if different
|
||||||
|
size_t compare(FILE* f0, FILE* f1) |
||||||
|
{ |
||||||
|
size_t result = 1; |
||||||
|
|
||||||
|
for (;;) { |
||||||
|
char b0[65536]; |
||||||
|
char b1[65536]; |
||||||
|
const size_t r0 = fread(b0, 1, sizeof(b0), f0); |
||||||
|
const size_t r1 = fread(b1, 1, sizeof(b1), f1); |
||||||
|
|
||||||
|
if ((r0==0) && (r1==0)) return 0; // success
|
||||||
|
|
||||||
|
if (r0 != r1) { |
||||||
|
size_t smallest = r0; |
||||||
|
if (r1<r0) smallest = r1; |
||||||
|
result += smallest; |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
if (memcmp(b0, b1, r0)) { |
||||||
|
unsigned errorPos = 0; |
||||||
|
while ((errorPos < r0) && (b0[errorPos]==b1[errorPos])) errorPos++; |
||||||
|
result += errorPos; |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
result += sizeof(b0); |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, const char** argv) |
||||||
|
{ |
||||||
|
char inpFilename[256] = { 0 }; |
||||||
|
char lz4Filename[256] = { 0 }; |
||||||
|
char decFilename[256] = { 0 }; |
||||||
|
unsigned fileID = 1; |
||||||
|
unsigned pause = 0; |
||||||
|
|
||||||
|
|
||||||
|
if(argc < 2) { |
||||||
|
printf("Please specify input filename\n"); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
if (!strcmp(argv[1], "-p")) { pause = 1; fileID = 2; } |
||||||
|
|
||||||
|
snprintf(inpFilename, 256, "%s", argv[fileID]); |
||||||
|
snprintf(lz4Filename, 256, "%s.lz4s-%d", argv[fileID], 9); |
||||||
|
snprintf(decFilename, 256, "%s.lz4s-%d.dec", argv[fileID], 9); |
||||||
|
|
||||||
|
printf("input = [%s]\n", inpFilename); |
||||||
|
printf("lz4 = [%s]\n", lz4Filename); |
||||||
|
printf("decoded = [%s]\n", decFilename); |
||||||
|
|
||||||
|
// compress
|
||||||
|
{ FILE* const inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* const outFp = fopen(lz4Filename, "wb"); |
||||||
|
|
||||||
|
test_compress(outFp, inpFp); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// decompress
|
||||||
|
{ FILE* const inpFp = fopen(lz4Filename, "rb"); |
||||||
|
FILE* const outFp = fopen(decFilename, "wb"); |
||||||
|
|
||||||
|
test_decompress(outFp, inpFp); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// verify
|
||||||
|
{ FILE* const inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* const decFp = fopen(decFilename, "rb"); |
||||||
|
|
||||||
|
const size_t cmp = compare(inpFp, decFp); |
||||||
|
if(0 == cmp) { |
||||||
|
printf("Verify : OK\n"); |
||||||
|
} else { |
||||||
|
printf("Verify : NG : error at pos %u\n", (unsigned)cmp-1); |
||||||
|
} |
||||||
|
|
||||||
|
fclose(decFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
if (pause) { |
||||||
|
int unused; |
||||||
|
printf("Press enter to continue ...\n"); |
||||||
|
unused = getchar(); (void)unused; /* silence static analyzer */ |
||||||
|
} |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,114 @@ |
|||||||
|
# ##########################################################################
|
||||||
|
# LZ4 examples - Makefile
|
||||||
|
# Copyright (C) Yann Collet 2011-2020
|
||||||
|
#
|
||||||
|
# GPL v2 License
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
# You can contact the author at :
|
||||||
|
# - LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
# ##########################################################################
|
||||||
|
# This makefile compile and test
|
||||||
|
# example programs, using (mostly) LZ4 streaming library,
|
||||||
|
# kindly provided by Takayuki Matsuoka
|
||||||
|
# ##########################################################################
|
||||||
|
|
||||||
|
CPPFLAGS += -I../lib
|
||||||
|
CFLAGS ?= -O3
|
||||||
|
CFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
|
||||||
|
FLAGS := $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MOREFLAGS)
|
||||||
|
|
||||||
|
TESTFILE = Makefile
|
||||||
|
LZ4DIR := ../lib
|
||||||
|
LZ4 = ../programs/lz4
|
||||||
|
|
||||||
|
include ../Makefile.inc |
||||||
|
|
||||||
|
default: all |
||||||
|
|
||||||
|
all: printVersion doubleBuffer dictionaryRandomAccess ringBuffer ringBufferHC \
|
||||||
|
lineCompress frameCompress fileCompress simpleBuffer
|
||||||
|
|
||||||
|
$(LZ4DIR)/liblz4.a: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c $(LZ4DIR)/lz4.h $(LZ4DIR)/lz4hc.h $(LZ4DIR)/lz4frame.h $(LZ4DIR)/lz4frame_static.h |
||||||
|
$(MAKE) -C $(LZ4DIR) liblz4.a
|
||||||
|
|
||||||
|
printVersion: printVersion.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
doubleBuffer: blockStreaming_doubleBuffer.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
dictionaryRandomAccess: dictionaryRandomAccess.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
ringBuffer : blockStreaming_ringBuffer.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
ringBufferHC: HCStreaming_ringBuffer.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
lineCompress: blockStreaming_lineByLine.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
frameCompress: frameCompress.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
fileCompress: fileCompress.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
compressFunctions: compress_functions.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT) -lrt
|
||||||
|
|
||||||
|
simpleBuffer: simple_buffer.c $(LZ4DIR)/liblz4.a |
||||||
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
$(LZ4) : |
||||||
|
$(MAKE) -C ../programs lz4
|
||||||
|
|
||||||
|
test : all $(LZ4) |
||||||
|
@echo "\n=== Print Version ==="
|
||||||
|
./printVersion$(EXT)
|
||||||
|
@echo "\n=== Simple compression example ==="
|
||||||
|
./simpleBuffer$(EXT)
|
||||||
|
@echo "\n=== Double-buffer ==="
|
||||||
|
./doubleBuffer$(EXT) $(TESTFILE)
|
||||||
|
@echo "\n=== Ring Buffer ==="
|
||||||
|
./ringBuffer$(EXT) $(TESTFILE)
|
||||||
|
@echo "\n=== Ring Buffer + LZ4 HC ==="
|
||||||
|
./ringBufferHC$(EXT) $(TESTFILE)
|
||||||
|
@echo "\n=== Compress line by line ==="
|
||||||
|
./lineCompress$(EXT) $(TESTFILE)
|
||||||
|
@echo "\n=== Dictionary Random Access ==="
|
||||||
|
./dictionaryRandomAccess$(EXT) $(TESTFILE) $(TESTFILE) 1100 1400
|
||||||
|
@echo "\n=== Frame compression ==="
|
||||||
|
./frameCompress$(EXT) $(TESTFILE)
|
||||||
|
$(LZ4) -vt $(TESTFILE).lz4
|
||||||
|
@echo "\n=== file compression ==="
|
||||||
|
./fileCompress$(EXT) $(TESTFILE)
|
||||||
|
$(LZ4) -vt $(TESTFILE).lz4
|
||||||
|
|
||||||
|
.PHONY: cxxtest |
||||||
|
cxxtest: CFLAGS := -O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror |
||||||
|
cxxtest: clean |
||||||
|
CC=$(CXX) $(MAKE) -C . all CFLAGS="$(CFLAGS)"
|
||||||
|
|
||||||
|
clean: |
||||||
|
@rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s *.lz4 \
|
||||||
|
printVersion$(EXT) doubleBuffer$(EXT) dictionaryRandomAccess$(EXT) \
|
||||||
|
ringBuffer$(EXT) ringBufferHC$(EXT) lineCompress$(EXT) frameCompress$(EXT) \
|
||||||
|
fileCompress$(EXT) compressFunctions$(EXT) simpleBuffer$(EXT)
|
||||||
|
@echo Cleaning completed
|
@ -0,0 +1,11 @@ |
|||||||
|
# LZ4 examples |
||||||
|
|
||||||
|
All examples are GPL-v2 licensed. |
||||||
|
|
||||||
|
## Documents |
||||||
|
|
||||||
|
- [Streaming API Basics](streaming_api_basics.md) |
||||||
|
- Examples |
||||||
|
- [Double Buffer](blockStreaming_doubleBuffer.md) |
||||||
|
- [Line by Line Text Compression](blockStreaming_lineByLine.md) |
||||||
|
- [Dictionary Random Access](dictionaryRandomAccess.md) |
@ -0,0 +1,202 @@ |
|||||||
|
// LZ4 streaming API example : double buffer
|
||||||
|
// Copyright : Takayuki Matsuoka
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER <= 1800) /* Visual Studio <= 2013 */ |
||||||
|
# define _CRT_SECURE_NO_WARNINGS |
||||||
|
# define snprintf sprintf_s |
||||||
|
#endif |
||||||
|
#include "lz4.h" |
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
#include <stdint.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
|
||||||
|
enum { |
||||||
|
BLOCK_BYTES = 1024 * 8, |
||||||
|
// BLOCK_BYTES = 1024 * 64,
|
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
size_t write_int(FILE* fp, int i) { |
||||||
|
return fwrite(&i, sizeof(i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t write_bin(FILE* fp, const void* array, size_t arrayBytes) { |
||||||
|
return fwrite(array, 1, arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t read_int(FILE* fp, int* i) { |
||||||
|
return fread(i, sizeof(*i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t read_bin(FILE* fp, void* array, size_t arrayBytes) { |
||||||
|
return fread(array, 1, arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_compress(FILE* outFp, FILE* inpFp) |
||||||
|
{ |
||||||
|
LZ4_stream_t lz4Stream_body; |
||||||
|
LZ4_stream_t* lz4Stream = &lz4Stream_body; |
||||||
|
|
||||||
|
char inpBuf[2][BLOCK_BYTES]; |
||||||
|
int inpBufIndex = 0; |
||||||
|
|
||||||
|
LZ4_initStream(lz4Stream, sizeof (*lz4Stream)); |
||||||
|
|
||||||
|
for(;;) { |
||||||
|
char* const inpPtr = inpBuf[inpBufIndex]; |
||||||
|
const int inpBytes = (int) read_bin(inpFp, inpPtr, BLOCK_BYTES); |
||||||
|
if(0 == inpBytes) { |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
{ |
||||||
|
char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)]; |
||||||
|
const int cmpBytes = LZ4_compress_fast_continue( |
||||||
|
lz4Stream, inpPtr, cmpBuf, inpBytes, sizeof(cmpBuf), 1); |
||||||
|
if(cmpBytes <= 0) { |
||||||
|
break; |
||||||
|
} |
||||||
|
write_int(outFp, cmpBytes); |
||||||
|
write_bin(outFp, cmpBuf, (size_t) cmpBytes); |
||||||
|
} |
||||||
|
|
||||||
|
inpBufIndex = (inpBufIndex + 1) % 2; |
||||||
|
} |
||||||
|
|
||||||
|
write_int(outFp, 0); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_decompress(FILE* outFp, FILE* inpFp) |
||||||
|
{ |
||||||
|
LZ4_streamDecode_t lz4StreamDecode_body; |
||||||
|
LZ4_streamDecode_t* lz4StreamDecode = &lz4StreamDecode_body; |
||||||
|
|
||||||
|
char decBuf[2][BLOCK_BYTES]; |
||||||
|
int decBufIndex = 0; |
||||||
|
|
||||||
|
LZ4_setStreamDecode(lz4StreamDecode, NULL, 0); |
||||||
|
|
||||||
|
for(;;) { |
||||||
|
char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)]; |
||||||
|
int cmpBytes = 0; |
||||||
|
|
||||||
|
{ |
||||||
|
const size_t readCount0 = read_int(inpFp, &cmpBytes); |
||||||
|
if(readCount0 != 1 || cmpBytes <= 0) { |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
const size_t readCount1 = read_bin(inpFp, cmpBuf, (size_t) cmpBytes); |
||||||
|
if(readCount1 != (size_t) cmpBytes) { |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
{ |
||||||
|
char* const decPtr = decBuf[decBufIndex]; |
||||||
|
const int decBytes = LZ4_decompress_safe_continue( |
||||||
|
lz4StreamDecode, cmpBuf, decPtr, cmpBytes, BLOCK_BYTES); |
||||||
|
if(decBytes <= 0) { |
||||||
|
break; |
||||||
|
} |
||||||
|
write_bin(outFp, decPtr, (size_t) decBytes); |
||||||
|
} |
||||||
|
|
||||||
|
decBufIndex = (decBufIndex + 1) % 2; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int compare(FILE* fp0, FILE* fp1) |
||||||
|
{ |
||||||
|
int result = 0; |
||||||
|
|
||||||
|
while(0 == result) { |
||||||
|
char b0[65536]; |
||||||
|
char b1[65536]; |
||||||
|
const size_t r0 = read_bin(fp0, b0, sizeof(b0)); |
||||||
|
const size_t r1 = read_bin(fp1, b1, sizeof(b1)); |
||||||
|
|
||||||
|
result = (int) r0 - (int) r1; |
||||||
|
|
||||||
|
if(0 == r0 || 0 == r1) { |
||||||
|
break; |
||||||
|
} |
||||||
|
if(0 == result) { |
||||||
|
result = memcmp(b0, b1, r0); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) |
||||||
|
{ |
||||||
|
char inpFilename[256] = { 0 }; |
||||||
|
char lz4Filename[256] = { 0 }; |
||||||
|
char decFilename[256] = { 0 }; |
||||||
|
|
||||||
|
if(argc < 2) { |
||||||
|
printf("Please specify input filename\n"); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
snprintf(inpFilename, 256, "%s", argv[1]); |
||||||
|
snprintf(lz4Filename, 256, "%s.lz4s-%d", argv[1], BLOCK_BYTES); |
||||||
|
snprintf(decFilename, 256, "%s.lz4s-%d.dec", argv[1], BLOCK_BYTES); |
||||||
|
|
||||||
|
printf("inp = [%s]\n", inpFilename); |
||||||
|
printf("lz4 = [%s]\n", lz4Filename); |
||||||
|
printf("dec = [%s]\n", decFilename); |
||||||
|
|
||||||
|
// compress
|
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* outFp = fopen(lz4Filename, "wb"); |
||||||
|
|
||||||
|
printf("compress : %s -> %s\n", inpFilename, lz4Filename); |
||||||
|
test_compress(outFp, inpFp); |
||||||
|
printf("compress : done\n"); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// decompress
|
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(lz4Filename, "rb"); |
||||||
|
FILE* outFp = fopen(decFilename, "wb"); |
||||||
|
|
||||||
|
printf("decompress : %s -> %s\n", lz4Filename, decFilename); |
||||||
|
test_decompress(outFp, inpFp); |
||||||
|
printf("decompress : done\n"); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// verify
|
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* decFp = fopen(decFilename, "rb"); |
||||||
|
|
||||||
|
printf("verify : %s <-> %s\n", inpFilename, decFilename); |
||||||
|
const int cmp = compare(inpFp, decFp); |
||||||
|
if(0 == cmp) { |
||||||
|
printf("verify : OK\n"); |
||||||
|
} else { |
||||||
|
printf("verify : NG\n"); |
||||||
|
} |
||||||
|
|
||||||
|
fclose(decFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,211 @@ |
|||||||
|
// LZ4 streaming API example : line-by-line logfile compression
|
||||||
|
// by Takayuki Matsuoka
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER <= 1800) /* Visual Studio <= 2013 */ |
||||||
|
# define _CRT_SECURE_NO_WARNINGS |
||||||
|
# define snprintf sprintf_s |
||||||
|
#endif |
||||||
|
#include "lz4.h" |
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
#include <stdint.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
|
||||||
|
static size_t write_uint16(FILE* fp, uint16_t i) |
||||||
|
{ |
||||||
|
return fwrite(&i, sizeof(i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
static size_t write_bin(FILE* fp, const void* array, int arrayBytes) |
||||||
|
{ |
||||||
|
return fwrite(array, 1, arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
static size_t read_uint16(FILE* fp, uint16_t* i) |
||||||
|
{ |
||||||
|
return fread(i, sizeof(*i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
static size_t read_bin(FILE* fp, void* array, int arrayBytes) |
||||||
|
{ |
||||||
|
return fread(array, 1, arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
static void test_compress( |
||||||
|
FILE* outFp, |
||||||
|
FILE* inpFp, |
||||||
|
size_t messageMaxBytes, |
||||||
|
size_t ringBufferBytes) |
||||||
|
{ |
||||||
|
LZ4_stream_t* const lz4Stream = LZ4_createStream(); |
||||||
|
const size_t cmpBufBytes = LZ4_COMPRESSBOUND(messageMaxBytes); |
||||||
|
char* const cmpBuf = (char*) malloc(cmpBufBytes); |
||||||
|
char* const inpBuf = (char*) malloc(ringBufferBytes); |
||||||
|
int inpOffset = 0; |
||||||
|
|
||||||
|
for ( ; ; ) |
||||||
|
{ |
||||||
|
char* const inpPtr = &inpBuf[inpOffset]; |
||||||
|
|
||||||
|
#if 0 |
||||||
|
// Read random length data to the ring buffer.
|
||||||
|
const int randomLength = (rand() % messageMaxBytes) + 1; |
||||||
|
const int inpBytes = (int) read_bin(inpFp, inpPtr, randomLength); |
||||||
|
if (0 == inpBytes) break; |
||||||
|
#else |
||||||
|
// Read line to the ring buffer.
|
||||||
|
int inpBytes = 0; |
||||||
|
if (!fgets(inpPtr, (int) messageMaxBytes, inpFp)) |
||||||
|
break; |
||||||
|
inpBytes = (int) strlen(inpPtr); |
||||||
|
#endif |
||||||
|
|
||||||
|
{ |
||||||
|
const int cmpBytes = LZ4_compress_fast_continue( |
||||||
|
lz4Stream, inpPtr, cmpBuf, inpBytes, (int) cmpBufBytes, 1); |
||||||
|
if (cmpBytes <= 0) break; |
||||||
|
write_uint16(outFp, (uint16_t) cmpBytes); |
||||||
|
write_bin(outFp, cmpBuf, cmpBytes); |
||||||
|
|
||||||
|
// Add and wraparound the ringbuffer offset
|
||||||
|
inpOffset += inpBytes; |
||||||
|
if ((size_t)inpOffset >= ringBufferBytes - messageMaxBytes) inpOffset = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
write_uint16(outFp, 0); |
||||||
|
|
||||||
|
free(inpBuf); |
||||||
|
free(cmpBuf); |
||||||
|
LZ4_freeStream(lz4Stream); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
static void test_decompress( |
||||||
|
FILE* outFp, |
||||||
|
FILE* inpFp, |
||||||
|
size_t messageMaxBytes, |
||||||
|
size_t ringBufferBytes) |
||||||
|
{ |
||||||
|
LZ4_streamDecode_t* const lz4StreamDecode = LZ4_createStreamDecode(); |
||||||
|
char* const cmpBuf = (char*) malloc(LZ4_COMPRESSBOUND(messageMaxBytes)); |
||||||
|
char* const decBuf = (char*) malloc(ringBufferBytes); |
||||||
|
int decOffset = 0; |
||||||
|
|
||||||
|
for ( ; ; ) |
||||||
|
{ |
||||||
|
uint16_t cmpBytes = 0; |
||||||
|
|
||||||
|
if (read_uint16(inpFp, &cmpBytes) != 1) break; |
||||||
|
if (cmpBytes == 0) break; |
||||||
|
if (read_bin(inpFp, cmpBuf, cmpBytes) != cmpBytes) break; |
||||||
|
|
||||||
|
{ |
||||||
|
char* const decPtr = &decBuf[decOffset]; |
||||||
|
const int decBytes = LZ4_decompress_safe_continue( |
||||||
|
lz4StreamDecode, cmpBuf, decPtr, cmpBytes, (int) messageMaxBytes); |
||||||
|
if (decBytes <= 0) break; |
||||||
|
write_bin(outFp, decPtr, decBytes); |
||||||
|
|
||||||
|
// Add and wraparound the ringbuffer offset
|
||||||
|
decOffset += decBytes; |
||||||
|
if ((size_t)decOffset >= ringBufferBytes - messageMaxBytes) decOffset = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
free(decBuf); |
||||||
|
free(cmpBuf); |
||||||
|
LZ4_freeStreamDecode(lz4StreamDecode); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
static int compare(FILE* f0, FILE* f1) |
||||||
|
{ |
||||||
|
int result = 0; |
||||||
|
const size_t tempBufferBytes = 65536; |
||||||
|
char* const b0 = (char*) malloc(tempBufferBytes); |
||||||
|
char* const b1 = (char*) malloc(tempBufferBytes); |
||||||
|
|
||||||
|
while(0 == result) |
||||||
|
{ |
||||||
|
const size_t r0 = fread(b0, 1, tempBufferBytes, f0); |
||||||
|
const size_t r1 = fread(b1, 1, tempBufferBytes, f1); |
||||||
|
|
||||||
|
result = (int) r0 - (int) r1; |
||||||
|
|
||||||
|
if (0 == r0 || 0 == r1) break; |
||||||
|
if (0 == result) result = memcmp(b0, b1, r0); |
||||||
|
} |
||||||
|
|
||||||
|
free(b1); |
||||||
|
free(b0); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) |
||||||
|
{ |
||||||
|
enum { |
||||||
|
MESSAGE_MAX_BYTES = 1024, |
||||||
|
RING_BUFFER_BYTES = 1024 * 256 + MESSAGE_MAX_BYTES, |
||||||
|
}; |
||||||
|
|
||||||
|
char inpFilename[256] = { 0 }; |
||||||
|
char lz4Filename[256] = { 0 }; |
||||||
|
char decFilename[256] = { 0 }; |
||||||
|
|
||||||
|
if (argc < 2) |
||||||
|
{ |
||||||
|
printf("Please specify input filename\n"); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
snprintf(inpFilename, 256, "%s", argv[1]); |
||||||
|
snprintf(lz4Filename, 256, "%s.lz4s", argv[1]); |
||||||
|
snprintf(decFilename, 256, "%s.lz4s.dec", argv[1]); |
||||||
|
|
||||||
|
printf("inp = [%s]\n", inpFilename); |
||||||
|
printf("lz4 = [%s]\n", lz4Filename); |
||||||
|
printf("dec = [%s]\n", decFilename); |
||||||
|
|
||||||
|
// compress
|
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* outFp = fopen(lz4Filename, "wb"); |
||||||
|
|
||||||
|
test_compress(outFp, inpFp, MESSAGE_MAX_BYTES, RING_BUFFER_BYTES); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// decompress
|
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(lz4Filename, "rb"); |
||||||
|
FILE* outFp = fopen(decFilename, "wb"); |
||||||
|
|
||||||
|
test_decompress(outFp, inpFp, MESSAGE_MAX_BYTES, RING_BUFFER_BYTES); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// verify
|
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* decFp = fopen(decFilename, "rb"); |
||||||
|
|
||||||
|
const int cmp = compare(inpFp, decFp); |
||||||
|
if (0 == cmp) |
||||||
|
printf("Verify : OK\n"); |
||||||
|
else |
||||||
|
printf("Verify : NG\n"); |
||||||
|
|
||||||
|
fclose(decFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,190 @@ |
|||||||
|
/* LZ4 streaming API example : ring buffer
|
||||||
|
* Based on sample code from Takayuki Matsuoka */ |
||||||
|
|
||||||
|
|
||||||
|
/**************************************
|
||||||
|
* Compiler Options |
||||||
|
**************************************/ |
||||||
|
#if defined(_MSC_VER) && (_MSC_VER <= 1800) /* Visual Studio <= 2013 */ |
||||||
|
# define _CRT_SECURE_NO_WARNINGS |
||||||
|
# define snprintf sprintf_s |
||||||
|
#endif |
||||||
|
|
||||||
|
|
||||||
|
/**************************************
|
||||||
|
* Includes |
||||||
|
**************************************/ |
||||||
|
#include <stdio.h> |
||||||
|
#include <stdint.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
#include "lz4.h" |
||||||
|
|
||||||
|
|
||||||
|
enum { |
||||||
|
MESSAGE_MAX_BYTES = 1024, |
||||||
|
RING_BUFFER_BYTES = 1024 * 8 + MESSAGE_MAX_BYTES, |
||||||
|
DECODE_RING_BUFFER = RING_BUFFER_BYTES + MESSAGE_MAX_BYTES /* Intentionally larger, to test unsynchronized ring buffers */ |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
size_t write_int32(FILE* fp, int32_t i) { |
||||||
|
return fwrite(&i, sizeof(i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t write_bin(FILE* fp, const void* array, int arrayBytes) { |
||||||
|
return fwrite(array, 1, arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t read_int32(FILE* fp, int32_t* i) { |
||||||
|
return fread(i, sizeof(*i), 1, fp); |
||||||
|
} |
||||||
|
|
||||||
|
size_t read_bin(FILE* fp, void* array, int arrayBytes) { |
||||||
|
return fread(array, 1, arrayBytes, fp); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_compress(FILE* outFp, FILE* inpFp) |
||||||
|
{ |
||||||
|
LZ4_stream_t lz4Stream_body = { { 0 } }; |
||||||
|
LZ4_stream_t* lz4Stream = &lz4Stream_body; |
||||||
|
|
||||||
|
static char inpBuf[RING_BUFFER_BYTES]; |
||||||
|
int inpOffset = 0; |
||||||
|
|
||||||
|
for(;;) { |
||||||
|
// Read random length ([1,MESSAGE_MAX_BYTES]) data to the ring buffer.
|
||||||
|
char* const inpPtr = &inpBuf[inpOffset]; |
||||||
|
const int randomLength = (rand() % MESSAGE_MAX_BYTES) + 1; |
||||||
|
const int inpBytes = (int) read_bin(inpFp, inpPtr, randomLength); |
||||||
|
if (0 == inpBytes) break; |
||||||
|
|
||||||
|
{ |
||||||
|
#define CMPBUFSIZE (LZ4_COMPRESSBOUND(MESSAGE_MAX_BYTES)) |
||||||
|
char cmpBuf[CMPBUFSIZE]; |
||||||
|
const int cmpBytes = LZ4_compress_fast_continue(lz4Stream, inpPtr, cmpBuf, inpBytes, CMPBUFSIZE, 0); |
||||||
|
if(cmpBytes <= 0) break; |
||||||
|
write_int32(outFp, cmpBytes); |
||||||
|
write_bin(outFp, cmpBuf, cmpBytes); |
||||||
|
|
||||||
|
inpOffset += inpBytes; |
||||||
|
|
||||||
|
// Wraparound the ringbuffer offset
|
||||||
|
if(inpOffset >= RING_BUFFER_BYTES - MESSAGE_MAX_BYTES) inpOffset = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
write_int32(outFp, 0); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_decompress(FILE* outFp, FILE* inpFp) |
||||||
|
{ |
||||||
|
static char decBuf[DECODE_RING_BUFFER]; |
||||||
|
int decOffset = 0; |
||||||
|
LZ4_streamDecode_t lz4StreamDecode_body = { { 0 } }; |
||||||
|
LZ4_streamDecode_t* lz4StreamDecode = &lz4StreamDecode_body; |
||||||
|
|
||||||
|
for(;;) { |
||||||
|
int cmpBytes = 0; |
||||||
|
char cmpBuf[CMPBUFSIZE]; |
||||||
|
|
||||||
|
{ const size_t r0 = read_int32(inpFp, &cmpBytes); |
||||||
|
if(r0 != 1 || cmpBytes <= 0) break; |
||||||
|
|
||||||
|
const size_t r1 = read_bin(inpFp, cmpBuf, cmpBytes); |
||||||
|
if(r1 != (size_t) cmpBytes) break; |
||||||
|
} |
||||||
|
|
||||||
|
{ char* const decPtr = &decBuf[decOffset]; |
||||||
|
const int decBytes = LZ4_decompress_safe_continue( |
||||||
|
lz4StreamDecode, cmpBuf, decPtr, cmpBytes, MESSAGE_MAX_BYTES); |
||||||
|
if(decBytes <= 0) break; |
||||||
|
decOffset += decBytes; |
||||||
|
write_bin(outFp, decPtr, decBytes); |
||||||
|
|
||||||
|
// Wraparound the ringbuffer offset
|
||||||
|
if(decOffset >= DECODE_RING_BUFFER - MESSAGE_MAX_BYTES) decOffset = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int compare(FILE* f0, FILE* f1) |
||||||
|
{ |
||||||
|
int result = 0; |
||||||
|
|
||||||
|
while (0 == result) { |
||||||
|
char b0[65536]; |
||||||
|
char b1[65536]; |
||||||
|
const size_t r0 = fread(b0, 1, sizeof(b0), f0); |
||||||
|
const size_t r1 = fread(b1, 1, sizeof(b1), f1); |
||||||
|
|
||||||
|
result = (int) r0 - (int) r1; |
||||||
|
|
||||||
|
if (0 == r0 || 0 == r1) break; |
||||||
|
|
||||||
|
if (0 == result) result = memcmp(b0, b1, r0); |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char** argv) |
||||||
|
{ |
||||||
|
char inpFilename[256] = { 0 }; |
||||||
|
char lz4Filename[256] = { 0 }; |
||||||
|
char decFilename[256] = { 0 }; |
||||||
|
|
||||||
|
if (argc < 2) { |
||||||
|
printf("Please specify input filename\n"); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
snprintf(inpFilename, 256, "%s", argv[1]); |
||||||
|
snprintf(lz4Filename, 256, "%s.lz4s-%d", argv[1], 0); |
||||||
|
snprintf(decFilename, 256, "%s.lz4s-%d.dec", argv[1], 0); |
||||||
|
|
||||||
|
printf("inp = [%s]\n", inpFilename); |
||||||
|
printf("lz4 = [%s]\n", lz4Filename); |
||||||
|
printf("dec = [%s]\n", decFilename); |
||||||
|
|
||||||
|
// compress
|
||||||
|
{ FILE* const inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* const outFp = fopen(lz4Filename, "wb"); |
||||||
|
|
||||||
|
test_compress(outFp, inpFp); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// decompress
|
||||||
|
{ FILE* const inpFp = fopen(lz4Filename, "rb"); |
||||||
|
FILE* const outFp = fopen(decFilename, "wb"); |
||||||
|
|
||||||
|
test_decompress(outFp, inpFp); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
// verify
|
||||||
|
{ FILE* const inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* const decFp = fopen(decFilename, "rb"); |
||||||
|
|
||||||
|
const int cmp = compare(inpFp, decFp); |
||||||
|
if (0 == cmp) { |
||||||
|
printf("Verify : OK\n"); |
||||||
|
} else { |
||||||
|
printf("Verify : NG\n"); |
||||||
|
} |
||||||
|
|
||||||
|
fclose(decFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,363 @@ |
|||||||
|
/*
|
||||||
|
* compress_functions.c |
||||||
|
* Copyright : Kyle Harper |
||||||
|
* License : Follows same licensing as the lz4.c/lz4.h program at any given time. Currently, BSD 2. |
||||||
|
* Description: A program to demonstrate the various compression functions involved in when using LZ4_compress_default(). The idea |
||||||
|
* is to show how each step in the call stack can be used directly, if desired. There is also some benchmarking for |
||||||
|
* each function to demonstrate the (probably lack of) performance difference when jumping the stack. |
||||||
|
* (If you're new to lz4, please read simple_buffer.c to understand the fundamentals) |
||||||
|
* |
||||||
|
* The call stack (before theoretical compiler optimizations) for LZ4_compress_default is as follows: |
||||||
|
* LZ4_compress_default |
||||||
|
* LZ4_compress_fast |
||||||
|
* LZ4_compress_fast_extState |
||||||
|
* LZ4_compress_generic |
||||||
|
* |
||||||
|
* LZ4_compress_default() |
||||||
|
* This is the recommended function for compressing data. It will serve as the baseline for comparison. |
||||||
|
* LZ4_compress_fast() |
||||||
|
* Despite its name, it's not a "fast" version of compression. It simply decides if HEAPMODE is set and either |
||||||
|
* allocates memory on the heap for a struct or creates the struct directly on the stack. Stack access is generally |
||||||
|
* faster but this function itself isn't giving that advantage, it's just some logic for compile time. |
||||||
|
* LZ4_compress_fast_extState() |
||||||
|
* This simply accepts all the pointers and values collected thus far and adds logic to determine how |
||||||
|
* LZ4_compress_generic should be invoked; specifically: can the source fit into a single pass as determined by |
||||||
|
* LZ4_64Klimit. |
||||||
|
* LZ4_compress_generic() |
||||||
|
* As the name suggests, this is the generic function that ultimately does most of the heavy lifting. Calling this |
||||||
|
* directly can help avoid some test cases and branching which might be useful in some implementation-specific |
||||||
|
* situations, but you really need to know what you're doing AND what you're asking lz4 to do! You also need a |
||||||
|
* wrapper function because this function isn't exposed with lz4.h. |
||||||
|
* |
||||||
|
* The call stack for decompression functions is shallow. There are 2 options: |
||||||
|
* LZ4_decompress_safe || LZ4_decompress_fast |
||||||
|
* LZ4_decompress_generic |
||||||
|
* |
||||||
|
* LZ4_decompress_safe |
||||||
|
* This is the recommended function for decompressing data. It is considered safe because the caller specifies |
||||||
|
* both the size of the compressed buffer to read as well as the maximum size of the output (decompressed) buffer |
||||||
|
* instead of just the latter. |
||||||
|
* LZ4_decompress_fast |
||||||
|
* Again, despite its name it's not a "fast" version of decompression. It simply frees the caller of sending the |
||||||
|
* size of the compressed buffer (it will simply be read-to-end, hence it's non-safety). |
||||||
|
* LZ4_decompress_generic |
||||||
|
* This is the generic function that both of the LZ4_decompress_* functions above end up calling. Calling this |
||||||
|
* directly is not advised, period. Furthermore, it is a static inline function in lz4.c, so there isn't a symbol |
||||||
|
* exposed for anyone using lz4.h to utilize. |
||||||
|
* |
||||||
|
* Special Note About Decompression: |
||||||
|
* Using the LZ4_decompress_safe() function protects against malicious (user) input. If you are using data from a |
||||||
|
* trusted source, or if your program is the producer (P) as well as its consumer (C) in a PC or MPMC setup, you can |
||||||
|
* safely use the LZ4_decompress_fast function. |
||||||
|
*/ |
||||||
|
|
||||||
|
/* Since lz4 compiles with c99 and not gnu/std99 we need to enable POSIX linking for time.h structs and functions. */ |
||||||
|
#if __STDC_VERSION__ >= 199901L |
||||||
|
#define _XOPEN_SOURCE 600 |
||||||
|
#else |
||||||
|
#define _XOPEN_SOURCE 500 |
||||||
|
#endif |
||||||
|
#define _POSIX_C_SOURCE 199309L |
||||||
|
|
||||||
|
/* Includes, for Power! */ |
||||||
|
#define LZ4_DISABLE_DEPRECATE_WARNINGS /* LZ4_decompress_fast */ |
||||||
|
#include "lz4.h" |
||||||
|
#include <stdio.h> /* for printf() */ |
||||||
|
#include <stdlib.h> /* for exit() */ |
||||||
|
#include <string.h> /* for atoi() memcmp() */ |
||||||
|
#include <stdint.h> /* for uint_types */ |
||||||
|
#include <inttypes.h> /* for PRIu64 */ |
||||||
|
#include <time.h> /* for clock_gettime() */ |
||||||
|
#include <locale.h> /* for setlocale() */ |
||||||
|
|
||||||
|
/* We need to know what one billion is for clock timing. */ |
||||||
|
#define BILLION 1000000000L |
||||||
|
|
||||||
|
/* Create a crude set of test IDs so we can switch on them later (Can't switch() on a char[] or char*). */ |
||||||
|
#define ID__LZ4_COMPRESS_DEFAULT 1 |
||||||
|
#define ID__LZ4_COMPRESS_FAST 2 |
||||||
|
#define ID__LZ4_COMPRESS_FAST_EXTSTATE 3 |
||||||
|
#define ID__LZ4_COMPRESS_GENERIC 4 |
||||||
|
#define ID__LZ4_DECOMPRESS_SAFE 5 |
||||||
|
#define ID__LZ4_DECOMPRESS_FAST 6 |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Easy show-error-and-bail function. |
||||||
|
*/ |
||||||
|
void run_screaming(const char *message, const int code) { |
||||||
|
printf("%s\n", message); |
||||||
|
exit(code); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Centralize the usage function to keep main cleaner. |
||||||
|
*/ |
||||||
|
void usage(const char *message) { |
||||||
|
printf("Usage: ./argPerformanceTesting <iterations>\n"); |
||||||
|
run_screaming(message, 1); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Runs the benchmark for LZ4_compress_* based on function_id. |
||||||
|
*/ |
||||||
|
uint64_t bench( |
||||||
|
const char *known_good_dst, |
||||||
|
const int function_id, |
||||||
|
const int iterations, |
||||||
|
const char *src, |
||||||
|
char *dst, |
||||||
|
const size_t src_size, |
||||||
|
const size_t max_dst_size, |
||||||
|
const size_t comp_size |
||||||
|
) { |
||||||
|
uint64_t time_taken = 0; |
||||||
|
int rv = 0; |
||||||
|
const int warm_up = 5000; |
||||||
|
struct timespec start, end; |
||||||
|
const int acceleration = 1; |
||||||
|
LZ4_stream_t state; |
||||||
|
|
||||||
|
// Select the right function to perform the benchmark on. We perform 5000 initial loops to warm the cache and ensure that dst
|
||||||
|
// remains matching to known_good_dst between successive calls.
|
||||||
|
switch(function_id) { |
||||||
|
case ID__LZ4_COMPRESS_DEFAULT: |
||||||
|
printf("Starting benchmark for function: LZ4_compress_default()\n"); |
||||||
|
for(int junk=0; junk<warm_up; junk++) |
||||||
|
rv = LZ4_compress_default(src, dst, src_size, max_dst_size); |
||||||
|
if (rv < 1) |
||||||
|
run_screaming("Couldn't run LZ4_compress_default()... error code received is in exit code.", rv); |
||||||
|
if (memcmp(known_good_dst, dst, max_dst_size) != 0) |
||||||
|
run_screaming("According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1); |
||||||
|
clock_gettime(CLOCK_MONOTONIC, &start); |
||||||
|
for (int i=1; i<=iterations; i++) |
||||||
|
LZ4_compress_default(src, dst, src_size, max_dst_size); |
||||||
|
break; |
||||||
|
|
||||||
|
case ID__LZ4_COMPRESS_FAST: |
||||||
|
printf("Starting benchmark for function: LZ4_compress_fast()\n"); |
||||||
|
for(int junk=0; junk<warm_up; junk++) |
||||||
|
rv = LZ4_compress_fast(src, dst, src_size, max_dst_size, acceleration); |
||||||
|
if (rv < 1) |
||||||
|
run_screaming("Couldn't run LZ4_compress_fast()... error code received is in exit code.", rv); |
||||||
|
if (memcmp(known_good_dst, dst, max_dst_size) != 0) |
||||||
|
run_screaming("According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1); |
||||||
|
clock_gettime(CLOCK_MONOTONIC, &start); |
||||||
|
for (int i=1; i<=iterations; i++) |
||||||
|
LZ4_compress_fast(src, dst, src_size, max_dst_size, acceleration); |
||||||
|
break; |
||||||
|
|
||||||
|
case ID__LZ4_COMPRESS_FAST_EXTSTATE: |
||||||
|
printf("Starting benchmark for function: LZ4_compress_fast_extState()\n"); |
||||||
|
for(int junk=0; junk<warm_up; junk++) |
||||||
|
rv = LZ4_compress_fast_extState(&state, src, dst, src_size, max_dst_size, acceleration); |
||||||
|
if (rv < 1) |
||||||
|
run_screaming("Couldn't run LZ4_compress_fast_extState()... error code received is in exit code.", rv); |
||||||
|
if (memcmp(known_good_dst, dst, max_dst_size) != 0) |
||||||
|
run_screaming("According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1); |
||||||
|
clock_gettime(CLOCK_MONOTONIC, &start); |
||||||
|
for (int i=1; i<=iterations; i++) |
||||||
|
LZ4_compress_fast_extState(&state, src, dst, src_size, max_dst_size, acceleration); |
||||||
|
break; |
||||||
|
|
||||||
|
// Disabled until LZ4_compress_generic() is exposed in the header.
|
||||||
|
// case ID__LZ4_COMPRESS_GENERIC:
|
||||||
|
// printf("Starting benchmark for function: LZ4_compress_generic()\n");
|
||||||
|
// LZ4_resetStream((LZ4_stream_t*)&state);
|
||||||
|
// for(int junk=0; junk<warm_up; junk++) {
|
||||||
|
// LZ4_resetStream((LZ4_stream_t*)&state);
|
||||||
|
// //rv = LZ4_compress_generic_wrapper(&state, src, dst, src_size, max_dst_size, notLimited, byU16, noDict, noDictIssue, acceleration);
|
||||||
|
// LZ4_compress_generic_wrapper(&state, src, dst, src_size, max_dst_size, acceleration);
|
||||||
|
// }
|
||||||
|
// if (rv < 1)
|
||||||
|
// run_screaming("Couldn't run LZ4_compress_generic()... error code received is in exit code.", rv);
|
||||||
|
// if (memcmp(known_good_dst, dst, max_dst_size) != 0)
|
||||||
|
// run_screaming("According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1);
|
||||||
|
// for (int i=1; i<=iterations; i++) {
|
||||||
|
// LZ4_resetStream((LZ4_stream_t*)&state);
|
||||||
|
// //LZ4_compress_generic_wrapper(&state, src, dst, src_size, max_dst_size, notLimited, byU16, noDict, noDictIssue, acceleration);
|
||||||
|
// LZ4_compress_generic_wrapper(&state, src, dst, src_size, max_dst_size, acceleration);
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
|
||||||
|
case ID__LZ4_DECOMPRESS_SAFE: |
||||||
|
printf("Starting benchmark for function: LZ4_decompress_safe()\n"); |
||||||
|
for(int junk=0; junk<warm_up; junk++) |
||||||
|
rv = LZ4_decompress_safe(src, dst, comp_size, src_size); |
||||||
|
if (rv < 1) |
||||||
|
run_screaming("Couldn't run LZ4_decompress_safe()... error code received is in exit code.", rv); |
||||||
|
if (memcmp(known_good_dst, dst, src_size) != 0) |
||||||
|
run_screaming("According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1); |
||||||
|
clock_gettime(CLOCK_MONOTONIC, &start); |
||||||
|
for (int i=1; i<=iterations; i++) |
||||||
|
LZ4_decompress_safe(src, dst, comp_size, src_size); |
||||||
|
break; |
||||||
|
|
||||||
|
case ID__LZ4_DECOMPRESS_FAST: |
||||||
|
printf("Starting benchmark for function: LZ4_decompress_fast()\n"); |
||||||
|
for(int junk=0; junk<warm_up; junk++) |
||||||
|
rv = LZ4_decompress_fast(src, dst, src_size); |
||||||
|
if (rv < 1) |
||||||
|
run_screaming("Couldn't run LZ4_decompress_fast()... error code received is in exit code.", rv); |
||||||
|
if (memcmp(known_good_dst, dst, src_size) != 0) |
||||||
|
run_screaming("According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1); |
||||||
|
clock_gettime(CLOCK_MONOTONIC, &start); |
||||||
|
for (int i=1; i<=iterations; i++) |
||||||
|
LZ4_decompress_fast(src, dst, src_size); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
run_screaming("The test specified isn't valid. Please check your code.", 1); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
// Stop timer and return time taken.
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &end); |
||||||
|
time_taken = BILLION *(end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; |
||||||
|
|
||||||
|
return time_taken; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* main() |
||||||
|
* We will demonstrate the use of each function for simplicity sake. Then we will run 2 suites of benchmarking: |
||||||
|
* Test suite A) Uses generic Lorem Ipsum text which should be generally compressible insomuch as basic human text is |
||||||
|
* compressible for such a small src_size |
||||||
|
* Test Suite B) For the sake of testing, see what results we get if the data is drastically easier to compress. IF there are |
||||||
|
* indeed losses and IF more compressible data is faster to process, this will exacerbate the findings. |
||||||
|
*/ |
||||||
|
int main(int argc, char **argv) { |
||||||
|
// Get and verify options. There's really only 1: How many iterations to run.
|
||||||
|
int iterations = 1000000; |
||||||
|
if (argc > 1) |
||||||
|
iterations = atoi(argv[1]); |
||||||
|
if (iterations < 1) |
||||||
|
usage("Argument 1 (iterations) must be > 0."); |
||||||
|
|
||||||
|
// First we will create 2 sources (char *) of 2000 bytes each. One normal text, the other highly-compressible text.
|
||||||
|
const char *src = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed luctus purus et risus vulputate, et mollis orci ullamcorper. Nulla facilisi. Fusce in ligula sed purus varius aliquet interdum vitae justo. Proin quis diam velit. Nulla varius iaculis auctor. Cras volutpat, justo eu dictum pulvinar, elit sem porttitor metus, et imperdiet metus sapien et ante. Nullam nisi nulla, ornare eu tristique eu, dignissim vitae diam. Nulla sagittis porta libero, a accumsan felis sagittis scelerisque. Integer laoreet eleifend congue. Etiam rhoncus leo vel dolor fermentum, quis luctus nisl iaculis. Praesent a erat sapien. Aliquam semper mi in lorem ultrices ultricies. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In feugiat risus sed enim ultrices, at sodales nulla tristique. Maecenas eget pellentesque justo, sed pellentesque lectus. Fusce sagittis sit amet elit vel varius. Donec sed ligula nec ligula vulputate rutrum sed ut lectus. Etiam congue pharetra leo vitae cursus. Morbi enim ante, porttitor ut varius vel, tincidunt quis justo. Nunc iaculis, risus id ultrices semper, metus est efficitur ligula, vel posuere risus nunc eget purus. Ut lorem turpis, condimentum at sem sed, porta aliquam turpis. In ut sapien a nulla dictum tincidunt quis sit amet lorem. Fusce at est egestas, luctus neque eu, consectetur tortor. Phasellus eleifend ultricies nulla ac lobortis. Morbi maximus quam cursus vehicula iaculis. Maecenas cursus vel justo ut rutrum. Curabitur magna orci, dignissim eget dapibus vitae, finibus id lacus. Praesent rhoncus mattis augue vitae bibendum. Praesent porta mauris non ultrices fermentum. Quisque vulputate ipsum in sodales pulvinar. Aliquam nec mollis felis. Donec vitae augue pulvinar, congue nisl sed, pretium purus. Fusce lobortis mi ac neque scelerisque semper. Pellentesque vel est vitae magna aliquet aliquet. Nam non dolor. Nulla facilisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi ac lacinia felis metus."; |
||||||
|
const char *hc_src = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
||||||
|
// Set and derive sizes. Since we're using strings, use strlen() + 1 for \0.
|
||||||
|
const size_t src_size = strlen(src) + 1; |
||||||
|
const size_t max_dst_size = LZ4_compressBound(src_size); |
||||||
|
int bytes_returned = 0; |
||||||
|
// Now build allocations for the data we'll be playing with.
|
||||||
|
char *dst = calloc(1, max_dst_size); |
||||||
|
char *known_good_dst = calloc(1, max_dst_size); |
||||||
|
char *known_good_hc_dst = calloc(1, max_dst_size); |
||||||
|
if (dst == NULL || known_good_dst == NULL || known_good_hc_dst == NULL) |
||||||
|
run_screaming("Couldn't allocate memory for the destination buffers. Sad :(", 1); |
||||||
|
|
||||||
|
// Create known-good buffers to verify our tests with other functions will produce the same results.
|
||||||
|
bytes_returned = LZ4_compress_default(src, known_good_dst, src_size, max_dst_size); |
||||||
|
if (bytes_returned < 1) |
||||||
|
run_screaming("Couldn't create a known-good destination buffer for comparison... this is bad.", 1); |
||||||
|
const size_t src_comp_size = bytes_returned; |
||||||
|
bytes_returned = LZ4_compress_default(hc_src, known_good_hc_dst, src_size, max_dst_size); |
||||||
|
if (bytes_returned < 1) |
||||||
|
run_screaming("Couldn't create a known-good (highly compressible) destination buffer for comparison... this is bad.", 1); |
||||||
|
const size_t hc_src_comp_size = bytes_returned; |
||||||
|
|
||||||
|
|
||||||
|
/* LZ4_compress_default() */ |
||||||
|
// This is the default function so we don't need to demonstrate how to use it. See basics.c if you need more basal information.
|
||||||
|
|
||||||
|
/* LZ4_compress_fast() */ |
||||||
|
// Using this function is identical to LZ4_compress_default except we need to specify an "acceleration" value. Defaults to 1.
|
||||||
|
memset(dst, 0, max_dst_size); |
||||||
|
bytes_returned = LZ4_compress_fast(src, dst, src_size, max_dst_size, 1); |
||||||
|
if (bytes_returned < 1) |
||||||
|
run_screaming("Failed to compress src using LZ4_compress_fast. echo $? for return code.", bytes_returned); |
||||||
|
if (memcmp(dst, known_good_dst, bytes_returned) != 0) |
||||||
|
run_screaming("According to memcmp(), the value we got in dst from LZ4_compress_fast doesn't match the known-good value. This is bad.", 1); |
||||||
|
|
||||||
|
/* LZ4_compress_fast_extState() */ |
||||||
|
// Using this function directly requires that we build an LZ4_stream_t struct ourselves. We do NOT have to reset it ourselves.
|
||||||
|
memset(dst, 0, max_dst_size); |
||||||
|
LZ4_stream_t state; |
||||||
|
bytes_returned = LZ4_compress_fast_extState(&state, src, dst, src_size, max_dst_size, 1); |
||||||
|
if (bytes_returned < 1) |
||||||
|
run_screaming("Failed to compress src using LZ4_compress_fast_extState. echo $? for return code.", bytes_returned); |
||||||
|
if (memcmp(dst, known_good_dst, bytes_returned) != 0) |
||||||
|
run_screaming("According to memcmp(), the value we got in dst from LZ4_compress_fast_extState doesn't match the known-good value. This is bad.", 1); |
||||||
|
|
||||||
|
/* LZ4_compress_generic */ |
||||||
|
// When you can exactly control the inputs and options of your LZ4 needs, you can use LZ4_compress_generic and fixed (const)
|
||||||
|
// values for the enum types such as dictionary and limitations. Any other direct-use is probably a bad idea.
|
||||||
|
//
|
||||||
|
// That said, the LZ4_compress_generic() function is 'static inline' and does not have a prototype in lz4.h to expose a symbol
|
||||||
|
// for it. In other words: we can't access it directly. I don't want to submit a PR that modifies lz4.c/h. Yann and others can
|
||||||
|
// do that if they feel it's worth expanding this example.
|
||||||
|
//
|
||||||
|
// I will, however, leave a skeleton of what would be required to use it directly:
|
||||||
|
/*
|
||||||
|
memset(dst, 0, max_dst_size); |
||||||
|
// LZ4_stream_t state: is already declared above. We can reuse it BUT we have to reset the stream ourselves between each call.
|
||||||
|
LZ4_resetStream((LZ4_stream_t *)&state); |
||||||
|
// Since src size is small we know the following enums will be used: notLimited (0), byU16 (2), noDict (0), noDictIssue (0).
|
||||||
|
bytes_returned = LZ4_compress_generic(&state, src, dst, src_size, max_dst_size, notLimited, byU16, noDict, noDictIssue, 1); |
||||||
|
if (bytes_returned < 1) |
||||||
|
run_screaming("Failed to compress src using LZ4_compress_generic. echo $? for return code.", bytes_returned); |
||||||
|
if (memcmp(dst, known_good_dst, bytes_returned) != 0) |
||||||
|
run_screaming("According to memcmp(), the value we got in dst from LZ4_compress_generic doesn't match the known-good value. This is bad.", 1); |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
/* Benchmarking */ |
||||||
|
/* Now we'll run a few rudimentary benchmarks with each function to demonstrate differences in speed based on the function used.
|
||||||
|
* Remember, we cannot call LZ4_compress_generic() directly (yet) so it's disabled. |
||||||
|
*/ |
||||||
|
// Suite A - Normal Compressibility
|
||||||
|
char *dst_d = calloc(1, src_size); |
||||||
|
memset(dst, 0, max_dst_size); |
||||||
|
printf("\nStarting suite A: Normal compressible text.\n"); |
||||||
|
uint64_t time_taken__default = bench(known_good_dst, ID__LZ4_COMPRESS_DEFAULT, iterations, src, dst, src_size, max_dst_size, src_comp_size); |
||||||
|
uint64_t time_taken__fast = bench(known_good_dst, ID__LZ4_COMPRESS_FAST, iterations, src, dst, src_size, max_dst_size, src_comp_size); |
||||||
|
uint64_t time_taken__fast_extstate = bench(known_good_dst, ID__LZ4_COMPRESS_FAST_EXTSTATE, iterations, src, dst, src_size, max_dst_size, src_comp_size); |
||||||
|
//uint64_t time_taken__generic = bench(known_good_dst, ID__LZ4_COMPRESS_GENERIC, iterations, src, dst, src_size, max_dst_size, src_comp_size);
|
||||||
|
uint64_t time_taken__decomp_safe = bench(src, ID__LZ4_DECOMPRESS_SAFE, iterations, known_good_dst, dst_d, src_size, max_dst_size, src_comp_size); |
||||||
|
uint64_t time_taken__decomp_fast = bench(src, ID__LZ4_DECOMPRESS_FAST, iterations, known_good_dst, dst_d, src_size, max_dst_size, src_comp_size); |
||||||
|
// Suite B - Highly Compressible
|
||||||
|
memset(dst, 0, max_dst_size); |
||||||
|
printf("\nStarting suite B: Highly compressible text.\n"); |
||||||
|
uint64_t time_taken_hc__default = bench(known_good_hc_dst, ID__LZ4_COMPRESS_DEFAULT, iterations, hc_src, dst, src_size, max_dst_size, hc_src_comp_size); |
||||||
|
uint64_t time_taken_hc__fast = bench(known_good_hc_dst, ID__LZ4_COMPRESS_FAST, iterations, hc_src, dst, src_size, max_dst_size, hc_src_comp_size); |
||||||
|
uint64_t time_taken_hc__fast_extstate = bench(known_good_hc_dst, ID__LZ4_COMPRESS_FAST_EXTSTATE, iterations, hc_src, dst, src_size, max_dst_size, hc_src_comp_size); |
||||||
|
//uint64_t time_taken_hc__generic = bench(known_good_hc_dst, ID__LZ4_COMPRESS_GENERIC, iterations, hc_src, dst, src_size, max_dst_size, hc_src_comp_size);
|
||||||
|
uint64_t time_taken_hc__decomp_safe = bench(hc_src, ID__LZ4_DECOMPRESS_SAFE, iterations, known_good_hc_dst, dst_d, src_size, max_dst_size, hc_src_comp_size); |
||||||
|
uint64_t time_taken_hc__decomp_fast = bench(hc_src, ID__LZ4_DECOMPRESS_FAST, iterations, known_good_hc_dst, dst_d, src_size, max_dst_size, hc_src_comp_size); |
||||||
|
|
||||||
|
// Report and leave.
|
||||||
|
setlocale(LC_ALL, ""); |
||||||
|
const char *format = "|%-14s|%-30s|%'14.9f|%'16d|%'14d|%'13.2f%%|\n"; |
||||||
|
const char *header_format = "|%-14s|%-30s|%14s|%16s|%14s|%14s|\n"; |
||||||
|
const char *separator = "+--------------+------------------------------+--------------+----------------+--------------+--------------+\n"; |
||||||
|
printf("\n"); |
||||||
|
printf("%s", separator); |
||||||
|
printf(header_format, "Source", "Function Benchmarked", "Total Seconds", "Iterations/sec", "ns/Iteration", "% of default"); |
||||||
|
printf("%s", separator); |
||||||
|
printf(format, "Normal Text", "LZ4_compress_default()", (double)time_taken__default / BILLION, (int)(iterations / ((double)time_taken__default /BILLION)), (int)time_taken__default / iterations, (double)time_taken__default * 100 / time_taken__default); |
||||||
|
printf(format, "Normal Text", "LZ4_compress_fast()", (double)time_taken__fast / BILLION, (int)(iterations / ((double)time_taken__fast /BILLION)), (int)time_taken__fast / iterations, (double)time_taken__fast * 100 / time_taken__default); |
||||||
|
printf(format, "Normal Text", "LZ4_compress_fast_extState()", (double)time_taken__fast_extstate / BILLION, (int)(iterations / ((double)time_taken__fast_extstate /BILLION)), (int)time_taken__fast_extstate / iterations, (double)time_taken__fast_extstate * 100 / time_taken__default); |
||||||
|
//printf(format, "Normal Text", "LZ4_compress_generic()", (double)time_taken__generic / BILLION, (int)(iterations / ((double)time_taken__generic /BILLION)), (int)time_taken__generic / iterations, (double)time_taken__generic * 100 / time_taken__default);
|
||||||
|
printf(format, "Normal Text", "LZ4_decompress_safe()", (double)time_taken__decomp_safe / BILLION, (int)(iterations / ((double)time_taken__decomp_safe /BILLION)), (int)time_taken__decomp_safe / iterations, (double)time_taken__decomp_safe * 100 / time_taken__default); |
||||||
|
printf(format, "Normal Text", "LZ4_decompress_fast()", (double)time_taken__decomp_fast / BILLION, (int)(iterations / ((double)time_taken__decomp_fast /BILLION)), (int)time_taken__decomp_fast / iterations, (double)time_taken__decomp_fast * 100 / time_taken__default); |
||||||
|
printf(header_format, "", "", "", "", "", ""); |
||||||
|
printf(format, "Compressible", "LZ4_compress_default()", (double)time_taken_hc__default / BILLION, (int)(iterations / ((double)time_taken_hc__default /BILLION)), (int)time_taken_hc__default / iterations, (double)time_taken_hc__default * 100 / time_taken_hc__default); |
||||||
|
printf(format, "Compressible", "LZ4_compress_fast()", (double)time_taken_hc__fast / BILLION, (int)(iterations / ((double)time_taken_hc__fast /BILLION)), (int)time_taken_hc__fast / iterations, (double)time_taken_hc__fast * 100 / time_taken_hc__default); |
||||||
|
printf(format, "Compressible", "LZ4_compress_fast_extState()", (double)time_taken_hc__fast_extstate / BILLION, (int)(iterations / ((double)time_taken_hc__fast_extstate /BILLION)), (int)time_taken_hc__fast_extstate / iterations, (double)time_taken_hc__fast_extstate * 100 / time_taken_hc__default); |
||||||
|
//printf(format, "Compressible", "LZ4_compress_generic()", (double)time_taken_hc__generic / BILLION, (int)(iterations / ((double)time_taken_hc__generic /BILLION)), (int)time_taken_hc__generic / iterations, (double)time_taken_hc__generic * 100 / time_taken_hc__default);
|
||||||
|
printf(format, "Compressible", "LZ4_decompress_safe()", (double)time_taken_hc__decomp_safe / BILLION, (int)(iterations / ((double)time_taken_hc__decomp_safe /BILLION)), (int)time_taken_hc__decomp_safe / iterations, (double)time_taken_hc__decomp_safe * 100 / time_taken_hc__default); |
||||||
|
printf(format, "Compressible", "LZ4_decompress_fast()", (double)time_taken_hc__decomp_fast / BILLION, (int)(iterations / ((double)time_taken_hc__decomp_fast /BILLION)), (int)time_taken_hc__decomp_fast / iterations, (double)time_taken_hc__decomp_fast * 100 / time_taken_hc__default); |
||||||
|
printf("%s", separator); |
||||||
|
printf("\n"); |
||||||
|
printf("All done, ran %d iterations per test.\n", iterations); |
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,280 @@ |
|||||||
|
// LZ4 API example : Dictionary Random Access
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER <= 1800) /* Visual Studio <= 2013 */ |
||||||
|
# define _CRT_SECURE_NO_WARNINGS |
||||||
|
# define snprintf sprintf_s |
||||||
|
#endif |
||||||
|
#include "lz4.h" |
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
#include <stdint.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
|
||||||
|
#define MIN(x, y) ((x) < (y) ? (x) : (y)) |
||||||
|
|
||||||
|
enum { |
||||||
|
BLOCK_BYTES = 1024, /* 1 KiB of uncompressed data in a block */ |
||||||
|
DICTIONARY_BYTES = 1024, /* Load a 1 KiB dictionary */ |
||||||
|
MAX_BLOCKS = 1024 /* For simplicity of implementation */ |
||||||
|
}; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Magic bytes for this test case. |
||||||
|
* This is not a great magic number because it is a common word in ASCII. |
||||||
|
* However, it is important to have some versioning system in your format. |
||||||
|
*/ |
||||||
|
const char kTestMagic[] = { 'T', 'E', 'S', 'T' }; |
||||||
|
|
||||||
|
|
||||||
|
void write_int(FILE* fp, int i) { |
||||||
|
size_t written = fwrite(&i, sizeof(i), 1, fp); |
||||||
|
if (written != 1) { exit(10); } |
||||||
|
} |
||||||
|
|
||||||
|
void write_bin(FILE* fp, const void* array, size_t arrayBytes) { |
||||||
|
size_t written = fwrite(array, 1, arrayBytes, fp); |
||||||
|
if (written != arrayBytes) { exit(11); } |
||||||
|
} |
||||||
|
|
||||||
|
void read_int(FILE* fp, int* i) { |
||||||
|
size_t read = fread(i, sizeof(*i), 1, fp); |
||||||
|
if (read != 1) { exit(12); } |
||||||
|
} |
||||||
|
|
||||||
|
size_t read_bin(FILE* fp, void* array, size_t arrayBytes) { |
||||||
|
size_t read = fread(array, 1, arrayBytes, fp); |
||||||
|
if (ferror(fp)) { exit(12); } |
||||||
|
return read; |
||||||
|
} |
||||||
|
|
||||||
|
void seek_bin(FILE* fp, long offset, int origin) { |
||||||
|
if (fseek(fp, offset, origin)) { exit(14); } |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_compress(FILE* outFp, FILE* inpFp, void *dict, int dictSize) |
||||||
|
{ |
||||||
|
LZ4_stream_t lz4Stream_body; |
||||||
|
LZ4_stream_t* lz4Stream = &lz4Stream_body; |
||||||
|
|
||||||
|
char inpBuf[BLOCK_BYTES]; |
||||||
|
int offsets[MAX_BLOCKS]; |
||||||
|
int *offsetsEnd = offsets; |
||||||
|
|
||||||
|
|
||||||
|
LZ4_initStream(lz4Stream, sizeof(*lz4Stream)); |
||||||
|
|
||||||
|
/* Write header magic */ |
||||||
|
write_bin(outFp, kTestMagic, sizeof(kTestMagic)); |
||||||
|
|
||||||
|
*offsetsEnd++ = sizeof(kTestMagic); |
||||||
|
/* Write compressed data blocks. Each block contains BLOCK_BYTES of plain
|
||||||
|
data except possibly the last. */ |
||||||
|
for(;;) { |
||||||
|
const int inpBytes = (int) read_bin(inpFp, inpBuf, BLOCK_BYTES); |
||||||
|
if(0 == inpBytes) { |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
/* Forget previously compressed data and load the dictionary */ |
||||||
|
LZ4_loadDict(lz4Stream, (const char*) dict, dictSize); |
||||||
|
{ |
||||||
|
char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)]; |
||||||
|
const int cmpBytes = LZ4_compress_fast_continue( |
||||||
|
lz4Stream, inpBuf, cmpBuf, inpBytes, sizeof(cmpBuf), 1); |
||||||
|
if(cmpBytes <= 0) { exit(1); } |
||||||
|
write_bin(outFp, cmpBuf, (size_t)cmpBytes); |
||||||
|
/* Keep track of the offsets */ |
||||||
|
*offsetsEnd = *(offsetsEnd - 1) + cmpBytes; |
||||||
|
++offsetsEnd; |
||||||
|
} |
||||||
|
if (offsetsEnd - offsets > MAX_BLOCKS) { exit(2); } |
||||||
|
} |
||||||
|
/* Write the tailing jump table */ |
||||||
|
{ |
||||||
|
int *ptr = offsets; |
||||||
|
while (ptr != offsetsEnd) { |
||||||
|
write_int(outFp, *ptr++); |
||||||
|
} |
||||||
|
write_int(outFp, (int) (offsetsEnd - offsets)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void test_decompress(FILE* outFp, FILE* inpFp, void *dict, int dictSize, int offset, int length) |
||||||
|
{ |
||||||
|
LZ4_streamDecode_t lz4StreamDecode_body; |
||||||
|
LZ4_streamDecode_t* lz4StreamDecode = &lz4StreamDecode_body; |
||||||
|
|
||||||
|
/* The blocks [currentBlock, endBlock) contain the data we want */ |
||||||
|
int currentBlock = offset / BLOCK_BYTES; |
||||||
|
int endBlock = ((offset + length - 1) / BLOCK_BYTES) + 1; |
||||||
|
|
||||||
|
char decBuf[BLOCK_BYTES]; |
||||||
|
int offsets[MAX_BLOCKS]; |
||||||
|
|
||||||
|
/* Special cases */ |
||||||
|
if (length == 0) { return; } |
||||||
|
|
||||||
|
/* Read the magic bytes */ |
||||||
|
{ |
||||||
|
char magic[sizeof(kTestMagic)]; |
||||||
|
size_t read = read_bin(inpFp, magic, sizeof(magic)); |
||||||
|
if (read != sizeof(magic)) { exit(1); } |
||||||
|
if (memcmp(kTestMagic, magic, sizeof(magic))) { exit(2); } |
||||||
|
} |
||||||
|
|
||||||
|
/* Read the offsets tail */ |
||||||
|
{ |
||||||
|
int numOffsets; |
||||||
|
int block; |
||||||
|
int *offsetsPtr = offsets; |
||||||
|
seek_bin(inpFp, -4, SEEK_END); |
||||||
|
read_int(inpFp, &numOffsets); |
||||||
|
if (numOffsets <= endBlock) { exit(3); } |
||||||
|
seek_bin(inpFp, -4 * (numOffsets + 1), SEEK_END); |
||||||
|
for (block = 0; block <= endBlock; ++block) { |
||||||
|
read_int(inpFp, offsetsPtr++); |
||||||
|
} |
||||||
|
} |
||||||
|
/* Seek to the first block to read */ |
||||||
|
seek_bin(inpFp, offsets[currentBlock], SEEK_SET); |
||||||
|
offset = offset % BLOCK_BYTES; |
||||||
|
|
||||||
|
/* Start decoding */ |
||||||
|
for(; currentBlock < endBlock; ++currentBlock) { |
||||||
|
char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)]; |
||||||
|
/* The difference in offsets is the size of the block */ |
||||||
|
int cmpBytes = offsets[currentBlock + 1] - offsets[currentBlock]; |
||||||
|
{ |
||||||
|
const size_t read = read_bin(inpFp, cmpBuf, (size_t)cmpBytes); |
||||||
|
if(read != (size_t)cmpBytes) { exit(4); } |
||||||
|
} |
||||||
|
|
||||||
|
/* Load the dictionary */ |
||||||
|
LZ4_setStreamDecode(lz4StreamDecode, (const char*) dict, dictSize); |
||||||
|
{ |
||||||
|
const int decBytes = LZ4_decompress_safe_continue( |
||||||
|
lz4StreamDecode, cmpBuf, decBuf, cmpBytes, BLOCK_BYTES); |
||||||
|
if(decBytes <= 0) { exit(5); } |
||||||
|
{ |
||||||
|
/* Write out the part of the data we care about */ |
||||||
|
int blockLength = MIN(length, (decBytes - offset)); |
||||||
|
write_bin(outFp, decBuf + offset, (size_t)blockLength); |
||||||
|
offset = 0; |
||||||
|
length -= blockLength; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int compare(FILE* fp0, FILE* fp1, int length) |
||||||
|
{ |
||||||
|
int result = 0; |
||||||
|
|
||||||
|
while(0 == result) { |
||||||
|
char b0[4096]; |
||||||
|
char b1[4096]; |
||||||
|
const size_t r0 = read_bin(fp0, b0, MIN(length, (int)sizeof(b0))); |
||||||
|
const size_t r1 = read_bin(fp1, b1, MIN(length, (int)sizeof(b1))); |
||||||
|
|
||||||
|
result = (int) r0 - (int) r1; |
||||||
|
|
||||||
|
if(0 == r0 || 0 == r1) { |
||||||
|
break; |
||||||
|
} |
||||||
|
if(0 == result) { |
||||||
|
result = memcmp(b0, b1, r0); |
||||||
|
} |
||||||
|
length -= r0; |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) |
||||||
|
{ |
||||||
|
char inpFilename[256] = { 0 }; |
||||||
|
char lz4Filename[256] = { 0 }; |
||||||
|
char decFilename[256] = { 0 }; |
||||||
|
char dictFilename[256] = { 0 }; |
||||||
|
int offset; |
||||||
|
int length; |
||||||
|
char dict[DICTIONARY_BYTES]; |
||||||
|
int dictSize; |
||||||
|
|
||||||
|
if(argc < 5) { |
||||||
|
printf("Usage: %s input dictionary offset length", argv[0]); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
snprintf(inpFilename, 256, "%s", argv[1]); |
||||||
|
snprintf(lz4Filename, 256, "%s.lz4s-%d", argv[1], BLOCK_BYTES); |
||||||
|
snprintf(decFilename, 256, "%s.lz4s-%d.dec", argv[1], BLOCK_BYTES); |
||||||
|
snprintf(dictFilename, 256, "%s", argv[2]); |
||||||
|
offset = atoi(argv[3]); |
||||||
|
length = atoi(argv[4]); |
||||||
|
|
||||||
|
printf("inp = [%s]\n", inpFilename); |
||||||
|
printf("lz4 = [%s]\n", lz4Filename); |
||||||
|
printf("dec = [%s]\n", decFilename); |
||||||
|
printf("dict = [%s]\n", dictFilename); |
||||||
|
printf("offset = [%d]\n", offset); |
||||||
|
printf("length = [%d]\n", length); |
||||||
|
|
||||||
|
/* Load dictionary */ |
||||||
|
{ |
||||||
|
FILE* dictFp = fopen(dictFilename, "rb"); |
||||||
|
dictSize = (int)read_bin(dictFp, dict, DICTIONARY_BYTES); |
||||||
|
fclose(dictFp); |
||||||
|
} |
||||||
|
|
||||||
|
/* compress */ |
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* outFp = fopen(lz4Filename, "wb"); |
||||||
|
|
||||||
|
printf("compress : %s -> %s\n", inpFilename, lz4Filename); |
||||||
|
test_compress(outFp, inpFp, dict, dictSize); |
||||||
|
printf("compress : done\n"); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
/* decompress */ |
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(lz4Filename, "rb"); |
||||||
|
FILE* outFp = fopen(decFilename, "wb"); |
||||||
|
|
||||||
|
printf("decompress : %s -> %s\n", lz4Filename, decFilename); |
||||||
|
test_decompress(outFp, inpFp, dict, DICTIONARY_BYTES, offset, length); |
||||||
|
printf("decompress : done\n"); |
||||||
|
|
||||||
|
fclose(outFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
/* verify */ |
||||||
|
{ |
||||||
|
FILE* inpFp = fopen(inpFilename, "rb"); |
||||||
|
FILE* decFp = fopen(decFilename, "rb"); |
||||||
|
seek_bin(inpFp, offset, SEEK_SET); |
||||||
|
|
||||||
|
printf("verify : %s <-> %s\n", inpFilename, decFilename); |
||||||
|
const int cmp = compare(inpFp, decFp, length); |
||||||
|
if(0 == cmp) { |
||||||
|
printf("verify : OK\n"); |
||||||
|
} else { |
||||||
|
printf("verify : NG\n"); |
||||||
|
} |
||||||
|
|
||||||
|
fclose(decFp); |
||||||
|
fclose(inpFp); |
||||||
|
} |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue