diff --git a/inc/Maat_rule.h b/inc/Maat_rule.h index e160a4a..b7e21a9 100644 --- a/inc/Maat_rule.h +++ b/inc/Maat_rule.h @@ -148,7 +148,7 @@ enum MAAT_INIT_OPT MAAT_OPT_INSTANCE_NAME, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1, no more than 11 bytes.DEFAULT: MAAT_$tableinfo_path$. MAAT_OPT_DECRYPT_KEY, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. No DEFAULT. MAAT_OPT_REDIS_IP, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. No DEFAULT. - MAAT_OPT_REDIS_PORT, //VALUE is a unsigned short, host order, SIZE= sizeof(unsigned short). No DEFAULT. + MAAT_OPT_REDIS_PORT, //VALUE is a unsigned short or a signed int, host order, SIZE= sizeof(unsigned short) or sizeof(int). No DEFAULT. MAAT_OPT_REDIS_INDEX, //VALUE is interger *, 0~15, SIZE=sizeof(int). DEFAULT: 0. MAAT_OPT_CMD_AUTO_NUMBERING, //VALUE is interger *, 1 or 0, SIZE=sizeof(int). DEFAULT: 1. MAAT_OPT_DEFERRED_LOAD //VALUE is NULL,SIZE is 0. Default: Deffered initialization OFF. diff --git a/src/entry/Maat_api.cpp b/src/entry/Maat_api.cpp index 910ea70..171f819 100644 --- a/src/entry/Maat_api.cpp +++ b/src/entry/Maat_api.cpp @@ -585,11 +585,18 @@ int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const vo memcpy(_feather->redis_ip,value,size); break; case MAAT_OPT_REDIS_PORT: - if((size_t)size!=sizeof(unsigned short)) + if((size_t)size==sizeof(unsigned short)) + { + _feather->redis_port=*((unsigned short*)value); + } + else if((size_t)size==sizeof(int)) + { + _feather->redis_port=*((int*)value); + } + else { return -1; } - _feather->redis_port=*((unsigned short*)value); break; case MAAT_OPT_REDIS_INDEX: if((size_t)size!=sizeof(int))