1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

gcc- format strings: debug and extra plugins

This commit is contained in:
Andy Green 2017-02-05 22:07:34 +08:00
parent be1f0a3a92
commit ce37ee9624
17 changed files with 34 additions and 35 deletions

View file

@ -32,7 +32,7 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
if (wsi->u.ws.rx_draining_ext) {
struct lws **w = &pt->rx_draining_ext_list;
lwsl_ext("%s: RX EXT DRAINING: Removing from list\n", __func__, c);
lwsl_ext("%s: RX EXT DRAINING: Removing from list\n", __func__);
assert(!c);
eff_buf.token = NULL;
eff_buf.token_len = 0;

View file

@ -37,7 +37,7 @@ lws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len)
* we were accepting input but now we stopped doing so
*/
if (!(wsi->rxflow_change_to & LWS_RXFLOW_ALLOW)) {
lwsl_debug("%s: caching %d\n", __func__, len);
lwsl_debug("%s: caching %ld\n", __func__, (long)len);
lws_rxflow_cache(wsi, *buf, 0, len);
return 0;
}
@ -57,7 +57,7 @@ lws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len)
}
len--;
}
lwsl_debug("%s: finished with %d\n", __func__, len);
lwsl_debug("%s: finished with %ld\n", __func__, (long)len);
return 0;
default:
break;

View file

