diff --git a/sources b/sources index b3e4d5b..7d2ab3f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (zstr-1.1.0.tar.gz) = 21778d2b07c30da4fb9ee35832f39b02c95e54478c6610e28cece98908c51bcee6aed0754ec3948b71aa1e671a3d15ff2b555369379dc4583048c76d2b8305e8 +SHA512 (zstr-1.0.7.tar.gz) = 3017da244810a45f7111f76f8d0dd988e162f08eab28b7465cad4549d84200fc834975275daf9588d35c6125e6f167c1e2dd5ec18022dac1eceabdc24d24cffe diff --git a/zstr-zlib-ng.patch b/zstr-zlib-ng.patch index 6dfaf22..5c2e9ec 100644 --- a/zstr-zlib-ng.patch +++ b/zstr-zlib-ng.patch @@ -1,5 +1,5 @@ ---- zstr-1.1.0/CMakeLists.txt.orig 2025-10-20 09:17:37.000000000 -0600 -+++ zstr-1.1.0/CMakeLists.txt 2025-10-20 11:45:56.725568759 -0600 +--- zstr-1.0.7/CMakeLists.txt.orig 2022-12-06 02:31:27.000000000 -0700 ++++ zstr-1.0.7/CMakeLists.txt 2024-09-18 13:17:30.552013743 -0600 @@ -16,8 +16,8 @@ endif() # -- locate zlib @@ -36,18 +36,18 @@ + libraries: zlib-ng::zlib features : cxx_std_11" ) ---- zstr-1.1.0/src/zstr.hpp.orig 2025-10-20 09:17:37.000000000 -0600 -+++ zstr-1.1.0/src/zstr.hpp 2025-10-20 11:49:38.553413378 -0600 -@@ -15,7 +15,7 @@ - #ifdef MINIZ - #include - #else +--- zstr-1.0.7/src/zstr.hpp.orig 2022-12-06 02:31:27.000000000 -0700 ++++ zstr-1.0.7/src/zstr.hpp 2024-09-18 14:09:15.735533320 -0600 +@@ -11,7 +11,7 @@ + #include + #include + #include -#include +#include - #endif #include #include -@@ -39,7 +39,7 @@ class Exception + #include "strict_fstream.hpp" +@@ -34,7 +34,7 @@ class Exception : public std::ios_base::failure { public: @@ -56,7 +56,7 @@ { std::string msg = "zlib: "; switch (ret) -@@ -81,7 +81,7 @@ public: +@@ -76,7 +76,7 @@ public: return msg; } @@ -65,8 +65,8 @@ : std::ios_base::failure(error_to_message(zstrm_p, ret)) { } -@@ -164,7 +164,7 @@ namespace WindowBits { - } // namespace WindowBits +@@ -86,7 +86,7 @@ namespace detail + { class z_stream_wrapper - : public z_stream @@ -74,21 +74,21 @@ { public: z_stream_wrapper(bool _is_input, int _level, int _window_bits) -@@ -178,11 +178,11 @@ public: +@@ -100,11 +100,11 @@ public: { this->avail_in = 0; this->next_in = nullptr;//Z_NULL -- ret = inflateInit2(this, _window_bits ? _window_bits : WindowBits::ZLIB_OR_GZIP::MAX); -+ ret = zng_inflateInit2(this, _window_bits ? _window_bits : WindowBits::ZLIB_OR_GZIP::MAX); +- ret = inflateInit2(this, _window_bits ? _window_bits : 15+32); ++ ret = zng_inflateInit2(this, _window_bits ? _window_bits : 15+32); } else { -- ret = deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : WindowBits::GZIP::MAX, 8, Z_DEFAULT_STRATEGY); -+ ret = zng_deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : WindowBits::GZIP::MAX, 8, Z_DEFAULT_STRATEGY); +- ret = deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : 15+16, 8, Z_DEFAULT_STRATEGY); ++ ret = zng_deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : 15+16, 8, Z_DEFAULT_STRATEGY); } if (ret != Z_OK) throw Exception(this, ret); } -@@ -190,11 +190,11 @@ public: +@@ -112,11 +112,11 @@ public: { if (is_input) { @@ -102,7 +102,7 @@ } } private: -@@ -323,7 +323,7 @@ public: +@@ -187,15 +187,15 @@ public: // empty input buffer: refill from the start in_buff_start = in_buff.get(); std::streamsize sz = sbuf_p->sgetn(in_buff.get(), static_cast(buff_size)); @@ -111,7 +111,17 @@ if (in_buff_end == in_buff_start) break; // end of input } // auto detect if the stream contains text or deflate data -@@ -349,7 +349,7 @@ public: + if (auto_detect && ! auto_detect_run) + { + auto_detect_run = true; +- unsigned char b0 = *reinterpret_cast< unsigned char * >(in_buff_start); +- unsigned char b1 = *reinterpret_cast< unsigned char * >(in_buff_start + 1); ++ unsigned char b0 = *reinterpret_cast< const unsigned char * >(in_buff_start); ++ unsigned char b1 = *reinterpret_cast< const unsigned char * >(in_buff_start + 1); + // Ref: + // http://en.wikipedia.org/wiki/Gzip + // http://stackoverflow.com/questions/9050260/what-does-a-zlib-header-look-like +@@ -222,12 +222,12 @@ public: zstrm_p->avail_in = uint32_t(in_buff_end - in_buff_start); zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff_free_start); zstrm_p->avail_out = uint32_t((out_buff.get() + buff_size) - out_buff_free_start); @@ -120,16 +130,13 @@ // process return code if (ret != Z_OK && ret != Z_STREAM_END) throw Exception(zstrm_p.get(), ret); // update in&out pointers following inflate() -@@ -360,7 +360,7 @@ public: - zstrm_p->next_in - #endif - ); + in_buff_start = reinterpret_cast< decltype(in_buff_start) >(zstrm_p->next_in); - in_buff_end = in_buff_start + zstrm_p->avail_in; + in_buff_end = const_cast(in_buff_start) + zstrm_p->avail_in; out_buff_free_start = reinterpret_cast< decltype(out_buff_free_start) >(zstrm_p->next_out); assert(out_buff_free_start + zstrm_p->avail_out == out_buff.get() + buff_size); -@@ -382,7 +382,7 @@ public: +@@ -249,7 +249,7 @@ public: private: std::streambuf * sbuf_p; std::unique_ptr in_buff; @@ -138,7 +145,7 @@ char * in_buff_end; std::unique_ptr out_buff; std::unique_ptr zstrm_p; -@@ -424,7 +424,7 @@ public: +@@ -288,7 +288,7 @@ public: { zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff.get()); zstrm_p->avail_out = uint32_t(buff_size); @@ -147,7 +154,7 @@ if (ret != Z_OK && ret != Z_STREAM_END && ret != Z_BUF_ERROR) { failed = true; throw Exception(zstrm_p.get(), ret); -@@ -492,7 +492,7 @@ public: +@@ -346,7 +346,7 @@ public: zstrm_p->next_in = nullptr; zstrm_p->avail_in = 0; if (deflate_loop(Z_FINISH) != 0) return -1; diff --git a/zstr.spec b/zstr.spec index 37676d8..48fe96b 100644 --- a/zstr.spec +++ b/zstr.spec @@ -1,11 +1,8 @@ # There are no ELF objects in this package, so turn off debuginfo generation. %global debug_package %{nil} -# Whether to run tests -%bcond ctest 1 - Name: zstr -Version: 1.1.0 +Version: 1.0.7 Release: %autorelease Summary: A C++ header-only ZLib wrapper @@ -16,25 +13,25 @@ Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz # Use zlib-ng directly rather than via the compatibility interface Patch: %{name}-zlib-ng.patch -BuildSystem: cmake - +BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig(zlib-ng) # See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} -%global _desc %{expand:This C++ header-only library enables the use of C++ standard iostreams to -access ZLib-compressed streams. +%global _desc %{expand: +This C++ header-only library enables the use of C++ standard iostreams +to access ZLib-compressed streams. -For input access (decompression), the compression format is auto-detected, and -multiple concatenated compressed streams are decompressed seamlessly. +For input access (decompression), the compression format is +auto-detected, and multiple concatenated compressed streams are +decompressed seamlessly. -For output access (compression), the only parameter exposed by this API is the -compression level.} +For output access (compression), the only parameter exposed by this API +is the compression level.} -%description -%_desc +%description %_desc %package devel Summary: A C++ header-only ZLib wrapper @@ -42,17 +39,23 @@ BuildArch: noarch Requires: pkgconfig(zlib-ng) Provides: %{name}-static = %{version}-%{release} -%description devel -%_desc +%description devel %_desc %prep %autosetup -p1 +%build +%cmake +%cmake_build + %install #%%cmake_install does nothing, so install manually mkdir -p %{buildroot}%{_includedir}/zstr install -m 0644 -p src/*.hpp %{buildroot}%{_includedir}/zstr +%check +%ctest + %files devel %doc README.org %license LICENSE