@@ -61,21 +61,12 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
61
61
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_OPENFILE;
62
62
return false ;
63
63
}
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);
75
66
fclose (pSt_File);
76
67
// 开始解析配置文件
77
68
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))
79
70
{
80
71
Config_IsErrorOccur = true ;
81
72
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARSE;
@@ -84,7 +75,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
84
75
_tcsxcpy (pSt_ServerConfig->tszSMSUrl , st_JsonRoot[" tszSMSUrl" ].asCString ());
85
76
_tcsxcpy (pSt_ServerConfig->tszIPAddr , st_JsonRoot[" tszIPAddr" ].asCString ());
86
77
pSt_ServerConfig->bDeamon = st_JsonRoot[" bDeamon" ].asInt ();
87
-
88
78
pSt_ServerConfig->nRTMPPort = st_JsonRoot[" nRTMPPort" ].asInt ();
89
79
pSt_ServerConfig->nHttpPort = st_JsonRoot[" nHttpPort" ].asInt ();
90
80
pSt_ServerConfig->nXStreamPort = st_JsonRoot[" nXStreamPort" ].asInt ();
@@ -137,7 +127,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
137
127
Json::Value st_PullWebRtc = st_Pull[" RTC" ];
138
128
Json::Value st_PullSrt = st_Pull[" SRT" ];
139
129
Json::Value st_PullTs = st_Pull[" TS" ];
140
-
141
130
pSt_ServerConfig->st_XPull .st_PullXStream .bEnable = st_PullXStream[" bEnable" ].asBool ();
142
131
pSt_ServerConfig->st_XPull .st_PullXStream .bPrePull = st_PullXStream[" bPrePull" ].asBool ();
143
132
0 commit comments