From 5c9660da61ad58c52d74815f1a7360597cedf2b3 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 4 Dec 2015 11:30:53 +0800 Subject: [PATCH] clean tidy the worst whitespace alignment probs due to mass token name length changes Signed-off-by: Andy Green --- lib/libwebsockets.c | 32 +++++++++++++++----------------- lib/output.c | 6 +++--- lib/parsers.c | 8 +++----- lib/server-handshake.c | 2 +- lib/server.c | 17 ++++++++--------- lib/service.c | 25 +++++++++++++------------ lib/ssl.c | 14 ++++++++------ 7 files changed, 51 insertions(+), 53 deletions(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 787c4a0..da78fbf 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -62,7 +62,7 @@ lws_free_wsi(struct lws *wsi) void lws_close_and_free_session(struct lws_context *context, - struct lws *wsi, enum lws_close_status reason) + struct lws *wsi, enum lws_close_status reason) { int n, m, ret; int old_state; @@ -324,9 +324,8 @@ just_kill_connection: } LWS_VISIBLE int -lws_get_addresses(struct lws_context *context, - void *ads, char *name, int name_len, - char *rip, int rip_len) +lws_get_addresses(struct lws_context *context, void *ads, char *name, + int name_len, char *rip, int rip_len) { #if LWS_POSIX struct addrinfo ai, *res; @@ -422,9 +421,9 @@ lws_get_addresses(struct lws_context *context, */ LWS_VISIBLE void -lws_get_peer_addresses(struct lws_context *context, - struct lws *wsi, lws_sockfd_type fd, char *name, int name_len, - char *rip, int rip_len) +lws_get_peer_addresses(struct lws_context *context, struct lws *wsi, + lws_sockfd_type fd, char *name, int name_len, + char *rip, int rip_len) { #if LWS_POSIX socklen_t len; @@ -558,8 +557,8 @@ lws_get_socket_fd(struct lws *wsi) #ifdef LWS_LATENCY void -lws_latency(struct lws_context *context, struct lws *wsi, - const char *action, int ret, int completed) +lws_latency(struct lws_context *context, struct lws *wsi, const char *action, + int ret, int completed) { unsigned long long u; char buf[256]; @@ -633,8 +632,7 @@ lws_rx_flow_control(struct lws *wsi, int enable) */ LWS_VISIBLE void -lws_rx_flow_allow_all_protocol( - const struct lws_protocols *protocol) +lws_rx_flow_allow_all_protocol(const struct lws_protocols *protocol) { struct lws_context *context = protocol->owning_server; int n; @@ -666,10 +664,9 @@ lws_canonical_hostname(struct lws_context *context) } int user_callback_handle_rxflow(callback_function callback_function, - struct lws_context *context, - struct lws *wsi, - enum lws_callback_reasons reason, void *user, - void *in, size_t len) + struct lws_context *context, struct lws *wsi, + enum lws_callback_reasons reason, void *user, + void *in, size_t len) { int n; @@ -853,8 +850,9 @@ LWS_VISIBLE void _lws_log(int filter, const char *format, ...) * emission on stderr. */ -LWS_VISIBLE void lws_set_log_level(int level, void (*log_emit_function)(int level, - const char *line)) +LWS_VISIBLE void lws_set_log_level(int level, + void (*log_emit_function)(int level, + const char *line)) { log_level = level; if (log_emit_function) diff --git a/lib/output.c b/lib/output.c index 0cd044d..f878410 100644 --- a/lib/output.c +++ b/lib/output.c @@ -515,8 +515,8 @@ send_raw: return n - (pre + post); } -LWS_VISIBLE int lws_serve_http_file_fragment( - struct lws_context *context, struct lws *wsi) +LWS_VISIBLE int lws_serve_http_file_fragment(struct lws_context *context, + struct lws *wsi) { int n; int m; @@ -526,7 +526,7 @@ LWS_VISIBLE int lws_serve_http_file_fragment( if (wsi->truncated_send_len) { if (lws_issue_raw(wsi, wsi->truncated_send_malloc + wsi->truncated_send_offset, - wsi->truncated_send_len) < 0) { + wsi->truncated_send_len) < 0) { lwsl_info("closing from lws_serve_http_file_fragment\n"); return -1; } diff --git a/lib/parsers.c b/lib/parsers.c index add6220..3e8e359 100644 --- a/lib/parsers.c +++ b/lib/parsers.c @@ -99,7 +99,7 @@ LWS_VISIBLE int lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h) } LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dest, int len, - enum lws_token_indexes h) + enum lws_token_indexes h) { int toklen = lws_hdr_total_length(wsi, h); int n; @@ -133,7 +133,7 @@ char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h) } int lws_hdr_simple_create(struct lws *wsi, - enum lws_token_indexes h, const char *s) + enum lws_token_indexes h, const char *s) { wsi->u.hdr.ah->next_frag_index++; if (wsi->u.hdr.ah->next_frag_index == @@ -206,9 +206,7 @@ static int issue_char(struct lws *wsi, unsigned char c) return 1; } -int lws_parse( - struct lws_context *context, - struct lws *wsi, unsigned char c) +int lws_parse(struct lws_context *context, struct lws *wsi, unsigned char c) { static const unsigned char methods[] = { WSI_TOKEN_GET_URI, diff --git a/lib/server-handshake.c b/lib/server-handshake.c index 847cb2f..56c55c7 100644 --- a/lib/server-handshake.c +++ b/lib/server-handshake.c @@ -25,7 +25,7 @@ #ifndef LWS_NO_EXTENSIONS LWS_VISIBLE int lws_extension_server_handshake(struct lws_context *context, - struct lws *wsi, char **p) + struct lws *wsi, char **p) { int n; char *c; diff --git a/lib/server.c b/lib/server.c index 1438814..f9a8459 100644 --- a/lib/server.c +++ b/lib/server.c @@ -685,7 +685,7 @@ int lws_http_transaction_completed(struct lws *wsi) LWS_VISIBLE int lws_server_socket_service(struct lws_context *context, - struct lws *wsi, struct lws_pollfd *pollfd) + struct lws *wsi, struct lws_pollfd *pollfd) { struct lws *new_wsi = NULL; lws_sockfd_type accept_fd = LWS_SOCK_INVALID; @@ -909,11 +909,11 @@ fail: * the wsi should be left alone. */ -LWS_VISIBLE int lws_serve_http_file( - struct lws_context *context, - struct lws *wsi, const char *file, - const char *content_type, const char *other_headers, - int other_headers_len) +LWS_VISIBLE int lws_serve_http_file(struct lws_context *context, + struct lws *wsi, const char *file, + const char *content_type, + const char *other_headers, + int other_headers_len) { unsigned char *response = context->service_buffer + LWS_SEND_BUFFER_PRE_PADDING; unsigned char *p = response; @@ -963,8 +963,7 @@ LWS_VISIBLE int lws_serve_http_file( } -int lws_interpret_incoming_packet(struct lws *wsi, - unsigned char *buf, size_t len) +int lws_interpret_incoming_packet(struct lws *wsi, unsigned char *buf, size_t len) { size_t n = 0; int m; @@ -1001,7 +1000,7 @@ int lws_interpret_incoming_packet(struct lws *wsi, LWS_VISIBLE void lws_server_get_canonical_hostname(struct lws_context *context, - struct lws_context_creation_info *info) + struct lws_context_creation_info *info) { if (info->options & LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME) return; diff --git a/lib/service.c b/lib/service.c index 170d475..fc62c4f 100644 --- a/lib/service.c +++ b/lib/service.c @@ -22,8 +22,7 @@ #include "private-libwebsockets.h" static int -lws_calllback_as_writeable(struct lws_context *context, - struct lws *wsi) +lws_calllback_as_writeable(struct lws_context *context, struct lws *wsi) { int n; @@ -45,8 +44,8 @@ lws_calllback_as_writeable(struct lws_context *context, } int -lws_handle_POLLOUT_event(struct lws_context *context, - struct lws *wsi, struct lws_pollfd *pollfd) +lws_handle_POLLOUT_event(struct lws_context *context, struct lws *wsi, + struct lws_pollfd *pollfd) { int n; struct lws_tokens eff_buf; @@ -281,13 +280,14 @@ notify: int lws_service_timeout_check(struct lws_context *context, - struct lws *wsi, unsigned int sec) + struct lws *wsi, unsigned int sec) { /* * if extensions want in on it (eg, we are a mux parent) * give them a chance to service child timeouts */ - if (lws_ext_callback_for_each_active(wsi, LWS_EXT_CALLBACK_1HZ, NULL, sec) < 0) + if (lws_ext_callback_for_each_active(wsi, LWS_EXT_CALLBACK_1HZ, + NULL, sec) < 0) return 0; if (!wsi->pending_timeout) @@ -298,7 +298,8 @@ lws_service_timeout_check(struct lws_context *context, * connection */ if ((time_t)sec > wsi->pending_timeout_limit) { - lwsl_info("wsi %p: TIMEDOUT WAITING on %d\n", (void *)wsi, wsi->pending_timeout); + lwsl_info("wsi %p: TIMEDOUT WAITING on %d\n", + (void *)wsi, wsi->pending_timeout); /* * Since he failed a timeout, he already had a chance to do * something and was unable to... that includes situations like @@ -307,8 +308,8 @@ lws_service_timeout_check(struct lws_context *context, * cleanup like flush partials. */ wsi->socket_is_permanently_unusable = 1; - lws_close_and_free_session(context, - wsi, LWS_CLOSE_STATUS_NOSTATUS); + lws_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); return 1; } @@ -358,8 +359,7 @@ int lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len) */ LWS_VISIBLE int -lws_service_fd(struct lws_context *context, - struct lws_pollfd *pollfd) +lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd) { struct lws *wsi; int n, m; @@ -377,7 +377,8 @@ lws_service_fd(struct lws_context *context, #if LWS_POSIX if (context->listen_service_fd) - listen_socket_fds_index = wsi_from_fd(context,context->listen_service_fd)->position_in_fds_table; + listen_socket_fds_index = wsi_from_fd(context, + context->listen_service_fd)->position_in_fds_table; #endif /* * you can call us with pollfd = NULL to just allow the once-per-second diff --git a/lib/ssl.c b/lib/ssl.c index 6f55826..c15092d 100644 --- a/lib/ssl.c +++ b/lib/ssl.c @@ -26,9 +26,11 @@ int openssl_websocket_private_data_index; -static int lws_context_init_ssl_pem_passwd_cb(char * buf, int size, int rwflag, void *userdata) +static int lws_context_init_ssl_pem_passwd_cb(char * buf, int size, + int rwflag, void *userdata) { - struct lws_context_creation_info * info = (struct lws_context_creation_info *)userdata; + struct lws_context_creation_info * info = + (struct lws_context_creation_info *)userdata; strncpy(buf, info->ssl_private_key_password, size); buf[size - 1] = '\0'; @@ -278,7 +280,7 @@ lws_decode_ssl_error(void) #ifndef LWS_NO_CLIENT int lws_context_init_client_ssl(struct lws_context_creation_info *info, - struct lws_context *context) + struct lws_context *context) { int error; int n; @@ -525,9 +527,9 @@ lws_ssl_close(struct lws *wsi) } LWS_VISIBLE int -lws_server_socket_service_ssl(struct lws_context *context, - struct lws **pwsi, struct lws *new_wsi, - int accept_fd, struct lws_pollfd *pollfd) +lws_server_socket_service_ssl(struct lws_context *context, struct lws **pwsi, + struct lws *new_wsi, int accept_fd, + struct lws_pollfd *pollfd) { int n, m; struct lws *wsi = *pwsi; -- 2.7.4