mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
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:
parent
9bcbf3187c
commit
de4a3d294c
@ -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()));
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user