game-music-emu: Merged in warnings0 (pull request #56)

From 588cbf3f8a0668f66ba2bc1fbdc9841aad4c84fe Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 6 Oct 2023 14:50:50 +0300
Subject: [PATCH 1/2] minor warning fixes.

---
 gme/Hes_Cpu.cpp     | 16 ++++++++--------
 gme/Nes_Fds_Apu.h   |  3 +++
 gme/blargg_common.h | 10 ----------
 gme/ext/emu2413.c   |  8 +++++---
 4 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/gme/Hes_Cpu.cpp b/gme/Hes_Cpu.cpp
index 0c58084..98af83a 100644
--- a/gme/Hes_Cpu.cpp
+++ b/gme/Hes_Cpu.cpp
@@ -37,14 +37,14 @@ int const ram_addr = 0x2000;
 #endif
 
 // status flags
-BLARGG_MAYBE_UNUSED int const st_n = 0x80;
-BLARGG_MAYBE_UNUSED int const st_v = 0x40;
-BLARGG_MAYBE_UNUSED int const st_t = 0x20;
-BLARGG_MAYBE_UNUSED int const st_b = 0x10;
-BLARGG_MAYBE_UNUSED int const st_d = 0x08;
-BLARGG_MAYBE_UNUSED int const st_i = 0x04;
-BLARGG_MAYBE_UNUSED int const st_z = 0x02;
-BLARGG_MAYBE_UNUSED int const st_c = 0x01;
+int const st_n = 0x80;
+int const st_v = 0x40;
+/* int const st_t = 0x20; */
+int const st_b = 0x10;
+int const st_d = 0x08;
+int const st_i = 0x04;
+int const st_z = 0x02;
+int const st_c = 0x01;
 
 void Hes_Cpu::reset()
 {
diff --git a/gme/Nes_Fds_Apu.h b/gme/Nes_Fds_Apu.h
index 0dc7cc7..2b629f7 100644
--- a/gme/Nes_Fds_Apu.h
+++ b/gme/Nes_Fds_Apu.h
@@ -76,6 +76,9 @@ inline void Nes_Fds_Apu::volume( double v )
 
 inline void Nes_Fds_Apu::osc_output( int i, Blip_Buffer* buf )
 {
+#ifdef NDEBUG
+	(void) i;
+#endif
 	assert( (unsigned) i < osc_count );
 	output_ = buf;
 }
diff --git a/gme/blargg_common.h b/gme/blargg_common.h
index d1877d7..c8710f9 100644
--- a/gme/blargg_common.h
+++ b/gme/blargg_common.h
@@ -109,16 +109,6 @@ class blargg_vector {
 	const bool false = 0;
 #endif
 
-#if defined(__has_cpp_attribute)
-# if __has_cpp_attribute(maybe_unused)
-#  define BLARGG_MAYBE_UNUSED [[maybe_unused]]
-# endif
-#endif
-
-#ifndef BLARGG_MAYBE_UNUSED
-# define BLARGG_MAYBE_UNUSED
-#endif
-
 // blargg_long/blargg_ulong = at least 32 bits, int if it's big enough
 
 #if INT_MAX < 0x7FFFFFFF || LONG_MAX == 0x7FFFFFFF
diff --git a/gme/ext/emu2413.c b/gme/ext/emu2413.c
index 701dbde..92785d2 100644
--- a/gme/ext/emu2413.c
+++ b/gme/ext/emu2413.c
@@ -167,7 +167,7 @@ static unsigned char default_inst[OPLL_TONE_NUM][(16 + 3) * 8] = {
 #define EXPAND_BITS_X(x,s,d) (((x)<<((d)-(s)))|((1<<((d)-(s)))-1))
 
 /* Adjust envelope speed which depends on sampling rate. */
-#define RATE_ADJUST(x) (rate==49716?x:(e_uint32)((double)(x)*clk/72/rate + 0.5))        /* added 0.5 to round the value*/
+#define RATE_ADJUST(x) (rate==49716?(x):(e_uint32)((double)(x)*clk/72/rate + 0.5))      /* added 0.5 to round the value*/
 
 #define MOD(o,x) (&(o)->slot[(x)<<1])
 #define CAR(o,x) (&(o)->slot[((x)<<1)|1])
@@ -422,7 +422,8 @@ static double decaytime[16][4] = {
 static void
 makeDphaseARTable (void)
 {
-  e_int32 AR, Rks, RM, RL;
+  e_int32 AR, Rks, RM;
+  e_uint32 RL;
 
 #ifdef USE_SPEC_ENV_SPEED
   e_uint32 attacktable[16][4];
@@ -470,7 +471,8 @@ makeDphaseARTable (void)
 static void
 makeDphaseDRTable (void)
 {
-  e_int32 DR, Rks, RM, RL;
+  e_int32 DR, Rks, RM;
+  e_uint32 RL;
 
 #ifdef USE_SPEC_ENV_SPEED
   e_uint32 decaytable[16][4];

From 8bcf09f2a74a3236033a8d304d2022fcfd4ae09d Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <sezeroz@gmail.com>
Date: Fri, 6 Oct 2023 14:55:10 +0300
Subject: [PATCH 2/2] spc_emu: remove unnecessary c++20 designated initializers
 from rsn code

may lead to warnings in c++11 mode.
---
 gme/Spc_Emu.cpp | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/gme/Spc_Emu.cpp b/gme/Spc_Emu.cpp
index 9f9d0a6..e7e60cf 100644
--- a/gme/Spc_Emu.cpp
+++ b/gme/Spc_Emu.cpp
@@ -300,11 +300,11 @@ extern gme_type_t const gme_spc_type = &gme_spc_type_;
 #ifdef RARDLL
 static int CALLBACK call_rsn(UINT msg, LPARAM UserData, LPARAM P1, LPARAM P2)
 {
-	(void) msg;
 	byte **bp = (byte **)UserData;
 	unsigned char *addr = (unsigned char *)P1;
 	memcpy( *bp, addr, P2 );
 	*bp += P2;
+	(void) msg;
 	return 0;
 }
 #endif
@@ -318,17 +318,14 @@ struct Rsn_File : Spc_File
 	blargg_err_t load_archive( const char* path )
 	{
 	#ifdef RARDLL
-		struct RAROpenArchiveData data = {
-			.ArcName = (char *)path,
-			.OpenMode = RAR_OM_LIST, .OpenResult = 0,
-			.CmtBuf = 0, .CmtBufSize = 0, .CmtSize = 0, .CmtState = 0
-		};
+		struct RAROpenArchiveData data = { NULL, RAR_OM_LIST, 0, NULL, 0, 0, 0 };
 
 		// get the size of all unpacked headers combined
 		long pos = 0;
 		int count = 0;
 		unsigned biggest = 0;
 		blargg_vector<byte> temp;
+		data.ArcName = (char *)path;
 		HANDLE rar = RAROpenArchive( &data );
 		struct RARHeaderData head;
 		for ( ; RARReadHeader( rar, &head ) == ERAR_SUCCESS; count++ )
@@ -518,15 +515,12 @@ blargg_err_t Spc_Emu::play_( long count, sample_t* out )
 blargg_err_t Rsn_Emu::load_archive( const char* path )
 {
 #ifdef RARDLL
-	struct RAROpenArchiveData data = {
-		.ArcName = (char *)path,
-		.OpenMode = RAR_OM_LIST, .OpenResult = 0,
-		.CmtBuf = 0, .CmtBufSize = 0, .CmtSize = 0, .CmtState = 0
-	};
+	struct RAROpenArchiveData data = { NULL, RAR_OM_LIST, 0, NULL, 0, 0, 0 };
 
 	// get the file count and unpacked size
 	long pos = 0;
 	int count = 0;
+	data.ArcName = (char *)path;
 	HANDLE rar = RAROpenArchive( &data );
 	struct RARHeaderData head;
 	for ( ; RARReadHeader( rar, &head ) == ERAR_SUCCESS; count++ )