Apply clang-format for more source files (#795)

Apply clang-format for C source files in folder core/app-mgr,
core/app-framework, and test-tools.
And rename folder component_test to component-test, update
zephyr build document.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-10-21 13:58:34 +08:00
committed by GitHub
parent 225f5d0a64
commit 32242988ed
143 changed files with 5377 additions and 4627 deletions

View File

@ -34,7 +34,7 @@ enum {
ATTR_TYPE_END = ATTR_TYPE_BYTEARRAY
};
#define ATTR_CONT_READONLY_SHIFT 2
#define ATTR_CONT_READONLY_SHIFT 2
typedef struct attr_container {
/* container flag:
@ -87,7 +87,7 @@ attr_container_destroy(const attr_container_t *attr_cont);
*/
bool
attr_container_set_short(attr_container_t **p_attr_cont, const char *key,
short value);
short value);
/**
* Set int attribute in attribute container
@ -101,7 +101,7 @@ attr_container_set_short(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_int(attr_container_t **p_attr_cont, const char *key,
int value);
int value);
/**
* Set int64 attribute in attribute container
@ -115,7 +115,7 @@ attr_container_set_int(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_int64(attr_container_t **p_attr_cont, const char *key,
int64_t value);
int64_t value);
/**
* Set byte attribute in attribute container
@ -129,7 +129,7 @@ attr_container_set_int64(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_byte(attr_container_t **p_attr_cont, const char *key,
int8_t value);
int8_t value);
/**
* Set uint16 attribute in attribute container
@ -143,7 +143,7 @@ attr_container_set_byte(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_uint16(attr_container_t **p_attr_cont, const char *key,
uint16_t value);
uint16_t value);
/**
* Set float attribute in attribute container
@ -157,7 +157,7 @@ attr_container_set_uint16(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_float(attr_container_t **p_attr_cont, const char *key,
float value);
float value);
/**
* Set double attribute in attribute container
@ -171,7 +171,7 @@ attr_container_set_float(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_double(attr_container_t **p_attr_cont, const char *key,
double value);
double value);
/**
* Set bool attribute in attribute container
@ -185,7 +185,7 @@ attr_container_set_double(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_bool(attr_container_t **p_attr_cont, const char *key,
bool value);
bool value);
/**
* Set string attribute in attribute container
@ -199,7 +199,7 @@ attr_container_set_bool(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_string(attr_container_t **p_attr_cont, const char *key,
const char *value);
const char *value);
/**
* Set bytearray attribute in attribute container
@ -214,7 +214,7 @@ attr_container_set_string(attr_container_t **p_attr_cont, const char *key,
*/
bool
attr_container_set_bytearray(attr_container_t **p_attr_cont, const char *key,
const int8_t *value, unsigned length);
const int8_t *value, unsigned length);
/**
* Get tag of current attribute container
@ -223,7 +223,7 @@ attr_container_set_bytearray(attr_container_t **p_attr_cont, const char *key,
*
* @return tag of current attribute container
*/
const char*
const char *
attr_container_get_tag(const attr_container_t *attr_cont);
/**
@ -306,7 +306,7 @@ attr_container_get_as_byte(const attr_container_t *attr_cont, const char *key);
*/
uint16_t
attr_container_get_as_uint16(const attr_container_t *attr_cont,
const char *key);
const char *key);
/**
* Get attribute from attribute container and return it as float value,
@ -331,7 +331,7 @@ attr_container_get_as_float(const attr_container_t *attr_cont, const char *key);
*/
double
attr_container_get_as_double(const attr_container_t *attr_cont,
const char *key);
const char *key);
/**
* Get attribute from attribute container and return it as bool value,
@ -354,9 +354,9 @@ attr_container_get_as_bool(const attr_container_t *attr_cont, const char *key);
*
* @return the string value of the attribute, NULL if key isn't found
*/
char*
char *
attr_container_get_as_string(const attr_container_t *attr_cont,
const char *key);
const char *key);
/**
* Get attribute from attribute container and return it as bytearray value,
@ -367,9 +367,9 @@ attr_container_get_as_string(const attr_container_t *attr_cont,
*
* @return the bytearray value of the attribute, NULL if key isn't found
*/
const int8_t*
const int8_t *
attr_container_get_as_bytearray(const attr_container_t *attr_cont,
const char *key, unsigned *array_length);
const char *key, unsigned *array_length);
/**
* Get the buffer size of attribute container
@ -400,7 +400,7 @@ attr_container_serialize(char *buf, const attr_container_t *attr_cont);
* @return true if const, false otherwise
*/
bool
attr_container_is_constant(const attr_container_t* attr_cont);
attr_container_is_constant(const attr_container_t *attr_cont);
void
attr_container_dump(const attr_container_t *attr_cont);
@ -422,4 +422,3 @@ attr_container_dump(const attr_container_t *attr_cont);
#endif
#endif /* end of _ATTR_CONTAINER_H_ */

View File

@ -12,8 +12,8 @@
extern "C" {
#endif
#define FMT_ATTR_CONTAINER 99
#define FMT_APP_RAW_BINARY 98
#define FMT_ATTR_CONTAINER 99
#define FMT_APP_RAW_BINARY 98
/* the request structure */
typedef struct request {
@ -32,10 +32,10 @@ typedef struct request {
// payload of the request, currently only support attr_container_t type
void *payload;
//length in bytes of the payload
// length in bytes of the payload
int payload_len;
//sender of the request
// sender of the request
unsigned long sender;
} request_t;
@ -53,21 +53,21 @@ typedef struct response {
// payload of the response,
void *payload;
//length in bytes of the payload
// length in bytes of the payload
int payload_len;
//receiver of the response
// receiver of the response
unsigned long reciever;
} response_t;
int
check_url_start(const char* url, int url_len, const char * leading_str);
check_url_start(const char *url, int url_len, const char *leading_str);
bool
match_url(char * pattern, char * matched);
match_url(char *pattern, char *matched);
char *
find_key_value(char * buffer, int buffer_len, char * key, char * value,
find_key_value(char *buffer, int buffer_len, char *key, char *value,
int value_len, char delimiter);
request_t *
@ -77,10 +77,10 @@ void
request_cleaner(request_t *request);
response_t *
clone_response(response_t * response);
clone_response(response_t *response);
void
response_cleaner(response_t * response);
response_cleaner(response_t *response);
/**
* @brief Set fields of response.
@ -96,8 +96,8 @@ response_cleaner(response_t * response);
* @warning the response pointer MUST NOT be NULL
*/
response_t *
set_response(response_t * response, int status, int fmt,
const char *payload, int payload_len);
set_response(response_t *response, int status, int fmt, const char *payload,
int payload_len);
/**
* @brief Make a response for a request.
@ -110,7 +110,7 @@ set_response(response_t * response, int status, int fmt,
* @warning the request and response pointers MUST NOT be NULL
*/
response_t *
make_response_for_request(request_t * request, response_t * response);
make_response_for_request(request_t *request, response_t *response);
/**
* @brief Initialize a request.
@ -127,28 +127,27 @@ make_response_for_request(request_t * request, response_t * response);
* @warning the request pointer MUST NOT be NULL
*/
request_t *
init_request(request_t * request, char *url, int action, int fmt,
void *payload, int payload_len);
init_request(request_t *request, char *url, int action, int fmt, void *payload,
int payload_len);
char *
pack_request(request_t *request, int * size);
pack_request(request_t *request, int *size);
request_t *
unpack_request(char * packet, int size, request_t * request);
unpack_request(char *packet, int size, request_t *request);
char *
pack_response(response_t *response, int * size);
pack_response(response_t *response, int *size);
response_t *
unpack_response(char * packet, int size, response_t * response);
unpack_response(char *packet, int size, response_t *response);
void
free_req_resp_packet(char * packet);
free_req_resp_packet(char *packet);
char *
wa_strdup(const char *str);
#ifdef __cplusplus
}
#endif

View File

@ -8,14 +8,12 @@
#include "bh_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
/* Object native function IDs */
enum {
OBJ_FUNC_ID_DEL,