[Libwebsockets] warning C4244: 'return' : conversion from 'lws_filepos_t' to 'size_t', possible loss of data
andy at warmcat.com
Thu Apr 26 03:23:48 CEST 2018
On 04/26/2018 06:20 AM, jon at keyonsec.com wrote:
> Hello all,
> I’m compiling websockets 2.4 in 32-bit Microsoft Visual C (v11) and
> noticed this warning message. Can someone clarify if I should change
> some code to alleviate the warning? Or should I typecast?
> Function below. Please advise.
> LWS_VISIBLE size_t
Well, this is master, but no worries.
This is only used on http/2 at the minute, which in the standard defines
the tx credit to be a 32-bit signed int.
> lws_get_peer_write_allowance(structlws *wsi)
> return wsi->role_ops->tx_credit(wsi); // This line is giving me the warning
With the refactor to put all this stuff into role ops, inside it uses a
larger type (now ultimately long long) since it may meet other role
protocols than h2. size_t matches the length of that on linux x86_64
but not on windows.
I pushed a fix changing the return type on the public api from size_t to
lws_fileofs_t, which is ultimately long long, matching the internal role
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets