shithub: ft2-clone

Download patch

ref: 2cf6fcbce159ce595a388d078dd940c08a8b010f
parent: fa8fc530f8604c935804008cec6e2c89702c6f18
author: Olav Sørensen <olav.sorensen@live.no>
date: Mon Sep 7 07:38:04 EDT 2020

Fix parsing error in an XM-load error message

--- a/src/ft2_module_loader.c
+++ b/src/ft2_module_loader.c
@@ -1697,8 +1697,10 @@
 	{
 		fclose(f);
 
-		sprintf(tmpText, "Error loading .xm: Unsupported XM version (v%1d.%1d%1d)",
-			'0' + (((h.ver >> 8) & 0x0F) % 10), '0' + (((h.ver >> 4) & 0x0F)) % 10, '0' + ((h.ver & 0x0F)) % 10);
+		const int32_t major = (h.ver >> 8) & 0x0F;
+		const int32_t minor = h.ver & 0xFF;
+
+		sprintf(tmpText, "Error loading .xm: Unsupported file version (v%01X.%02X)", major, minor);
 		showMsg(0, "System message", tmpText);
 
 		moduleFailedToLoad = true;