| 1381 | } |
| 1382 | |
| 1383 | void CServerBrowser::LoadDDNetInfoJson() |
| 1384 | { |
| 1385 | void *pBuf; |
| 1386 | unsigned Length; |
| 1387 | if(!m_pStorage->ReadFile(DDNET_INFO_FILE, IStorage::TYPE_SAVE, &pBuf, &Length)) |
| 1388 | { |
| 1389 | // Keep old info if available |
| 1390 | return; |
| 1391 | } |
| 1392 | |
| 1393 | m_DDNetInfoSha256 = sha256(pBuf, Length); |
| 1394 | |
| 1395 | json_value_free(m_pDDNetInfo); |
| 1396 | json_settings JsonSettings{}; |
| 1397 | char aError[256]; |
| 1398 | m_pDDNetInfo = json_parse_ex(&JsonSettings, static_cast<json_char *>(pBuf), Length, aError); |
| 1399 | free(pBuf); |
| 1400 | |
| 1401 | if(m_pDDNetInfo == nullptr) |
| 1402 | { |
| 1403 | log_error("serverbrowser", "invalid info json: '%s'", aError); |
| 1404 | } |
| 1405 | else if(m_pDDNetInfo->type != json_object) |
| 1406 | { |
| 1407 | log_error("serverbrowser", "invalid info root"); |
| 1408 | json_value_free(m_pDDNetInfo); |
| 1409 | m_pDDNetInfo = nullptr; |
| 1410 | } |
| 1411 | } |
| 1412 | |
| 1413 | void CServerBrowser::LoadDDNetLocation() |
| 1414 | { |
nothing calls this directly
no test coverage detected