[gnutls-devel] Moving defines (3.4) to enum (3.5.) in header files needs discussion...
tim.ruehsen at gmx.de
Wed Jul 20 13:41:51 CEST 2016
On Wednesday, July 20, 2016 1:28:42 PM CEST Nikos Mavrogiannopoulos wrote:
> On Wed, Jul 20, 2016 at 12:30 PM, Tim Ruehsen <tim.ruehsen at gmx.de> wrote:
> > Hi Nikos,
> > I just realized that you turned several defines into enums with GnuTLS
> > 3.5.x. This simply breaks existing code (e.g. wget2) and took me a while
> > to find out.
> > Example:
> > #ifdef GNUTLS_NONBLOCK
> > gnutls_init(&session, GNUTLS_CLIENT | GNUTLS_NONBLOCK);
> > #else
> > // very old gnutls version, likely to not work.
> > gnutls_init(&session, GNUTLS_CLIENT);
> > #endif
> You're right, that's an unintended side effect. A solution for gnutls'
> code is to redefine these as in:
Yes thanks, that should do it :-) And if it still works for the docs, it seems
to be perfect.
> For your code, you may want to use instead:
> #if GNUTLS_VERSION_NUMBER > 0x030000
> which is part of the documented API.
Right. I just don't know when GNUTLS_NONBLOCK has been invented, so I do
#if GNUTLS_VERSION_NUMBER >= 0x030500
// 3.5+ code
// pre 3.5 code
// legacy code
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: This is a digitally signed message part.
More information about the Gnutls-devel