[Libwebsockets] Typo in _LWS_PAD

Bruce Perens bruce at perens.com
Thu Oct 15 17:00:14 CEST 2015


My fault. I should remember that you always parenthesize macro arguments.

On Thu, Oct 15, 2015 at 6:10 AM, Andy Green <andy at warmcat.com> wrote:

>
>
> On 15 October 2015 19:41:10 GMT+09:00, Stepan Vondrak <
> stepanvondrak at slightlymadstudios.com> wrote:
> >Hi all,
> >
> >After updating to latest sources Visual Studio 2015 started complaining
> >
> >about LWS_SEND_BUFFER_PRE_PADDING. Looking at the sources, I noticed a
> >probable typo in _LWS_PAD definition:
> >    #define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? (n + (_LWS_PAD_SIZE -
> >(n % _LWS_PAD_SIZE))) : (n))
> >To be specific, this
> >     (n % _LWS_PAD_SIZE)
> >expands to
> >     (4 + 10 + (2 * MAX_MUX_RECURSION) % _LWS_PAD_SIZE)
> >which is probably not intended.
> >
> >Fixing the define to
> >    #define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? ((n) + (_LWS_PAD_SIZE
> >- ((n) % _LWS_PAD_SIZE))) : (n))
> >makes the warnings go away and the value evaluates correctly to 20
> >again
> >in 32-builds.
>
> Ah thanks for finding it.  It's like the universe naturally leads us to
> inline functions.
>
> I pushed it.
>
> -Andy
>
> >Cheers,
> >Stepan
> >
> >_______________________________________________
> >Libwebsockets mailing list
> >Libwebsockets at ml.libwebsockets.org
> >http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20151015/6cd0ffb6/attachment-0001.html>


More information about the Libwebsockets mailing list