fix ldname error when ledger update
This commit is contained in:
@@ -1446,7 +1446,7 @@ int parse_rpt_log_ini()
|
|||||||
|
|
||||||
for (cpuno = 0; cpuno < ied->cpucount; cpuno++) {
|
for (cpuno = 0; cpuno < ied->cpucount; cpuno++) {
|
||||||
LD_info = &(ied_usr->LD_info[cpuno]);
|
LD_info = &(ied_usr->LD_info[cpuno]);
|
||||||
char str[256]; //256大小
|
//char str[256]; //256大小
|
||||||
char* tmp = Get_IED(ied_usr->dev_type);
|
char* tmp = Get_IED(ied_usr->dev_type);
|
||||||
if(tmp == NULL){std::cerr << "front read ied config error!" << std::endl;continue;}
|
if(tmp == NULL){std::cerr << "front read ied config error!" << std::endl;continue;}
|
||||||
qDebug() << tmp << endl;
|
qDebug() << tmp << endl;
|
||||||
@@ -5641,11 +5641,11 @@ int parse_rpt_log_ini_one(ied_t* ied)
|
|||||||
LD_info = &(ied_usr->LD_info[cpuno]);
|
LD_info = &(ied_usr->LD_info[cpuno]);
|
||||||
|
|
||||||
//这些可能是已有的内存,经过判断才能从g_init_pool中分配内存,lnk20250122
|
//这些可能是已有的内存,经过判断才能从g_init_pool中分配内存,lnk20250122
|
||||||
char str[256];
|
//char str[256];
|
||||||
char* tmp = Get_IED(ied_usr->dev_type);
|
char* tmp = Get_IED(ied_usr->dev_type);
|
||||||
if(tmp == NULL){std::cerr << "front read ied config error!" << std::endl;continue;}
|
if(tmp == NULL){std::cerr << "front read ied config error!" << std::endl;continue;}
|
||||||
qDebug() << tmp << endl;
|
qDebug() << tmp << endl;
|
||||||
apr_snprintf(str, sizeof(str), tmp, cpuno + 1);
|
//apr_snprintf(str, sizeof(str), tmp, cpuno + 1);
|
||||||
|
|
||||||
//调试
|
//调试
|
||||||
printf("%s使用内存地址 LD_name[%d]: %p\n", ied_usr->terminal_id, cpuno, (void*)ied_usr->LD_info[cpuno].LD_name);
|
printf("%s使用内存地址 LD_name[%d]: %p\n", ied_usr->terminal_id, cpuno, (void*)ied_usr->LD_info[cpuno].LD_name);
|
||||||
@@ -5656,7 +5656,11 @@ int parse_rpt_log_ini_one(ied_t* ied)
|
|||||||
continue;//跳过防止崩溃
|
continue;//跳过防止崩溃
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("logini ied_usr->LD_info[cpuno - 1].LD_name: %s\n", ied_usr->LD_info[cpuno].LD_name);
|
printf("old logini ied_usr->LD_info[cpuno - 1].LD_name: %s\n", ied_usr->LD_info[cpuno].LD_name);
|
||||||
|
|
||||||
|
apr_snprintf(ied_usr->LD_info[cpuno].LD_name, 256, tmp, cpuno + 1);//注意拷贝大小,容易段错误,lnk20250702
|
||||||
|
|
||||||
|
printf("new logini ied_usr->LD_info[cpuno - 1].LD_name: %s\n", ied_usr->LD_info[cpuno].LD_name);
|
||||||
|
|
||||||
delete[] tmp;//Get_IED中分配了内存,使用后删除
|
delete[] tmp;//Get_IED中分配了内存,使用后删除
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user