[Bugfix][T106BUG-18][T106BUG-11]merge sim patch

    Only Configure:No
    Affected branch:master
    Affected module:No
    Is it affected on both ZXIC and MTK: only ZXIC
    Self-test: Yes
    Doc Update: No

Change-Id: I52cffab83c99392b55772b0d7a9dcb441a18d0b7
diff --git a/ap/app/zte_comm/nvserver/nvupdate.c b/ap/app/zte_comm/nvserver/nvupdate.c
index 46565f8..90ec1af 100755
--- a/ap/app/zte_comm/nvserver/nvupdate.c
+++ b/ap/app/zte_comm/nvserver/nvupdate.c
@@ -23,84 +23,84 @@
 #endif
 extern T_NV_NODE*nv_list;
 #ifdef FOTA_AB
-int get_update_status(void){T_FLAGS_INFO flags_info={(0x143a+1964-0x1be6)};
-unsigned int status=(0x663+612-0x8c7);int ret=(0x195c+474-0x1b36);ret=flags_get(
-&flags_info);status=flags_info.boot_fota_flag.fota_status;if(status==
-(0x740+7441-0x2450))return(0x16d9+3508-0x248b);else return(0x15e4+4022-0x259a);}
+int get_update_status(void){T_FLAGS_INFO flags_info={(0xc56+1828-0x137a)};
+unsigned int status=(0xa61+3485-0x17fe);int ret=(0x1f55+1413-0x24da);ret=
+flags_get(&flags_info);status=flags_info.boot_fota_flag.fota_status;if(status==
+(0x109+7756-0x1f54))return(0xc18+3727-0x1aa5);else return(0x864+3912-0x17ac);}
 #else
