NetworkSystem: provide buffer size to RapidJSON parser

We already know the buffer size, this avoids having to recalculate it in the parser.
This commit is contained in:
Kawe Mazidjatari 2025-01-13 15:51:07 +01:00
parent 9bcbf3187c
commit de4a3d294c
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ void CBanSystem::LoadList(void)
pBuf[nRead] = '\0'; // Null terminate the string buffer containing our banned list.
rapidjson::Document document;
if (document.Parse(pBuf.get()).HasParseError())
if (document.Parse(pBuf.get()).HasParseError(), nRead)
{
Warning(eDLL_T::SERVER, "%s: JSON parse error at position %zu: %s\n",
__FUNCTION__, document.GetErrorOffset(), rapidjson::GetParseError_En(document.GetParseError()));

View File

@ -477,7 +477,7 @@ bool CPylon::SendRequest(const char* endpoint, const rapidjson::Document& reques
if (status == 200) // STATUS_OK
{
responseJson.Parse(responseBody.c_str());
responseJson.Parse(responseBody.c_str(), responseBody.length()+1);
if (responseJson.HasParseError())
{
@ -617,7 +617,7 @@ void CPylon::ExtractError(const string& response, string& outMessage,
if (!response.empty())
{
rapidjson::Document resultBody;
resultBody.Parse(response.c_str());
resultBody.Parse(response.c_str(), response.length()+1);
ExtractError(resultBody, outMessage, status, errorText);
}