LCOV - code coverage report
Current view: top level - libs/http_proto/src_zlib/service/inflate_service.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 0.0 % 60 0
Test Date: 2025-05-26 06:53:20 Functions: 0.0 % 21 0

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
       3              : //
       4              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6              : //
       7              : // Official repository: https://github.com/cppalliance/http_proto
       8              : //
       9              : 
      10              : #include <boost/http_proto/service/inflate_service.hpp>
      11              : #include <zlib.h>
      12              : #include "src_zlib/service/stream_cast.hpp"
      13              : 
      14              : namespace boost {
      15              : namespace http_proto {
      16              : namespace zlib {
      17              : 
      18              : //------------------------------------------------
      19              : 
      20              : class inflate_service_impl
      21              :     : public inflate_service
      22              :     , public http_proto::service
      23              : {
      24              : public:
      25              :     using key_type = inflate_service;
      26              : 
      27              :     explicit
      28            0 :     inflate_service_impl(
      29              :         http_proto::context&) noexcept
      30            0 :     {
      31            0 :     }
      32              : 
      33            0 :     ~inflate_service_impl()
      34            0 :     {
      35            0 :     }
      36              : 
      37              :     char const*
      38            0 :     version() const noexcept override
      39              :     {
      40            0 :         return zlibVersion();
      41              :     }
      42              : 
      43              :     int
      44            0 :     init(
      45              :         stream_t& st) const override
      46              :     {
      47            0 :         stream_cast sc(st);
      48            0 :         return inflateInit(sc.get());
      49              :     }
      50              : 
      51              :     int
      52            0 :     init2(
      53              :         stream_t& st,
      54              :         int windowBits) const override
      55              :     {
      56            0 :         stream_cast sc(st);
      57            0 :         return inflateInit2(sc.get(), windowBits);
      58              :     }
      59              : 
      60              :     int
      61            0 :     inflate(
      62              :         stream_t& st,
      63              :         int flush) const override
      64              :     {
      65            0 :         stream_cast sc(st);
      66            0 :         return ::inflate(sc.get(), flush);
      67              :     }
      68              : 
      69              :     int
      70            0 :     inflate_end(
      71              :         stream_t& st) const override
      72              :     {
      73            0 :         stream_cast sc(st);
      74            0 :         return inflateEnd(sc.get());
      75              :     }
      76              : 
      77              :     int
      78            0 :     set_dict(
      79              :         stream_t& st,
      80              :         unsigned char const* dict,
      81              :         unsigned len) const override
      82              :     {
      83            0 :         stream_cast sc(st);
      84            0 :         return inflateSetDictionary(sc.get(), dict, len);
      85              :     }
      86              : 
      87              :     int
      88            0 :     get_dict(
      89              :         stream_t& st,
      90              :         unsigned char* dest,
      91              :         unsigned* len) const override
      92              :     {
      93            0 :         stream_cast sc(st);
      94            0 :         return inflateGetDictionary(sc.get(), dest, len);
      95              :     }
      96              : 
      97              :     int
      98            0 :     sync(
      99              :         stream_t& st) const override
     100              :     {
     101            0 :         stream_cast sc(st);
     102            0 :         return inflateSync(sc.get());
     103              :     }
     104              : 
     105              :     int
     106            0 :     dup(
     107              :         stream_t& dest,
     108              :         stream_t& src) const override
     109              :     {
     110            0 :         stream_cast sc0(dest);
     111            0 :         stream_cast sc1(src);
     112            0 :         return inflateCopy(sc0.get(), sc1.get());
     113              :     }
     114              : 
     115              :     int
     116            0 :     reset(
     117              :         stream_t& st) const override
     118              :     {
     119            0 :         stream_cast sc(st);
     120            0 :         return inflateReset(sc.get());
     121              :     }
     122              : 
     123              :     int
     124            0 :     reset2(
     125              :         stream_t& st,
     126              :         int windowBits) const override
     127              :     {
     128            0 :         stream_cast sc(st);
     129            0 :         return inflateReset2(sc.get(), windowBits);
     130              :     }
     131              : 
     132              :     int
     133            0 :     prime(
     134              :         stream_t& st,
     135              :         int bits,
     136              :         int value) const override
     137              :     {
     138            0 :         stream_cast sc(st);
     139            0 :         return inflatePrime(sc.get(), bits, value);
     140              :     }
     141              : 
     142              :     long
     143            0 :     mark(
     144              :         stream_t& st) const override
     145              :     {
     146            0 :         stream_cast sc(st);
     147            0 :         return inflateMark(sc.get());
     148              :     }
     149              : 
     150              :     int
     151            0 :     get_header(
     152              :         stream_t& st,
     153              :         void* header) const override
     154              :     {
     155            0 :         stream_cast sc(st);
     156            0 :         return inflateGetHeader(sc.get(),
     157            0 :             reinterpret_cast<gz_headerp>(header));
     158              :     }
     159              : 
     160              :     int
     161            0 :     back_init(
     162              :         stream_t& st,
     163              :         int windowBits,
     164              :         unsigned char* window) const override
     165              :     {
     166            0 :         stream_cast sc(st);
     167            0 :         return inflateBackInit(sc.get(), windowBits, window);
     168              :     }
     169              : 
     170              :     int
     171            0 :     back_end(
     172              :         stream_t& st) const override
     173              :     {
     174            0 :         stream_cast sc(st);
     175            0 :         return inflateBackEnd(sc.get());
     176              :     }
     177              : 
     178              :     unsigned long
     179            0 :     compile_flags() const override
     180              :     {
     181            0 :         return zlibCompileFlags();
     182              :     }
     183              : };
     184              : 
     185              : void
     186            0 : install_inflate_service(context& ctx)
     187              : {
     188            0 :     ctx.make_service<inflate_service_impl>();
     189            0 : }
     190              : 
     191              : } // zlib
     192              : } // http_proto
     193              : } // boost
        

Generated by: LCOV version 2.1