-int get_update_status(void){int update_status;FILE*fd=(0x1fe7+737-0x22c8);int 
+int get_update_status(void){int update_status;FILE*fd=(0x8aa+3942-0x1810);int 
 ret;char*filename=NULL;if(access(FOTA_UPDATE_STATUS_FILE_OLD,R_OK)==
-(0x1808+2242-0x20ca)){filename=FOTA_UPDATE_STATUS_FILE_OLD;}else{filename=
+(0x3f6+8063-0x2375)){filename=FOTA_UPDATE_STATUS_FILE_OLD;}else{filename=
 FOTA_UPDATE_STATUS_FILE;}printf(
 "get_update_status, read_update_status from %s\n",filename);fd=fopen(filename,
 "\x72\x62\x2b");if(fd==NULL){printf(
 "\x5b\x6e\x76\x73\x65\x72\x76\x65\x72\x5d\x75\x70\x64\x61\x74\x65\x5f\x73\x74\x61\x74\x75\x73\x20\x6f\x70\x65\x6e\x20\x20\x65\x72\x72\x6f\x72\x3a\x25\x73" "\n"
 ,strerror(errno));goto error0;}ret=fscanf(fd,"\x25\x64",(int*)&update_status);if
-(ret<(0xa61+4828-0x1d3d)){printf(
+(ret<(0x1f00+438-0x20b6)){printf(
 "\x67\x65\x74\x20\x69\x6e\x66\x6f\x20\x66\x72\x6f\x6d\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72\x3a\x25\x73" "\n"
 ,strerror(errno));fclose(fd);goto error0;}printf(
 "\x75\x70\x64\x61\x74\x65\x5f\x73\x74\x61\x74\x75\x73\x3d\x25\x64" "\n",
-update_status);fclose(fd);return update_status;error0:return-(0xf6a+854-0x12bf);
-}
+update_status);fclose(fd);return update_status;error0:return-(0x6c9+5426-0x1bfa)
+;}
 #endif
 int nvupdate(char*nv_file,char*config_file,const char*key,const char*value,int 
-saveFlag){int index=(0x1af9+1683-0x218c);int key_buf_len=(0x555+1941-0xcea);int 
-value_buf_len=(0x186b+2309-0x2170);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;
+saveFlag){int index=(0x386+929-0x727);int key_buf_len=(0x32c+3352-0x1044);int 
+value_buf_len=(0x17a+585-0x3c3);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;
 T_NV_ITEM*newItem=NULL;if(NULL==key||NULL==value)return RESULT_FAIL;printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x6e\x76\x5f\x66\x69\x6c\x65\x3a\x25\x73\x20\x6b\x65\x79\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73" "\n"
-,nv_file,key,value);key_buf_len=strlen(key)+(0x1aa3+663-0x1d39);value_buf_len=
-strlen(value)+(0x18f+9358-0x261c);for(list=nv_list;list;list=list->next){if(
+,nv_file,key,value);key_buf_len=strlen(key)+(0xc25+402-0xdb6);value_buf_len=
+strlen(value)+(0xd7+5252-0x155a);for(list=nv_list;list;list=list->next){if(
 strcmp(list->nvFile,nv_file))continue;index=hash(key)%NV_HASH_LEN;for(item=list
 ->nvTable[index];item;item=item->next){if(strcmp(item->key,key))continue;if(
 saveFlag)item->saveFlag=saveFlag;if(!strcmp(item->value,value)){item->
-update_flag=(0x10b8+342-0x120d);printf(
+update_flag=(0x414+5234-0x1885);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x73\x61\x6d\x65\x73\x6b\x69\x70\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
 ,item->key,item->value,value,config_file);return RESULT_SUCCESS;}if(strstr(
-config_file,"\x75\x73\x65\x72")){if((0x5c8+835-0x90a)==item->update_flag){printf
-(
+config_file,"\x75\x73\x65\x72")){if((0x188+5416-0x16af)==item->update_flag){
+printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x73\x65\x63\x6f\x6e\x64\x20\x63\x68\x61\x6e\x67\x65\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
 ,item->key,item->value,value,config_file);}else{item->update_flag=
-(0x74c+636-0x9c7);printf(
+(0x91d+139-0x9a7);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x75\x73\x65\x72\x73\x6b\x69\x70\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x31\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
 ,item->key,item->value,value,config_file);return RESULT_SUCCESS;}}printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6b\x65\x79\x3d\x25\x73\x20\x63\x68\x61\x6e\x67\x65\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x74\x6f\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
 ,item->key,item->value,value);free(item->value);item->value=(char*)malloc(
 value_buf_len);if(!item->value)return RESULT_MALLOC_FAIL;strncpy(item->value,
-value,value_buf_len-(0x1745+619-0x19af));item->value[value_buf_len-
-(0x1ffc+469-0x21d0)]='\0';item->update_flag=(0x1224+1037-0x1630);return 
+value,value_buf_len-(0x103d+3904-0x1f7c));item->value[value_buf_len-
+(0x5c8+305-0x6f8)]='\0';item->update_flag=(0x11e2+1934-0x196f);return 
 RESULT_SUCCESS;}newItem=(T_NV_ITEM*)malloc(sizeof(T_NV_ITEM));if(!newItem){
 printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x31\x20" "\n"
 );return RESULT_MALLOC_FAIL;}newItem->key=(char*)malloc(strlen(key)+
-(0x1659+1613-0x1ca5));if(!newItem->key){free(newItem);printf(
+(0xc37+6367-0x2515));if(!newItem->key){free(newItem);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x32" "\n"
 );return RESULT_MALLOC_FAIL;}newItem->value=(char*)malloc(value_buf_len);if(!
 newItem->value){free(newItem->key);free(newItem);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x33\x20" "\n"
 );return RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,key_buf_len-
