@@ -43,7 +43,7 @@ bool CConfig_Json::Config_Json_File(LPCXSTR lpszConfigFile,XENGINE_SERVERCONFIG
4343 Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_PARAMENT;
4444 return false ;
4545 }
46- XCHAR tszMsgBuffer[4096 ] = {};
46+ XCHAR tszMsgBuffer[8196 ] = {};
4747 size_t nSize = fread (tszMsgBuffer, 1 , sizeof (tszMsgBuffer), pSt_File);
4848 fclose (pSt_File);
4949
@@ -191,21 +191,12 @@ bool CConfig_Json::Config_Json_VersionFile(LPCXSTR lpszConfigFile, XENGINE_SERVE
191191 Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_PARAMENT;
192192 return false ;
193193 }
194- int nCount = 0 ;
195- XCHAR tszMsgBuffer[4096 ];
196- while (1 )
197- {
198- int nRet = fread (tszMsgBuffer + nCount, 1 , 2048 , pSt_File);
199- if (nRet <= 0 )
200- {
201- break ;
202- }
203- nCount += nRet;
204- }
194+ XCHAR tszMsgBuffer[XPATH_8MAX] = {};
195+ int nRet = fread (tszMsgBuffer, 1 , XPATH_8MAX, pSt_File);
205196 fclose (pSt_File);
206197
207198 std::unique_ptr<Json::CharReader> const pSt_JsonReader (st_JsonBuilder.newCharReader ());
208- if (!pSt_JsonReader->parse (tszMsgBuffer, tszMsgBuffer + nCount , &st_JsonRoot, &st_JsonError))
199+ if (!pSt_JsonReader->parse (tszMsgBuffer, tszMsgBuffer + nRet , &st_JsonRoot, &st_JsonError))
209200 {
210201 Config_IsErrorOccur = true ;
211202 Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_PARSE;
@@ -248,21 +239,12 @@ bool CConfig_Json::Config_Json_DBFile(LPCXSTR lpszConfigFile, MESSAGEQUEUE_DBCON
248239 Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_PARAMENT;
249240 return false ;
250241 }
251- int nCount = 0 ;
252- XCHAR tszMsgBuffer[4096 ];
253- while (1 )
254- {
255- int nRet = fread (tszMsgBuffer + nCount, 1 , 2048 , pSt_File);
256- if (nRet <= 0 )
257- {
258- break ;
259- }
260- nCount += nRet;
261- }
242+ XCHAR tszMsgBuffer[XPATH_8MAX] = {};
243+ int nRet = fread (tszMsgBuffer, 1 , XPATH_8MAX, pSt_File);
262244 fclose (pSt_File);
263245
264246 std::unique_ptr<Json::CharReader> const pSt_JsonReader (st_JsonBuilder.newCharReader ());
265- if (!pSt_JsonReader->parse (tszMsgBuffer, tszMsgBuffer + nCount , &st_JsonRoot, &st_JsonError))
247+ if (!pSt_JsonReader->parse (tszMsgBuffer, tszMsgBuffer + nRet , &st_JsonRoot, &st_JsonError))
266248 {
267249 Config_IsErrorOccur = true ;
268250 Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_PARSE;
0 commit comments