@@ -61,21 +61,12 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
6161 Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_OPENFILE;
6262 return false ;
6363 }
64- size_t nCount = 0 ;
65- XCHAR tszMsgBuffer[4096 ];
66- while (1 )
67- {
68- size_t nRet = fread (tszMsgBuffer + nCount, 1 , 2048 , pSt_File);
69- if (nRet <= 0 )
70- {
71- break ;
72- }
73- nCount += nRet;
74- }
64+ XCHAR tszMsgBuffer[8192 ] = {};
65+ size_t nRet = fread (tszMsgBuffer, 1 , sizeof (tszMsgBuffer), pSt_File);
7566 fclose (pSt_File);
7667 // 开始解析配置文件
7768 std::unique_ptr<Json::CharReader> const pSt_JsonReader (st_JsonBuilder.newCharReader ());
78- if (!pSt_JsonReader->parse (tszMsgBuffer, tszMsgBuffer + nCount , &st_JsonRoot, &st_JsonError))
69+ if (!pSt_JsonReader->parse (tszMsgBuffer, tszMsgBuffer + nRet , &st_JsonRoot, &st_JsonError))
7970 {
8071 Config_IsErrorOccur = true ;
8172 Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARSE;
@@ -84,7 +75,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
8475 _tcsxcpy (pSt_ServerConfig->tszSMSUrl , st_JsonRoot[" tszSMSUrl" ].asCString ());
8576 _tcsxcpy (pSt_ServerConfig->tszIPAddr , st_JsonRoot[" tszIPAddr" ].asCString ());
8677 pSt_ServerConfig->bDeamon = st_JsonRoot[" bDeamon" ].asInt ();
87-
8878 pSt_ServerConfig->nRTMPPort = st_JsonRoot[" nRTMPPort" ].asInt ();
8979 pSt_ServerConfig->nHttpPort = st_JsonRoot[" nHttpPort" ].asInt ();
9080 pSt_ServerConfig->nXStreamPort = st_JsonRoot[" nXStreamPort" ].asInt ();
@@ -137,7 +127,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
137127 Json::Value st_PullWebRtc = st_Pull[" RTC" ];
138128 Json::Value st_PullSrt = st_Pull[" SRT" ];
139129 Json::Value st_PullTs = st_Pull[" TS" ];
140-
141130 pSt_ServerConfig->st_XPull .st_PullXStream .bEnable = st_PullXStream[" bEnable" ].asBool ();
142131 pSt_ServerConfig->st_XPull .st_PullXStream .bPrePull = st_PullXStream[" bPrePull" ].asBool ();
143132
0 commit comments