mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Use ReadFile
in CServerBrowser::LoadDDNetInfoJson
This commit is contained in:
parent
93536b8977
commit
7050022b08
|
@ -1480,26 +1480,14 @@ int CServerBrowser::HasRank(const char *pMap)
|
||||||
|
|
||||||
void CServerBrowser::LoadDDNetInfoJson()
|
void CServerBrowser::LoadDDNetInfoJson()
|
||||||
{
|
{
|
||||||
IOHANDLE File = m_pStorage->OpenFile(DDNET_INFO, IOFLAG_READ | IOFLAG_SKIP_BOM, IStorage::TYPE_SAVE);
|
void *pBuf;
|
||||||
if(!File)
|
unsigned Length;
|
||||||
|
if(!m_pStorage->ReadFile(DDNET_INFO, IStorage::TYPE_SAVE, &pBuf, &Length))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int Length = io_length(File);
|
|
||||||
if(Length <= 0)
|
|
||||||
{
|
|
||||||
io_close(File);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *pBuf = (char *)malloc(Length);
|
|
||||||
pBuf[0] = '\0';
|
|
||||||
|
|
||||||
io_read(File, pBuf, Length);
|
|
||||||
io_close(File);
|
|
||||||
|
|
||||||
json_value_free(m_pDDNetInfo);
|
json_value_free(m_pDDNetInfo);
|
||||||
|
|
||||||
m_pDDNetInfo = json_parse(pBuf, Length);
|
m_pDDNetInfo = json_parse((json_char *)pBuf, Length);
|
||||||
|
|
||||||
free(pBuf);
|
free(pBuf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue