Fix warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct menusave_t'; use assignment or value-initialization instead [-Wclass-memaccess]

git-svn-id: https://svn.eduke32.com/eduke32@6950 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-07-23 02:55:56 +00:00
parent 104bdb131b
commit cc999ff883
2 changed files with 9 additions and 2 deletions

View file

@ -206,7 +206,7 @@ static void ReadSaveGameHeaders_Internal(void)
size_t const numfiles = countcache1dfind(findfiles_default);
size_t const internalsavesize = sizeof(menusave_t) * numfiles;
g_internalsaves = (menusave_t *)Xrealloc(g_internalsaves, internalsavesize);
memset(g_internalsaves, 0, internalsavesize);
g_internalsaves->clear();
g_numinternalsaves = 0;
ReadSaveGameHeaders_CACHE1D(findfiles_default);
@ -223,7 +223,7 @@ static void ReadSaveGameHeaders_Internal(void)
}
size_t const menusavesize = sizeof(menusave_t) * g_nummenusaves;
g_menusaves = (menusave_t *)Xrealloc(g_menusaves, menusavesize);
memset(g_menusaves, 0, menusavesize);
g_menusaves->clear();
for (size_t x = g_numinternalsaves-1, y = 0; x < g_numinternalsaves; --x)
{
menusave_t & msv = g_internalsaves[x];

View file

@ -98,6 +98,13 @@ struct menusave_t
uint8_t isOldVer = 0;
uint8_t isUnreadable = 0;
uint8_t isAutoSave = 0;
void clear()
{
brief.reset();
isOldVer = 0;
isUnreadable = 0;
isAutoSave = 0;
}
};
extern savebrief_t g_lastautosave, g_lastusersave, g_freshload;