From f55830dba54e2a45984ea36d759962d19d723ea1 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 27 Jan 2011 06:45:53 +0000 Subject: [PATCH] workaround-32bit-size_t.patch Signed-off-by: Andy Green --- lib/parsers.c | 20 ++++++++++++++++++++ libwebsockets.spec | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/parsers.c b/lib/parsers.c index 8d56221..d023e9b 100644 --- a/lib/parsers.c +++ b/lib/parsers.c @@ -442,22 +442,32 @@ static int libwebsocket_rx_sm(struct libwebsocket *wsi, unsigned char c) /* kill the connection */ return -1; } +#if defined __LP64__ wsi->rx_packet_length = ((size_t)c) << 56; +#else + wsi->rx_packet_length = 0; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_7; break; case LWS_RXPS_04_FRAME_HDR_LEN64_7: +#if defined __LP64__ wsi->rx_packet_length |= ((size_t)xor_mask(wsi, c)) << 48; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_6; break; case LWS_RXPS_04_FRAME_HDR_LEN64_6: +#if defined __LP64__ wsi->rx_packet_length |= ((size_t)xor_mask(wsi, c)) << 40; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_5; break; case LWS_RXPS_04_FRAME_HDR_LEN64_5: +#if defined __LP64__ wsi->rx_packet_length |= ((size_t)xor_mask(wsi, c)) << 32; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_4; break; @@ -742,22 +752,32 @@ int libwebsocket_client_rx_sm(struct libwebsocket *wsi, unsigned char c) /* kill the connection */ return -1; } +#if defined __LP64__ wsi->rx_packet_length = ((size_t)c) << 56; +#else + wsi->rx_packet_length =0; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_7; break; case LWS_RXPS_04_FRAME_HDR_LEN64_7: +#if defined __LP64__ wsi->rx_packet_length |= ((size_t)c) << 48; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_6; break; case LWS_RXPS_04_FRAME_HDR_LEN64_6: +#if defined __LP64__ wsi->rx_packet_length |= ((size_t)c) << 40; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_5; break; case LWS_RXPS_04_FRAME_HDR_LEN64_5: +#if defined __LP64__ wsi->rx_packet_length |= ((size_t)c) << 32; +#endif wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_4; break; diff --git a/libwebsockets.spec b/libwebsockets.spec index de0c003..e2e489e 100644 --- a/libwebsockets.spec +++ b/libwebsockets.spec @@ -1,6 +1,6 @@ Name: libwebsockets Version: 0.1 -Release: 41.gmaster_91ef816b%{?dist} +Release: 43.gmaster_b6e6ebee%{?dist} Summary: Websocket Server Library Group: System -- 2.7.4