From 2bfddff10c5fb6dc04d5f00ce684bb4d13a6e6d8 Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 4 Apr 2024 00:12:34 +0200 Subject: [PATCH] Minor updates. --- README.md | 32 ++++++++++++++++++++++++++------ test/test_zstd.f90 | 8 ++++---- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1563d86..e977cc0 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,35 @@ # fortran-zstd A collection of Fortran 2018 interface bindings to selected -[Zstandard](http://www.zstd.net/) functions (zstd ⩾ 1.5.5). In comparison to -the original C API, the Fortran interfaces, types, and arguments have been -converted to snake case. See [COVERAGE](COVERAGE.md) for an overview of bound -procedures. +[Zstandard](http://www.zstd.net/) functions (zstd ≥ 1.5.5). In comparison to the +original C API, the Fortran interfaces, types, and arguments have been converted +to snake case. See [COVERAGE](COVERAGE.md) for an overview of bound procedures. ## Build Instructions -The zstd library has to be installed with development headers. Build and -install the Fortran library using the provided Makefile: +The zstd library has to be installed with development headers. On FreeBSD, run: + +``` +# pkg install archivers/zstd +``` + +On Linux, instead: + +``` +# apt-get install libzstd1 libzstd-dev +``` + +Or, to build and install the zstd library from source: + +``` +$ cd /tmp/ +$ git clone --depth 1 https://github.com/facebook/zstd +$ cd zstd/build/cmake/ +$ cmake --build . --config Release +$ sudo cmake --install . --prefix /usr/local +``` + +Build and install the Fortran library using the provided Makefile: ``` $ make diff --git a/test/test_zstd.f90 b/test/test_zstd.f90 index 08ab07d..fdc0dab 100644 --- a/test/test_zstd.f90 +++ b/test/test_zstd.f90 @@ -208,9 +208,9 @@ logical function test_stream() result(success) last_chunk = (nbytes < to_read) ! Select the flush mode. If the read may not be finished - ! (read == toRead) we use ZSTD_E_CONTINUE. If this is the last - ! chunk, we use ZSTD_E_END. Zstd optimises the case where the - ! first flush mode is ZSTD_E_END, since it knows it is + ! (nbytes == to_read) we use ZSTD_E_CONTINUE. If this is the + ! last chunk, we use ZSTD_E_END. Zstd optimises the case where + ! the first flush mode is ZSTD_E_END, since it knows it is ! compressing the entire source in one pass. if (last_chunk) then mode = ZSTD_E_END @@ -309,7 +309,7 @@ logical function test_stream() result(success) ! Given a valid frame, zstd won't consume the last byte of the frame ! until it has flushed all of the decompressed data of the frame. ! Therefore, instead of checking if the return code is 0, we can - ! decompress just check if input.pos < input.size. + ! decompress just check if input%pos < input%size. do while (input%pos < input%size) output = zstd_out_buffer_type(c_loc(buf_out), buf_out_sz, 0)