save.c: fix strict aliasing violation

This commit is contained in:
rofl0r 2017-11-22 15:20:40 +00:00
parent 78f93ecb32
commit db027ddd90
1 changed files with 2 additions and 2 deletions

4
save.c
View File

@ -170,7 +170,7 @@ void loadstate(FILE *f)
{ {
for (i = 0; svars[i].ptr; i++) for (i = 0; svars[i].ptr; i++)
{ {
if (header[j][0] != *(un32 *)svars[i].key) if (memcmp(&header[j][0], svars[i].key, 4))
continue; continue;
d = LIL(header[j][1]); d = LIL(header[j][1]);
switch (svars[i].len) switch (svars[i].len)
@ -231,7 +231,7 @@ void savestate(FILE *f)
for (i = 0; svars[i].len > 0; i++) for (i = 0; svars[i].len > 0; i++)
{ {
header[i][0] = *(un32 *)svars[i].key; memcpy(&header[i][0], svars[i].key, 4);
switch (svars[i].len) switch (svars[i].len)
{ {
case 1: case 1: