From 29f6f77bc3f2b19b77d3fcb2a67f02fa4c6a5256 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Mon, 8 Jan 2018 15:02:59 +0800 Subject: [PATCH] Convert indentation to spaces Signed-off-by: Jianhui Zhao --- example/helloworld.c | 6 +++--- src/log.c | 1 - src/utils.c | 16 ++++++++-------- src/utils.h | 1 - src/uwsc.h | 36 ++++++++++++++++++------------------ 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/example/helloworld.c b/example/helloworld.c index e1884aa..1f484bc 100755 --- a/example/helloworld.c +++ b/example/helloworld.c @@ -44,7 +44,7 @@ static void uwsc_onopen(struct uwsc_client *cl) static void uwsc_onmessage(struct uwsc_client *cl, char *data, uint64_t len, enum websocket_op op) { - printf("recv:[%.*s]\n", (int)len, data); + printf("recv:[%.*s]\n", (int)len, data); } static void uwsc_onerror(struct uwsc_client *cl) @@ -66,7 +66,7 @@ int main(int argc, char **argv) cl = uwsc_new("ws://127.0.0.1:81/lua"); //cl = uwsc_new("wss://127.0.0.1:81/lua"); - cl->onopen = uwsc_onopen; + cl->onopen = uwsc_onopen; cl->onmessage = uwsc_onmessage; cl->onerror = uwsc_onerror; cl->onclose = uwsc_onclose; @@ -74,7 +74,7 @@ int main(int argc, char **argv) uloop_run(); uloop_done(); - cl->free(cl); + cl->free(cl); return 0; } diff --git a/src/log.c b/src/log.c index 202ce86..bab770d 100755 --- a/src/log.c +++ b/src/log.c @@ -42,4 +42,3 @@ void __uwsc_log(const char *filename, int line, int priority, const char *format fprintf(stderr, "%s\n", buf); #endif } - diff --git a/src/utils.c b/src/utils.c index a3d3904..8a1d854 100755 --- a/src/utils.c +++ b/src/utils.c @@ -2,15 +2,15 @@ int get_nonce(uint8_t *dest, int len) { - FILE *fp; - size_t n; + FILE *fp; + size_t n; - fp = fopen("/dev/urandom", "r"); - if (fp) { - n = fread(dest, len, 1, fp); - fclose(fp); - return n; - } + fp = fopen("/dev/urandom", "r"); + if (fp) { + n = fread(dest, len, 1, fp); + fclose(fp); + return n; + } return -1; } diff --git a/src/utils.h b/src/utils.h index 4153d3b..8eca788 100755 --- a/src/utils.h +++ b/src/utils.h @@ -28,4 +28,3 @@ const struct ustream_ssl_ops *init_ustream_ssl(); #endif #endif - diff --git a/src/uwsc.h b/src/uwsc.h index 3f29730..52a47f3 100755 --- a/src/uwsc.h +++ b/src/uwsc.h @@ -31,42 +31,42 @@ enum uwsc_error_code { }; enum client_state { - CLIENT_STATE_INIT, - CLIENT_STATE_HANDSHAKE, - CLIENT_STATE_MESSAGE + CLIENT_STATE_INIT, + CLIENT_STATE_HANDSHAKE, + CLIENT_STATE_MESSAGE }; enum websocket_op { - WEBSOCKET_OP_CONTINUE = 0x0, - WEBSOCKET_OP_TEXT = 0x1, - WEBSOCKET_OP_BINARY = 0x2, - WEBSOCKET_OP_CLOSE = 0x8, - WEBSOCKET_OP_PING = 0x9, - WEBSOCKET_OP_PONG = 0xA + WEBSOCKET_OP_CONTINUE = 0x0, + WEBSOCKET_OP_TEXT = 0x1, + WEBSOCKET_OP_BINARY = 0x2, + WEBSOCKET_OP_CLOSE = 0x8, + WEBSOCKET_OP_PING = 0x9, + WEBSOCKET_OP_PONG = 0xA }; struct uwsc_frame { - uint8_t fin; - uint8_t opcode; - uint64_t payload_len; - char *payload; + uint8_t fin; + uint8_t opcode; + uint64_t payload_len; + char *payload; }; struct uwsc_client { - struct ustream *us; + struct ustream *us; struct ustream_fd sfd; - enum client_state state; + enum client_state state; struct uwsc_frame frame; struct uloop_timeout timeout; enum uwsc_error_code error; #if (UWSC_SSL_SUPPORT) struct ustream_ssl ussl; - struct ustream_ssl_ctx *ssl_ctx; - const struct ustream_ssl_ops *ssl_ops; + struct ustream_ssl_ctx *ssl_ctx; + const struct ustream_ssl_ops *ssl_ops; #endif - void (*onopen)(struct uwsc_client *cl); + void (*onopen)(struct uwsc_client *cl); void (*onmessage)(struct uwsc_client *cl, char *data, uint64_t len, enum websocket_op op); void (*onerror)(struct uwsc_client *cl); void (*onclose)(struct uwsc_client *cl);