diff --git a/cot_param.h b/cot_param.h index 2130a21..d88cb3f 100644 --- a/cot_param.h +++ b/cot_param.h @@ -82,7 +82,7 @@ #if COT_PARAM_USE_CUSTOM_CHECK #if (COT_PARAM_NAME_MAX_LENGTH > 1) #define COT_PARAM_ITEM_BIND_NUM_DEF_RANGE_IMPL(_id, _name, _variable, _type, _length, _attr, _defVal, _minVal, _maxVal, _check) { \ - .name = {.textId = (size_t)(_name), .pTextString = (char*)(_name)}, \ + .name = {.pVoid = (void *)(_name)}, \ .id = _id, .type = _type, .length = _length, .attr = _attr, \ .unCurValuePtr.pVoid = _variable, .unDefValuePtr.pVoid = _defVal, \ .unMinValuePtr.pVoid = _minVal, .unMaxValuePtr.pVoid = _maxVal, .pfnParamCheck = _check} @@ -96,7 +96,7 @@ #else #if (COT_PARAM_NAME_MAX_LENGTH > 1) #define COT_PARAM_ITEM_BIND_NUM_DEF_RANGE_IMPL(_id, _name, _variable, _type, _length, _attr, _defVal, _minVal, _maxVal, _check) { \ - .name = {.textId = (size_t)(_name), .pTextString = (char*)(_name)}, \ + .name = {.pVoid = (void *)(_name)}, \ .id = _id, .type = _type, .length = _length, .attr = _attr, \ .unCurValuePtr.pVoid = _variable, .unDefValuePtr.pVoid = _defVal, \ .unMinValuePtr.pVoid = _minVal, .unMaxValuePtr.pVoid = _maxVal} diff --git a/cot_param_type.h b/cot_param_type.h index 836d1e6..0c0274b 100644 --- a/cot_param_type.h +++ b/cot_param_type.h @@ -119,6 +119,8 @@ typedef int (*cotParamCheck_f)(const void *pCurParam); typedef union { + void *pVoid; /*!< 通用指针(目的消除编译警告) */ + size_t textId; /*!< 文本ID */ char *pTextString; /*!< 文本字符串 */