From e0f6aadace9013a63710f9cd7f9af45b477660f2 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Fri, 23 Feb 2018 08:06:22 +0000 Subject: [PATCH] Reformatted FossilOrigin-Name: 0ee8c4d6c81557eea2f8bd3ea9c1a3646591661180b0b175f8ba48e4e7a94d7b --- src/cw/format.h | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/cw/format.h b/src/cw/format.h index 78ce4376..87e2b96a 100644 --- a/src/cw/format.h +++ b/src/cw/format.h @@ -17,7 +17,7 @@ */ /** *@file - *@brief prototypes for format-functions + *@brief Prototypes of cw_format-functions *@defgroup FORMAT FORMAT *@{ */ @@ -29,20 +29,21 @@ extern int format_hex_bytes(char *dst, const char *format, const char *delim, - const uint8_t * src, int len); + const uint8_t * src, int len); -static inline char * format_s_hex_bytes(char *dst, const char *format, const char *delim, - const uint8_t * src, int len){ - format_hex_bytes(dst,format,delim,src,len); +static inline char *format_s_hex_bytes(char *dst, const char *format, const char *delim, + const uint8_t * src, int len) +{ + format_hex_bytes(dst, format, delim, src, len); return dst; } -#define format_bin2hex(src,len) (format_s_hex_bytes((char[(len)*2+1]){0},"%02X","",src,len)) +#define format_bin2hex(src,len) (format_s_hex_bytes((char[(len) * 2 + 1]) {0}, "%02X", "", src, len)) -extern int format_scan_hex_bytes(uint8_t *dst,const char *s, int len); +extern int format_scan_hex_bytes(uint8_t * dst, const char *s, int len); /** @@ -72,22 +73,22 @@ extern int format_scan_hex_bytes(uint8_t *dst,const char *s, int len); /** * Format MAC Address. - */ + */ #define format_mac(dst,src,len)\ format_hex_bytes(dst,"%02x",":",src,len) -static inline int format_hdr_flags(char *dst,uint8_t *th) +static inline int format_hdr_flags(char *dst, uint8_t * th) { - char * s = dst; - s+=sprintf(s,"%s", "("); - s+=sprintf(s,"%s", cw_get_hdr_flag_t(th) ? "T":""); - s+=sprintf(s,"%s", cw_get_hdr_flag_f(th) ? "F":""); - s+=sprintf(s,"%s", cw_get_hdr_flag_l(th) ? "L":""); - s+=sprintf(s,"%s", cw_get_hdr_flag_w(th) ? "W":""); - s+=sprintf(s,"%s", cw_get_hdr_flag_m(th) ? "M":""); - s+=sprintf(s,"%s", cw_get_hdr_flag_k(th) ? "K":""); - s+=sprintf(s,"%s", ")"); - return s-dst; + char *s = dst; + s += sprintf(s, "%s", "("); + s += sprintf(s, "%s", cw_get_hdr_flag_t(th) ? "T" : ""); + s += sprintf(s, "%s", cw_get_hdr_flag_f(th) ? "F" : ""); + s += sprintf(s, "%s", cw_get_hdr_flag_l(th) ? "L" : ""); + s += sprintf(s, "%s", cw_get_hdr_flag_w(th) ? "W" : ""); + s += sprintf(s, "%s", cw_get_hdr_flag_m(th) ? "M" : ""); + s += sprintf(s, "%s", cw_get_hdr_flag_k(th) ? "K" : ""); + s += sprintf(s, "%s", ")"); + return s - dst; }