[Libwebsockets] Typo in _LWS_PAD

Andy Green andy at warmcat.com
Thu Oct 15 15:10:36 CEST 2015



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




More information about the Libwebsockets mailing list