From d3352b997ca59a336a40fe6660c6e5b7079864aa Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sun, 28 Jun 2020 14:58:32 +0200 Subject: Run clang-format on source tree (excl igmp.c) --- shared/rcon-protocol.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'shared/rcon-protocol.c') diff --git a/shared/rcon-protocol.c b/shared/rcon-protocol.c index 0ea1245..0cf73fc 100644 --- a/shared/rcon-protocol.c +++ b/shared/rcon-protocol.c @@ -5,8 +5,7 @@ #include "rcon-protocol.h" -static int32_t -read_int(const char **pos, size_t *len) +static int32_t read_int(const char **pos, size_t *len) { uint32_t val; const char *p; @@ -18,8 +17,8 @@ read_int(const char **pos, size_t *len) return 0; p = *pos; - val = ((uint8_t)p[0] << 0); - val += ((uint8_t)p[1] << 8); + val = ((uint8_t)p[0] << 0); + val += ((uint8_t)p[1] << 8); val += ((uint8_t)p[2] << 16); val += ((uint8_t)p[3] << 24); @@ -30,8 +29,7 @@ read_int(const char **pos, size_t *len) return (int32_t)val; } -static void -write_int(char **pos, size_t *len, int32_t orig) +static void write_int(char **pos, size_t *len, int32_t orig) { uint32_t val = (uint32_t)orig; char *p; @@ -40,8 +38,8 @@ write_int(char **pos, size_t *len, int32_t orig) return; p = *pos; - p[0] = (val >> 0) & 0xff; - p[1] = (val >> 8) & 0xff; + p[0] = (val >> 0) & 0xff; + p[1] = (val >> 8) & 0xff; p[2] = (val >> 16) & 0xff; p[3] = (val >> 24) & 0xff; @@ -50,8 +48,7 @@ write_int(char **pos, size_t *len, int32_t orig) *len += RCON_INT_LEN; } -static void -write_str(char **pos, size_t *len, const char *str, size_t slen) +static void write_str(char **pos, size_t *len, const char *str, size_t slen) { if (!pos || !*pos || !str || *str == '\0' || slen < 1) return; @@ -62,8 +59,7 @@ write_str(char **pos, size_t *len, const char *str, size_t slen) *len += slen; } -static void -write_end(char **pos, size_t *len) +static void write_end(char **pos, size_t *len) { char *p; @@ -79,9 +75,9 @@ write_end(char **pos, size_t *len) *len += RCON_END_LEN; } -bool -rcon_protocol_create_packet(char *buf, size_t len, size_t *rlen, int32_t reqid, - enum rcon_packet_type type, const char *msg) +bool rcon_protocol_create_packet(char *buf, size_t len, size_t *rlen, + int32_t reqid, enum rcon_packet_type type, + const char *msg) { size_t plen, msglen; char *pos; @@ -115,8 +111,7 @@ rcon_protocol_create_packet(char *buf, size_t len, size_t *rlen, int32_t reqid, * 0 = packet not complete * > 0 = packet complete (length) */ -int32_t -rcon_protocol_packet_complete(const char *buf, size_t len) +int32_t rcon_protocol_packet_complete(const char *buf, size_t len) { const char *pos; int32_t plen; @@ -140,9 +135,9 @@ rcon_protocol_packet_complete(const char *buf, size_t len) return plen; } -bool -rcon_protocol_read_packet(const char *buf, size_t len, int32_t *id, int32_t *type, - const char **rmsg, const char **error) +bool rcon_protocol_read_packet(const char *buf, size_t len, int32_t *id, + int32_t *type, const char **rmsg, + const char **error) { const char *pos; int32_t plen; -- cgit v1.2.3