shithub: ft²

Download patch

ref: 00d680a305c0b3602eafaeac8c5d19df736546b0
parent: 5d82686ad9754253d03d802d76d14c14c7dae086
parent: 812861d816be38fbd36ae323a6e23c33a1846e91
author: Olav Sørensen <olav.sorensen@live.no>
date: Sat Jul 24 18:00:57 EDT 2021

Merge pull request #22 from ftrvxmtrx/master

Make sure the pal16 struct type is packed (fixes crash on Plan 9)

--- a/src/ft2_config.c
+++ b/src/ft2_config.c
@@ -70,6 +70,7 @@
 {
 	lockMixerCallback();
 
+	assert(sizeof(config) == CONFIG_FILE_SIZE);
 	memcpy(&config, configBuffer, CONFIG_FILE_SIZE);
 
 	if (defaults)
--- a/src/ft2_palette.h
+++ b/src/ft2_palette.h
@@ -44,10 +44,21 @@
 	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);