From 44ae520284f792da7ad31c6a09a56a0688a0466c Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 21 May 2022 20:05:34 +0300 Subject: [PATCH] Remove flexible array member --- src/art.cc | 8 ++++---- src/art.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/art.cc b/src/art.cc index 4fc1b3b..5096a96 100644 --- a/src/art.cc +++ b/src/art.cc @@ -415,7 +415,7 @@ unsigned char* artLockFrameData(int fid, int frame, int direction, CacheEntry** frm = artGetFrame(art, frame, direction); if (frm != NULL) { - return frm->data; + return (unsigned char*)frm + sizeof(*frm); } } @@ -777,7 +777,7 @@ unsigned char* artGetFrameData(Art* art, int frame, int direction) return NULL; } - return frm->data; + return (unsigned char*)frm + sizeof(*frm); } // 0x419880 @@ -795,9 +795,9 @@ ArtFrame* artGetFrame(Art* art, int frame, int rotation) return NULL; } - ArtFrame* frm = (ArtFrame*)(art->data + art->dataOffsets[rotation]); + ArtFrame* frm = (ArtFrame*)((unsigned char*)art + sizeof(*art) + art->dataOffsets[rotation]); for (int index = 0; index < frame; index++) { - frm = (ArtFrame*)(frm->data + frm->size); + frm = (ArtFrame*)((unsigned char*)frm + sizeof(*frm) + frm->size); } return frm; } diff --git a/src/art.h b/src/art.h index de279e6..add05d5 100644 --- a/src/art.h +++ b/src/art.h @@ -77,7 +77,6 @@ typedef struct Art { short yOffsets[6]; int dataOffsets[6]; int field_3A; - unsigned char data[]; } Art; #pragma pack() @@ -89,7 +88,6 @@ typedef struct ArtFrame { int size; short x; short y; - unsigned char data[]; } ArtFrame; typedef struct ArtListDescription {