@ -592,7 +592,7 @@ lws_create_context(struct lws_context_creation_info *info)
lwsl_info(" LWS_MAX_PROTOCOLS : %u\n", LWS_MAX_PROTOCOLS);
lwsl_info(" LWS_MAX_SMP : %u\n", LWS_MAX_SMP);
lwsl_info(" SPEC_LATEST_SUPPORTED : %u\n", SPEC_LATEST_SUPPORTED);
lwsl_info(" sizeof (*info) : %u\n", sizeof(*info));
lwsl_info(" sizeof (*info) : %ld\n", (long)sizeof(*info));
#if LWS_POSIX
lwsl_info(" SYSTEM_RANDOM_FILEPATH: '%s'\n", SYSTEM_RANDOM_FILEPATH);
#endif
@ -734,20 +734,20 @@ lws_create_context(struct lws_context_creation_info *info)
context->lws_uv_sigint_cb = &lws_uv_sigint_cb;
#endif
lwsl_info(" mem: context: %5u bytes (%d ctx + (%d thr x %d))\n",
sizeof(struct lws_context) +
lwsl_info(" mem: context: %5lu bytes (%ld ctx + (%ld thr x %d))\n",
(long)sizeof(struct lws_context) +
(context->count_threads * context->pt_serv_buf_size),
sizeof(struct lws_context),
context->count_threads,
(long)sizeof(struct lws_context),
(long)context->count_threads,
context->pt_serv_buf_size);
lwsl_info(" mem: http hdr rsvd: %5u bytes (%u thr x (%u + %u) x %u))\n",
(context->max_http_header_data +
lwsl_info(" mem: http hdr rsvd: %5lu bytes (%u thr x (%u + %lu) x %u))\n",
(long)(context->max_http_header_data +
sizeof(struct allocated_headers)) *
context->max_http_header_pool * context->count_threads,
context->count_threads,
context->max_http_header_data,
sizeof(struct allocated_headers),
(long)sizeof(struct allocated_headers),
context->max_http_header_pool);
n = sizeof(struct lws_pollfd) * context->count_threads *
context->fd_limit_per_thread;

View file

@ -303,7 +303,7 @@ lws_extension_callback_pm_deflate(struct lws_context *context,
priv->count_rx_between_fin += eff_buf->token_len;
lwsl_ext(" %s: RX leaving with new effbuff len %d, "
"ret %d, rx.avail_in=%d, TOTAL RX since FIN %d\n",
"ret %d, rx.avail_in=%d, TOTAL RX since FIN %ld\n",
__func__, eff_buf->token_len, priv->rx_held_valid,
priv->rx.avail_in, priv->count_rx_between_fin);

View file

@ -129,7 +129,7 @@ lws_read(struct lws *wsi, unsigned char *buf, size_t len)
* appropriately:
*/
len -= (buf - last_char);
lwsl_debug("%s: thinks we have used %d\n", __func__, len);
lwsl_debug("%s: thinks we have used %ld\n", __func__, (long)len);
if (!wsi->hdr_parsing_completed)
/* More header content on the way */
@ -245,7 +245,7 @@ postbody_completion:
read_ok:
/* Nothing more to do for now */
lwsl_info("%s: read_ok, used %d\n", __func__, buf - oldbuf);
lwsl_info("%s: read_ok, used %ld\n", __func__, buf - oldbuf);
return buf - oldbuf;

View file

@ -759,7 +759,7 @@ lwsws_get_config_d(void *user, const char *d, const char * const *paths,
n = scandir(d, &namelist, filter, alphasort);
if (n < 0) {
lwsl_err("Scandir on %d failed\n", d);
lwsl_err("Scandir on %s failed\n", d);
}
for (i = 0; i < n; i++) {

View file

@ -1106,9 +1106,9 @@ lws_get_protocol(struct lws *wsi)
LWS_VISIBLE int
lws_is_final_fragment(struct lws *wsi)
{
lwsl_info("%s: final %d, rx pk length %d, draining %d", __func__,
wsi->u.ws.final, wsi->u.ws.rx_packet_length,
wsi->u.ws.rx_draining_ext);
lwsl_info("%s: final %d, rx pk length %ld, draining %ld", __func__,
wsi->u.ws.final, (long)wsi->u.ws.rx_packet_length,
(long)wsi->u.ws.rx_draining_ext);
return wsi->u.ws.final && !wsi->u.ws.rx_packet_length && !wsi->u.ws.rx_draining_ext;
}
@ -1134,8 +1134,8 @@ lws_ensure_user_space(struct lws *wsi)
return 1;
}
} else
lwsl_info("%s: %p protocol pss %u, user_space=%d\n",
__func__, wsi, wsi->protocol->per_session_data_size,
lwsl_info("%s: %p protocol pss %lu, user_space=%p\n",
__func__, wsi, (long)wsi->protocol->per_session_data_size,
wsi->user_space);
return 0;
}

View file

@ -171,16 +171,16 @@ handle_truncated_send:
* we were already handling a truncated send?
*/
if (wsi->trunc_len) {
lwsl_info("%p partial adv %d (vs %d)\n", wsi, n, real_len);
lwsl_info("%p partial adv %d (vs %ld)\n", wsi, n, (long)real_len);
wsi->trunc_offset += n;
wsi->trunc_len -= n;
if (!wsi->trunc_len) {
lwsl_info("***** %x partial send completed\n", wsi);
lwsl_info("***** %p partial send completed\n", wsi);
/* done with it, but don't free it */
n = real_len;
if (wsi->state == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE) {
lwsl_info("***** %x signalling to close now\n", wsi);
lwsl_info("***** %p signalling to close now\n", wsi);
return -1; /* retry closing now */
}
}

View file

@ -241,7 +241,6 @@ remove_wsi_socket_from_fds(struct lws *wsi)
//lwsl_err("null wsi->prev\n");
/* our next should point back to our prev */
if (wsi->same_vh_protocol_next) {
lwsl_info("have next %p\n");
wsi->same_vh_protocol_next->same_vh_protocol_prev =
wsi->same_vh_protocol_prev;
} //else

View file

@ -1017,7 +1017,7 @@ lws_http_action(struct lws *wsi)
n = lws_cgi(wsi, cmd, hit->mountpoint_len, n,
hit->cgienv);
if (n) {
lwsl_err("%s: cgi failed\n");
lwsl_err("%s: cgi failed\n", __func__);
return -1;
}
p = buffer + LWS_PRE;
@ -2324,7 +2324,7 @@ lws_interpret_incoming_packet(struct lws *wsi, unsigned char **buf, size_t len)
*/
if (!(wsi->rxflow_change_to & LWS_RXFLOW_ALLOW)) {
lws_rxflow_cache(wsi, *buf, 0, len);
lwsl_parser("%s: cached %d\n", __func__, len);
lwsl_parser("%s: cached %ld\n", __func__, (long)len);
return 1;
}

View file

@ -389,7 +389,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
SSL_CTX_clear_options(vhost->ssl_ctx, info->ssl_options_clear);
#endif
lwsl_info(" SSL options 0x%X\n",
lwsl_info(" SSL options 0x%lX\n",
SSL_CTX_get_options(vhost->ssl_ctx));
if (vhost->use_ssl) {

View file

@ -258,7 +258,7 @@ reply:
n = lws_write(wsi, start, p - start, LWS_WRITE_HTTP_HEADERS);
if (n != (p - start)) {
lwsl_err("_write returned %d from %d\n", n, (p - start));
lwsl_err("_write returned %d from %ld\n", n, (long)(p - start));
return -1;
}
n = lws_write(wsi, (unsigned char *)s, 1, LWS_WRITE_HTTP);

View file

@ -420,7 +420,7 @@ callback_generic_sessions(struct lws *wsi, enum lws_callback_reasons reason,
break;
case LWS_CALLBACK_HTTP:
lwsl_info("LWS_CALLBACK_HTTP: %s\n", in);
lwsl_info("LWS_CALLBACK_HTTP: %s\n", (const char *)in);
pss->login_session.id[0] = '\0';
pss->phs.pos = 0;
@ -452,7 +452,7 @@ callback_generic_sessions(struct lws *wsi, enum lws_callback_reasons reason,
/* if no legitimate url for GET, return 404 */
lwsl_err("http doing 404 on %s\n", in);
lwsl_err("http doing 404 on %s\n", (const char *)in);
lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL);
goto try_to_reuse;

View file

@ -330,7 +330,7 @@ callback_messageboard(struct lws *wsi, enum lws_callback_reasons reason,
return -1;
n = lws_write(wsi, start, p - start, LWS_WRITE_HTTP_HEADERS);
if (n != (p - start)) {
lwsl_err("_write returned %d from %d\n", n, (p - start));
lwsl_err("_write returned %d from %ld\n", n, (long)(p - start));
return -1;
}
s[0] = '0';

View file

@ -151,7 +151,7 @@ callback_client_loopback_test(struct lws *wsi, enum lws_callback_reasons reason,
case LWS_CALLBACK_CLIENT_RECEIVE:
strncpy(buf, in, sizeof(buf) - 1);
lwsl_notice("Client connection received %d from server '%s'\n", len, buf);
lwsl_notice("Client connection received %ld from server '%s'\n", (long)len, buf);
/* OK we are done with the client connection */
return -1;

View file

@ -107,8 +107,8 @@ do_tx:
do_rx:
pss->final = lws_is_final_fragment(wsi);
pss->binary = lws_frame_is_binary(wsi);
lwsl_info("+++ test-echo: RX len %d final %d, pss->len=%d\n",
len, pss->final, (int)pss->len);
lwsl_info("+++ test-echo: RX len %ld final %ld, pss->len=%ld\n",
(long)len, (long)pss->final, (long)pss->len);
memcpy(&pss->buf[LWS_PRE], in, len);
assert((int)pss->len == -1);

View file

@ -212,7 +212,7 @@ int callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
switch (reason) {
case LWS_CALLBACK_HTTP:
lwsl_info("lws_http_serve: %s\n",in);
lwsl_info("lws_http_serve: %s\n", (const char *)in);
if (debug_level & LLL_INFO) {
dump_handshake_info(wsi);