MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / parseUntilGarbage

Function parseUntilGarbage

launcher/Json.cpp:104–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104QJsonDocument parseUntilGarbage(const QByteArray& json, QJsonParseError* error, QString* garbage)
105{
106 auto doc = QJsonDocument::fromJson(json, error);
107 if (error->error == QJsonParseError::GarbageAtEnd) {
108 qsizetype offset = error->offset;
109 QByteArray validJson = json.left(offset);
110 doc = QJsonDocument::fromJson(validJson, error);
111
112 if (garbage)
113 *garbage = json.right(json.size() - offset);
114 }
115
116 return doc;
117}
118
119void writeString(QJsonObject& to, const QString& key, const QString& value)
120{

Callers 2

parseResponseMethod · 0.85
processMCMetaFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected