Re: [PATCH v3 06/10] compat/zlib: provide stubs for `deflateSetHeader()`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 28, 2025, 08:35 UTC
- Message-ID
- <Z5iW3utsn6j3lbRh@pks.im>
- In-Reply-To
- <n64enlt3wcjftyz74evkdh53romwvmnwwd4qdpfaw6jedktcvh@fdy2zmdgmqm2>
On Sun, Jan 26, 2025 at 06:56:40PM -0600, Justin Tobler wrote:
Show 28 quoted lines
> On 25/01/16 10:17AM, Patrick Steinhardt wrote:
> > diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h
> > index 96a08811a9..2690bfce41 100644
> > --- a/compat/zlib-compat.h
> > +++ b/compat/zlib-compat.h
> > @@ -7,4 +7,17 @@
> > # define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
> > #endif
> >
> > +#if ZLIB_VERNUM < 0x1221
> > +struct gz_header_s {
> > + int os;
> > +};
> > +
> > +static int deflateSetHeader(z_streamp strm, struct gz_header_s *head)
> > +{
> > + (void)(strm);
> > + (void)(head);
> > + return Z_OK;
> > +}
> > +#endif
> > +
> > #endif /* COMPAT_ZLIB_H */
>
> In zlib versions under 1.2.2.1, `gz_header_s` and `deflateSetHeader()`
> are not defined. It looks like we are defining them here, but so they
> behave as a no-op where used. If I'm understanding this correctly, it
> might be nice to have a comment explaining the no-op component.It's non-obvious why skipping the logic would be fine, so explicitly documenting makes sense indeed.
Patrick