commit 00d680a305c0b3602eafaeac8c5d19df736546b0
parent 5d82686ad9754253d03d802d76d14c14c7dae086
Author: Olav Sørensen <olav.sorensen@live.no>
Date: Sat, 24 Jul 2021 22:00:30 +0200
Merge pull request #22 from ftrvxmtrx/master
Make sure the pal16 struct type is packed (fixes crash on Plan 9)
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/ft2_config.c b/src/ft2_config.c
@@ -70,6 +70,7 @@ static void loadConfigFromBuffer(bool defaults)
{
lockMixerCallback();
+ assert(sizeof(config) == CONFIG_FILE_SIZE);
memcpy(&config, configBuffer, CONFIG_FILE_SIZE);
if (defaults)
diff --git a/src/ft2_palette.h b/src/ft2_palette.h
@@ -44,10 +44,21 @@ enum
PAL_NUM
};
+#ifdef _MSC_VER
+#pragma pack(push)
+#pragma pack(1)
+#endif
typedef struct pal16_t
{
uint8_t r, g, b;
-} pal16;
+}
+#ifdef __GNUC__
+__attribute__ ((packed))
+#endif
+pal16;
+#ifdef _MSC_VER
+#pragma pack(pop)
+#endif
void setCustomPalColor(uint32_t color);