From 830e75eeba7a49cc79183a1ef253e78ead879766 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Sat, 30 Sep 2017 16:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=89=B4=E4=BA=8EMESA=5Fprof=5Fload=E5=8F=AA?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E8=AF=BB=E5=8F=96int=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=BE=88=E5=A4=9A=E5=90=8C=E4=BA=8B=E5=9C=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=AB=AF=E5=8F=A3=E6=97=B6=E4=B8=8D=E6=96=B9?= =?UTF-8?q?=E4=BE=BF=EF=BC=8C=E7=8E=B0=E5=90=8C=E6=97=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?int=E5=92=8Cunsigned=20short=E4=B8=A4=E7=A7=8D=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E6=95=B0=E5=80=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/Maat_rule.h | 2 +- src/entry/Maat_api.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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))