更高MAAT_SET_SCAN_DISTRICT选项的参数要求,不再要求‘\0’结束。
This commit is contained in:
@@ -161,7 +161,7 @@ int Maat_table_callback_register(Maat_feather_t feather,short table_id,
|
||||
|
||||
enum MAAT_SCAN_OPT
|
||||
{
|
||||
MAAT_SET_SCAN_DISTRICT=1 //VALUE is a const char*,MUST end with '\0',SIZE= strlen(string+'\0')+1.DEFAULT: no default.
|
||||
MAAT_SET_SCAN_DISTRICT=1 //VALUE is a const char*,SIZE= strlen(string).DEFAULT: no default.
|
||||
};
|
||||
//return 0 if success, return -1 when failed;
|
||||
int Maat_set_scan_status(Maat_feather_t feather,scan_status_t* mid,enum MAAT_SCAN_OPT type,const void* value,int size);
|
||||
|
||||
@@ -1491,7 +1491,7 @@ int Maat_set_scan_status(Maat_feather_t feather,scan_status_t* mid,enum MAAT_SCA
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
map_ret=map_str2int(_feather->scanner->district_map,(const char*)value,&(_mid->district_id));
|
||||
map_ret=map_unNullstr2int(_feather->scanner->district_map,(const char*)value,size,&(_mid->district_id));
|
||||
if(map_ret<0)
|
||||
{
|
||||
//May be the district is not effected yet.
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "mesa_fuzzy.h"
|
||||
#include "great_index_engine.h"
|
||||
|
||||
int MAAT_FRAME_VERSION_1_8_20160909_TABLE_CONJ=1;
|
||||
int MAAT_FRAME_VERSION_1_8_20160918_TABLE_CONJ=1;
|
||||
const char *maat_module="MAAT Frame";
|
||||
|
||||
const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin",
|
||||
|
||||
@@ -75,6 +75,24 @@ int map_str2int(MESA_htable_handle handle,const char* string,int* value)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
int map_unNullstr2int(MESA_htable_handle handle,const char* string,int len,int* value)
|
||||
{
|
||||
int *data=NULL;
|
||||
long cb_ret=0;
|
||||
|
||||
data=(int*)MESA_htable_search_cb(handle,(unsigned char*)string,len,
|
||||
read_map_val,value,&cb_ret);
|
||||
|
||||
// data=(int*)MESA_htable_search(handle,(unsigned char*)string,len);
|
||||
if(cb_ret>0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
void duplicate_func(const uchar * key, uint size, void * data, void * user)
|
||||
{
|
||||
MESA_htable_handle target=(MESA_htable_handle)user;
|
||||
|
||||
@@ -4,6 +4,7 @@ MESA_htable_handle map_create(void);
|
||||
void map_destroy(MESA_htable_handle p);
|
||||
int map_register(MESA_htable_handle handle,const char* string,int value);
|
||||
int map_str2int(MESA_htable_handle handle,const char* string,int* value);
|
||||
int map_unNullstr2int(MESA_htable_handle handle,const char* string,int size,int* value);
|
||||
MESA_htable_handle map_duplicate(MESA_htable_handle origin_map);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@ int test_expr_plus(Maat_feather_t feather,const char* table_name,scan_status_t*
|
||||
printf("Should not hit without setting district.\n");
|
||||
return -1;
|
||||
}
|
||||
ret=Maat_set_scan_status(feather, mid, MAAT_SET_SCAN_DISTRICT,region_name,strlen(region_name)+1);
|
||||
ret=Maat_set_scan_status(feather, mid, MAAT_SET_SCAN_DISTRICT,region_name,strlen(region_name));
|
||||
if(ret<0)
|
||||
{
|
||||
printf("set MAAT_SET_SCAN_DISTRICT failed.\n");
|
||||
|
||||
Reference in New Issue
Block a user