@@ -406,7 +406,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_DNSFile(LPCXSTR lpszConfigFile,
406406 JSONCPP_STRING st_JsonError;
407407 Json::Value st_JsonRoot;
408408 Json::CharReaderBuilder st_JsonBuilder;
409-
410409 FILE* pSt_File = fopen (lpszConfigFile, " rb" );
411410 if (NULL == pSt_File)
412411 {
@@ -417,37 +416,34 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_DNSFile(LPCXSTR lpszConfigFile,
417416 XCHAR tszMsgBuffer[8192 ] = {};
418417 size_t nRet = fread (tszMsgBuffer, 1 , sizeof (tszMsgBuffer), pSt_File);
419418 fclose (pSt_File);
420-
421419 std::unique_ptr<Json::CharReader> const pSt_JsonReader (st_JsonBuilder.newCharReader ());
422420 if (!pSt_JsonReader->parse (tszMsgBuffer, tszMsgBuffer + nRet, &st_JsonRoot, &st_JsonError))
423421 {
424422 Config_IsErrorOccur = true ;
425423 Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARSE;
426424 return false ;
427425 }
428-
429426 Json::Value st_JsonServer = st_JsonRoot[" DNSServer" ];
430427 for (unsigned int i = 0 ; i < st_JsonRoot[" DNSServer" ].size (); i++)
431428 {
432429 pSt_DNSList->stl_ListDNSServer .push_back (st_JsonServer[i].asCString ());
433430 }
434-
435431 Json::Value st_JsonList = st_JsonRoot[" DNSList" ];
436432 for (unsigned int i = 0 ; i < st_JsonRoot[" DNSList" ].size (); i++)
437433 {
438434 XENGINE_DNSDOMAIN st_DNSDomain = {};
439435
440- st_DNSDomain.bEnable = st_JsonList[" bEnable" ].asBool ();
441- _tcsxcpy (st_DNSDomain.tszDNSName , st_JsonList[" DNSName" ].asCString ());
436+ st_DNSDomain.bEnable = st_JsonList[i][ " bEnable" ].asBool ();
437+ _tcsxcpy (st_DNSDomain.tszDNSName , st_JsonList[i][ " DNSName" ].asCString ());
442438
443- Json::Value st_JsonAddr = st_JsonList[" DNSAddr" ];
444- for (unsigned int j = 0 ; j < st_JsonList[" DNSAddr" ].size (); j++)
439+ Json::Value st_JsonAddr = st_JsonList[i][ " DNSAddr" ];
440+ for (unsigned int j = 0 ; j < st_JsonList[i][ " DNSAddr" ].size (); j++)
445441 {
446442 XENGINE_DNSADDRINFO st_DNSAddr = {};
447- st_DNSAddr.nType = st_JsonAddr[" Type" ].asInt ();
448- st_DNSAddr.nTTL = st_JsonAddr[" TTL" ].asInt ();
449- _tcsxcpy (st_DNSAddr.tszDNSName , st_JsonAddr[" Name" ].asCString ());
450- _tcsxcpy (st_DNSAddr.tszDNSAddr , st_JsonAddr[" Addr" ].asCString ());
443+ st_DNSAddr.nType = st_JsonAddr[j][ " Type" ].asInt ();
444+ st_DNSAddr.nTTL = st_JsonAddr[j][ " TTL" ].asInt ();
445+ _tcsxcpy (st_DNSAddr.tszDNSName , st_JsonAddr[j][ " Name" ].asCString ());
446+ _tcsxcpy (st_DNSAddr.tszDNSAddr , st_JsonAddr[j][ " Addr" ].asCString ());
451447
452448 st_DNSDomain.stl_ListDNSAddr .push_back (st_DNSAddr);
453449 }
0 commit comments