无初始长度的文件,每次输入都进行查询。以后需要改进。

This commit is contained in:
zhengchao
2017-07-08 19:42:30 +08:00
parent 6ffc3e3ded
commit f568adc795
2 changed files with 15 additions and 19 deletions

View File

@@ -1543,6 +1543,11 @@ inline int REACH_QUERY_THRESH(unsigned long long total_len,unsigned long long ac
// { // {
// return 1; // return 1;
// } // }
//TODO use a more thorough strategy.
if(total_len==0)
{
return 1;
}
if(rate>(unsigned long long)(point_size+QUERY_MIN_RATE)) if(rate>(unsigned long long)(point_size+QUERY_MIN_RATE))
{ {
return 0; return 0;
@@ -1578,10 +1583,7 @@ int Maat_stream_scan_digest(stream_para_t * stream_para, const char * data, int
{ {
clock_gettime(CLOCK_MONOTONIC,&start); clock_gettime(CLOCK_MONOTONIC,&start);
} }
if(sp->acc_scan_len+(unsigned long long)data_len > sp->total_len)
{
goto fast_out;
}
aligment_int64_array_add(sp->feather->thread_call_cnt, sp->thread_num, 1); aligment_int64_array_add(sp->feather->thread_call_cnt, sp->thread_num, 1);
pthread_mutex_lock(&(sp->fuzzy_mutex)); pthread_mutex_lock(&(sp->fuzzy_mutex));
sp->acc_scan_len+=SFH_feed(sp->fuzzy_hash_handle, data, (unsigned int)data_len,offset); sp->acc_scan_len+=SFH_feed(sp->fuzzy_hash_handle, data, (unsigned int)data_len,offset);

View File

@@ -1291,15 +1291,15 @@ int GIE_query(GIE_handle_t * handle, const char * data, int data_len, GIE_result
if(_handle->ED_reexamine == 1) if(_handle->ED_reexamine == 1)
{ {
if(_handle->input_format == GIE_INPUT_FORMAT_SFH) if(_handle->input_format == GIE_INPUT_FORMAT_SFH)
{ {
conf = GIE_comp_edit_distance(data, fuzzy_string_len, tmp_gram, length); conf = GIE_comp_edit_distance(data, fuzzy_string_len, tmp_gram, length);
} }
else else
{ {
edit_distance = edit_distn(data, fuzzy_string_len,tmp_gram,length); edit_distance = edit_distn(data, fuzzy_string_len,tmp_gram,length);
conf = 100-(edit_distance*100)/(fuzzy_string_len + length); conf = 100-(edit_distance*100)/(fuzzy_string_len + length);
} }
} }
if(conf >= ret_tmp->cfds_lvl) if(conf >= ret_tmp->cfds_lvl)
@@ -1351,9 +1351,3 @@ unsigned long long GIE_status(GIE_handle_t * handle, int type)
return length; return length;
} }