mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
coverity: change ss handle priv style
Coverity is able to misunderstand &h[1] to be a dereference of h, when it is just (h + 1). Adapt places where we use this style to get a pointer to the SS priv data to use (h + 1) so we don't have to see any more of coverity's confusion.
This commit is contained in:
parent
310c8baa81
commit
1b77c2ff4c
3 changed files with 10 additions and 10 deletions
|
@ -52,7 +52,7 @@ secstream_h2(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
|||
*/
|
||||
lwsl_info("%s: reporting initial tx cr from server %d\n",
|
||||
__func__, wsi->txc.tx_cr);
|
||||
ss_proxy_onward_txcr((void *)&h[1], wsi->txc.tx_cr);
|
||||
ss_proxy_onward_txcr((void *)(h + 1), wsi->txc.tx_cr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -106,7 +106,7 @@ secstream_h2(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
|||
#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
|
||||
if (h->being_serialized)
|
||||
/* we are the proxy-side SS for a remote client */
|
||||
ss_proxy_onward_txcr((void *)&h[1], (int)len);
|
||||
ss_proxy_onward_txcr((void *)(h + 1), (int)len);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ lws_sspc_event_helper(lws_sspc_handle_t *h, lws_ss_constate_t cs,
|
|||
return LWSSSSRET_OK;
|
||||
|
||||
h->h_in_svc = h;
|
||||
ret = h->ssi.state((void *)((uint8_t *)&h[1]), NULL, cs, flags);
|
||||
ret = h->ssi.state((void *)((uint8_t *)(h + 1)), NULL, cs, flags);
|
||||
h->h_in_svc = NULL;
|
||||
|
||||
return ret;
|
||||
|
@ -201,7 +201,7 @@ callback_sspc_client(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
{
|
||||
lws_sspc_handle_t *h = (lws_sspc_handle_t *)lws_get_opaque_user_data(wsi);
|
||||
size_t pktsize = wsi->a.context->max_http_header_data;
|
||||
void *m = (void *)((uint8_t *)&h[1]);
|
||||
void *m = (void *)((uint8_t *)(h + 1));
|
||||
uint8_t *pkt = NULL, *p = NULL, *end = NULL;
|
||||
lws_ss_state_return_t r;
|
||||
uint64_t interval;
|
||||
|
@ -661,7 +661,7 @@ lws_sspc_create(struct lws_context *context, int tsi, const lws_ss_info_t *ssi,
|
|||
ssi->streamtype);
|
||||
|
||||
memcpy(&h->ssi, ssi, sizeof(*ssi));
|
||||
ua = (uint8_t *)&h[1];
|
||||
ua = (uint8_t *)(h + 1);
|
||||
memset(ua, 0, ssi->user_alloc);
|
||||
p = (char *)ua + ssi->user_alloc;
|
||||
memcpy(p, ssi->streamtype, strlen(ssi->streamtype) + 1);
|
||||
|
@ -1070,7 +1070,7 @@ lws_sspc_cancel_timeout(struct lws_sspc_handle *h)
|
|||
void *
|
||||
lws_sspc_to_user_object(struct lws_sspc_handle *h)
|
||||
{
|
||||
return (void *)&h[1];
|
||||
return (void *)(h + 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -614,7 +614,7 @@ lws_smd_ss_cb(void *opaque, lws_smd_class_t _class,
|
|||
lws_ser_wu64be(p + 8, (uint64_t)timestamp);
|
||||
|
||||
if (h->info.rx)
|
||||
h->info.rx((void *)&h[1], p, len + LWS_SMD_SS_RX_HEADER_LEN,
|
||||
h->info.rx((void *)(h + 1), p, len + LWS_SMD_SS_RX_HEADER_LEN,
|
||||
LWSSS_FLAG_SOM | LWSSS_FLAG_EOM);
|
||||
|
||||
return 0;
|
||||
|
@ -634,7 +634,7 @@ lws_ss_smd_tx_cb(lws_sorted_usec_list_t *sul)
|
|||
if (!h->info.tx)
|
||||
return;
|
||||
|
||||
n = h->info.tx(&h[1], h->txord++, buf, &len, &flags);
|
||||
n = h->info.tx((h + 1), h->txord++, buf, &len, &flags);
|
||||
if (n)
|
||||
/* nonzero return means don't want to send anything */
|
||||
return;
|
||||
|
@ -1072,7 +1072,7 @@ lws_ss_create(struct lws_context *context, int tsi, const lws_ss_info_t *ssi,
|
|||
h->proxy_onward = 1;
|
||||
|
||||
/* start of overallocated area */
|
||||
p = (char *)&h[1];
|
||||
p = (char *)(h + 1);
|
||||
|
||||
/* set the handle pointer in the user data struct */
|
||||
v = (void **)(p + ssi->handle_offset);
|
||||
|
@ -1350,7 +1350,7 @@ fail_creation:
|
|||
void *
|
||||
lws_ss_to_user_object(struct lws_ss_handle *h)
|
||||
{
|
||||
return (void *)&h[1];
|
||||
return (void *)(h + 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Reference in a new issue