renamed a lot of cw_format_* to format_*

FossilOrigin-Name: 23ddf0840bc6910dc3ddf4f763ff9976441573173d8e669cc02cbc0520f12f00
This commit is contained in:
7u83@mail.ru
2016-03-12 08:28:35 +00:00
parent 10efce8ee2
commit 1dbb599802
13 changed files with 36 additions and 50 deletions

View File

@ -18,19 +18,19 @@
/**
*@file
*@brief prototypes for format-functions
*@defgroup FormatFunctions FORMAT Functions
*@defgroup FORMAT FORMAT
*@{
*/
#ifndef __CW_FORMAT_H
#define __CW_FORMAT_H
#ifndef __FORMAT_H
#define __FORMAT_H
#include "cw.h"
extern int cw_format_hex_bytes(char *dst, const char *format, const char *delim,
extern int format_hex_bytes(char *dst, const char *format, const char *delim,
const uint8_t * src, int len);
extern int cw_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);
@ -44,39 +44,28 @@ extern int cw_format_scan_hex_bytes(uint8_t *dst,const char *s, int len);
* Make sure, the destination buffer can hold at least len * 2 characters + the trailing
* zero for strings.
*/
#define cw_format_hexl(dst,bytes,len)\
cw_format_hex_bytes(dst,"%02x","",bytes,len)
#define format_hexl(dst,bytes,len)\
format_hex_bytes(dst,"%02x","",bytes,len)
/**
* Format bytes as hex string. Same as #cw_format_hexl, but
* Format bytes as hex string. Same as #format_hexl, but
* hexadecimal letters are upper-case.
*/
#define cw_format_hexu(dst,bytes,len)\
cw_format_hex_bytes(dst,"%02X","",bytes,len)
#define format_hexu(dst,bytes,len)\
format_hex_bytes(dst,"%02X","",bytes,len)
/**
* Alias for #cw_format_hexl.
* Alias for #format_hexl.
*/
#define cw_format_hex cw_format_hexl
#define format_hex format_hexl
/**
* Format MAC Address.
*/
#define cw_format_mac(dst,src,len)\
cw_format_hex_bytes(dst,"%02x",":",src,len)
#define format_mac(dst,src,len)\
format_hex_bytes(dst,"%02x",":",src,len)
/*#define cw_format_hdr_flags(s,th) \
sprintf(s,"(T=%d,F=%d,L=%d,W=%d,M=%d,K=%d)",\
cw_get_hdr_flag_t(packet),\
cw_get_hdr_flag_f(packet),\
cw_get_hdr_flag_l(packet),\
cw_get_hdr_flag_w(packet),\
cw_get_hdr_flag_m(packet),\
cw_get_hdr_flag_k(packet)\
);
*/
static inline int cw_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", "(");