-(0x1f92+1019-0x238c));newItem->key[key_buf_len-(0x1fb+279-0x311)]='\0';strncpy(
-newItem->value,value,value_buf_len-(0x5bb+3024-0x118a));newItem->value[
-value_buf_len-(0x87a+311-0x9b0)]='\0';newItem->next=NULL;newItem->saveFlag=
-saveFlag;newItem->update_flag=(0x210d+472-0x22e4);printf(
+(0x11ea+4455-0x2350));newItem->key[key_buf_len-(0x1e75+556-0x20a0)]='\0';strncpy
+(newItem->value,value,value_buf_len-(0x2cd+1769-0x9b5));newItem->value[
+value_buf_len-(0x555+8051-0x24c7)]='\0';newItem->next=NULL;newItem->saveFlag=
+saveFlag;newItem->update_flag=(0x103f+5836-0x270a);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x61\x64\x64\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
 ,newItem->key,newItem->value);if(!list->nvTable[index])list->nvTable[index]=
 newItem;else{newItem->next=list->nvTable[index]->next;list->nvTable[index]->next
 =newItem;}return RESULT_SUCCESS;}return RESULT_FAIL;}int reloadFactroyParam(
 T_NV_NODE*list){char*val=NULL;FILE*fp=NULL;T_NV_CONFIG*config=NULL;char buf[
-NV_MAX_ITEM_LEN]={(0x70a+1556-0xd1e)};printf(
+NV_MAX_ITEM_LEN]={(0x16f4+3164-0x2350)};printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x6e\x76\x46\x69\x6c\x65\x3a\x25\x73" "\n"
 ,list->nvFile);for(config=list->fileList;config;config=config->next){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x63\x6f\x6e\x66\x69\x67\x46\x69\x6c\x65\x20\x73\x74\x61\x72\x74\x3a\x25\x73\x21" "\n"
 ,config->configFile);fp=fopen(config->configFile,"\x72\x6f");if(!fp){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
 ,config->configFile,errno);return RESULT_FILE_OPEN_FAIL;}while(fgets(buf,
-NV_MAX_ITEM_LEN,fp)){if(buf[(0x1100+717-0x13cd)]=='\n'||buf[(0xb44+5762-0x21c6)]
-==((char)(0x111+4889-0x1407)))continue;val=strchr(buf,
-((char)(0x327+6366-0x1bc8)));if(!val){printf(
+NV_MAX_ITEM_LEN,fp)){if(buf[(0x132a+1872-0x1a7a)]=='\n'||buf[(0x1b8+6120-0x19a0)
+]==((char)(0xb13+4768-0x1d90)))continue;val=strchr(buf,
+((char)(0x1a99+2848-0x257c)));if(!val){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x73\x74\x72\x69\x6e\x67\x20\x3d\x20\x25\x73" "\n"
-,config->configFile,buf);continue;}buf[strlen(buf)-(0x1832+671-0x1ad0)]='\0';*
-val++='\0';nvupdate(list->nvFile,config->configFile,buf,val,(0x1693+1037-0x1a9f)
-);}printf(
+,config->configFile,buf);continue;}buf[strlen(buf)-(0xab8+5631-0x20b6)]='\0';*
+val++='\0';nvupdate(list->nvFile,config->configFile,buf,val,(0x326+6743-0x1d7c))
+;}printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x63\x6f\x6e\x66\x69\x67\x46\x69\x6c\x65\x20\x65\x6e\x64\x3a\x25\x73\x21" "\n"
 ,config->configFile);fclose(fp);}return RESULT_SUCCESS;}void dump_list(T_NV_ITEM
 *list){if(list==NULL){printf(
@@ -108,12 +108,12 @@
 list->next;while(p!=NULL){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x75\x6d\x70\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x2c\x20\x70\x3d\x30\x78\x25\x78" "\n"
 ,p->key,p->value,((unsigned int)p));p=p->next;}}int delete_not_needed(T_NV_NODE*
-list){int index=(0xff2+1821-0x170f);T_NV_ITEM*item=NULL;T_NV_ITEM head={
-(0x1062+5597-0x263f)};T_NV_ITEM*prev=&head;printf(
+list){int index=(0x1a5c+3012-0x2620);T_NV_ITEM*item=NULL;T_NV_ITEM head={
+(0x8fb+4667-0x1b36)};T_NV_ITEM*prev=&head;printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x65\x6c\x65\x74\x65\x5f\x6e\x6f\x74\x5f\x6e\x65\x65\x64\x65\x64\x20\x65\x6e\x74\x65\x72\x20\x2a\x2a\x2a" "\n"
-);for(index=(0xb61+2216-0x1409);index<NV_HASH_LEN;index++){head.next=list->
-nvTable[index];prev=&head;for(item=prev->next;item;){if((0x1c20+418-0x1dc1)==
-item->update_flag){prev=item;item=item->next;}else{printf(
+);for(index=(0x179+6200-0x19b1);index<NV_HASH_LEN;index++){head.next=list->
+nvTable[index];prev=&head;for(item=prev->next;item;){if((0xf8+4954-0x1451)==item
+->update_flag){prev=item;item=item->next;}else{printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x65\x6c\x65\x74\x65\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
 ,item->key,item->value);prev->next=item->next;free(item->key);free(item->value);
 free(item);item=prev->next;}}list->nvTable[index]=head.next;}printf(