mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Use ReadFile
to load updater index json
This commit is contained in:
parent
ceca44ea23
commit
5d49ee3684
|
@ -242,17 +242,12 @@ bool CUpdater::ReplaceServer()
|
|||
void CUpdater::ParseUpdate()
|
||||
{
|
||||
char aPath[IO_MAX_PATH_LENGTH];
|
||||
IOHANDLE File = m_pStorage->OpenFile(m_pStorage->GetBinaryPath("update/update.json", aPath, sizeof aPath), IOFLAG_READ | IOFLAG_SKIP_BOM, IStorage::TYPE_ABSOLUTE);
|
||||
if(!File)
|
||||
void *pBuf;
|
||||
unsigned Length;
|
||||
if(!m_pStorage->ReadFile(m_pStorage->GetBinaryPath("update/update.json", aPath, sizeof aPath), IStorage::TYPE_ABSOLUTE, &pBuf, &Length))
|
||||
return;
|
||||
|
||||
long int Length = io_length(File);
|
||||
char *pBuf = (char *)malloc(Length);
|
||||
mem_zero(pBuf, Length);
|
||||
io_read(File, pBuf, Length);
|
||||
io_close(File);
|
||||
|
||||
json_value *pVersions = json_parse(pBuf, Length);
|
||||
json_value *pVersions = json_parse((json_char *)pBuf, Length);
|
||||
free(pBuf);
|
||||
|
||||
if(pVersions && pVersions->type == json_array)
|
||||
|
|
Loading…
Reference in a new issue