cw_ElemHandler->type is now void *

FossilOrigin-Name: 003406770903c77846a8dbb39a466e6fc226f930ac036857518b2c1321b54f29
This commit is contained in:
7u83@mail.ru
2018-03-25 20:38:07 +00:00
parent d420f572ee
commit 5e86c52446
5 changed files with 23 additions and 17 deletions

View File

@ -44,10 +44,10 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
}
return 0;
}
len = handler->type->put(elem,dst+start);
len = ((const cw_Type_t*)(handler->type))->put(elem,dst+start);
handler->type->to_str(elem,detail,120);
((const cw_Type_t*)(handler->type))->to_str(elem,detail,120);
sprintf(params->debug_details, " Value = %s", detail);
params->elem = elem;

View File

@ -172,13 +172,13 @@ static int update_msgdata(struct cw_MsgSet *set, struct cw_MsgData *msgdata,
continue;
}
if (handler->type != NULL){
/* if (handler->type != NULL){
if (mavl_add_ptr( set->types_tree, handler->type ) == NULL){
cw_log(LOG_ERR, "Can't add type from handler: %s", strerror(errno));
continue;
}
}
*/
ed.id = elemdef->id;
ed.proto = elemdef->proto;

View File

@ -40,10 +40,7 @@ struct cw_ElemHandlerParams {
char * debug_details;
};
union handlerType{
const struct cw_Type type;
int x;
};
struct cw_ElemHandler {
const char * name;
@ -52,8 +49,8 @@ struct cw_ElemHandler {
int proto;
int min_len;
int max_len;
const struct cw_Type * type;
/* union handlerType type; */
/*const struct cw_Type * type;*/
const void * type;
const char * key;
int (*get)(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t*data, int len);