From fccf38291671f1c24d5d130f5d6cfba49ad683df Mon Sep 17 00:00:00 2001 From: zhengchao Date: Sat, 3 Sep 2016 16:39:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=8E=E5=8C=96maat=5Fstat=E8=BE=93=E5=87=BA?= =?UTF-8?q?=EF=BC=8C=E8=A1=A8=E5=90=8D=E8=B6=85=E8=BF=8722=E5=AD=97?= =?UTF-8?q?=E8=8A=82=E6=97=B6=E4=BC=9A=E8=A2=AB=E6=88=AA=E6=96=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entry/Maat_stat.cpp | 7 ++++++- src/entry/mesa_fuzzy.c | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/entry/Maat_stat.cpp b/src/entry/Maat_stat.cpp index 8bdd7e0..60f8fdd 100644 --- a/src/entry/Maat_stat.cpp +++ b/src/entry/Maat_stat.cpp @@ -23,6 +23,7 @@ enum MAAT_FS_COLUMN COLUMN_TABLE_CPU_TIME,//microseconds COLUMN_TABLE_HIT_CNT, }; +#define MAX_CONJ_NAME_LEN 22 void maat_stat_init(struct _Maat_feather_t* feather) { int value=0; @@ -101,7 +102,11 @@ void maat_stat_init(struct _Maat_feather_t* feather) offset+=snprintf(conj_table_name+offset,sizeof(conj_table_name)-offset ,"%s/",p_table->table_name[j]); } - conj_table_name[j]='\0';//delete the last slash + conj_table_name[offset-1]='\0';//delete the last slash + if(strlen(conj_table_name)>MAX_CONJ_NAME_LEN) + { + snprintf(conj_table_name+MAX_CONJ_NAME_LEN-2,sizeof(conj_table_name)-MAX_CONJ_NAME_LEN-2,".."); + } p_table->stat_line_id=FS_register(feather->stat_handle , FS_STYLE_LINE, FS_CALC_CURRENT ,conj_table_name); diff --git a/src/entry/mesa_fuzzy.c b/src/entry/mesa_fuzzy.c index 88a1b6c..69eab3f 100644 --- a/src/entry/mesa_fuzzy.c +++ b/src/entry/mesa_fuzzy.c @@ -12,7 +12,7 @@ #define INIT_SIZE 128 #define ENTROPY_THRESHOLD 0.5 int count = 0; -const char * b64 = +const char * sfh_b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -626,17 +626,17 @@ void sfh_output_state(IVI_seg_t * seg, void * user_para) memset(hash_result,0,sizeof(hash_result)); if(seg->left == 0) { - hash_result[j] = b64[zt_hash_code(&(node->ps)) & 0x3F]; + hash_result[j] = sfh_b64[zt_hash_code(&(node->ps)) & 0x3F]; j++; } for(i = 0; i < node->s_cnt; i++,j++) { - hash_result[j] = b64[(node->s_array[i].val) & 0x3F]; + hash_result[j] = sfh_b64[(node->s_array[i].val) & 0x3F]; } hash_result[j+1]='\0'; if(0!=memcmp(&(node->s_state),ZT_INIT_VAL,sizeof(ZT_INIT_VAL))) { - result->last_char=b64[zt_hash_code(&(node->s_state)) & 0x3F]; + result->last_char=sfh_b64[zt_hash_code(&(node->s_state)) & 0x3F]; } else {