SDL_mixer: external libs, libmodplug: minor updates:

From 36a7a0323792da7ea205fe0f38df3047d475e300 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 19 Jun 2021 22:32:28 +0300
Subject: [PATCH] external libs, libmodplug: minor updates:

- snd_fx.c(GetLength): remove unused local var samples[]
- silence annoying watcom warnings
- remove a stale comment from sndfile.h
- use GNUInstallDirs in cmake.

will rebuild binaries later (more updates will follow..)
---
 external/libmodplug-0.8.9.0/CMakeLists.txt    | 19 ++++++++++++-------
 .../src/libmodplug/sndfile.h                  |  1 -
 external/libmodplug-0.8.9.0/src/snd_fx.cpp    |  3 +--
 external/libmodplug-0.8.9.0/src/sndmix.cpp    |  1 +
 external/libmodplug-0.8.9.0/src/tables.h      | 13 ++++++++-----
 5 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/external/libmodplug-0.8.9.0/CMakeLists.txt b/external/libmodplug-0.8.9.0/CMakeLists.txt
index 34099d8..7806eb3 100644
--- a/external/libmodplug-0.8.9.0/CMakeLists.txt
+++ b/external/libmodplug-0.8.9.0/CMakeLists.txt
@@ -159,7 +159,12 @@ if (BUILD_SHARED_LIBS)
 endif()
 
 # install the library:
-install(TARGETS modplug DESTINATION lib)
+include (GNUInstallDirs)
+install(TARGETS modplug
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
 
 # install the headers:
 install(FILES
@@ -167,18 +172,18 @@ install(FILES
   ${HEADERS_CXX}
 
   DESTINATION
-  include/libmodplug
+  ${CMAKE_INSTALL_INCLUDEDIR}/libmodplug
 )
 
 if (NOT WIN32)
-  set(prefix "${CMAKE_INSTALL_PREFIX}")
-  set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
-  set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
-  set(includedir "${CMAKE_INSTALL_PREFIX}/include")
+  set(prefix ${CMAKE_INSTALL_PREFIX})
+  set(exec_prefix ${CMAKE_INSTALL_PREFIX})
+  set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
+  set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
   configure_file(libmodplug.pc.in libmodplug.pc)
 
   # install pkg-config file:
   install(FILES "${PROJECT_BINARY_DIR}/libmodplug.pc"
-    DESTINATION lib/pkgconfig
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
   )
 endif (NOT WIN32)
diff --git a/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h b/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h
index a638d2d..0c2c5f7 100644
--- a/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h
+++ b/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h
@@ -644,7 +644,6 @@ class MODPLUG_EXPORTPP CSoundFile
 	BOOL TestMID(LPCBYTE lpStream, DWORD dwMemLength);
 	BOOL ReadPAT(LPCBYTE lpStream, DWORD dwMemLength);
 	BOOL TestPAT(LPCBYTE lpStream, DWORD dwMemLength);
-	// Save Functions
 	// MOD Convert function
 	void ConvertModCommand(MODCOMMAND *) const;
 	void S3MConvert(MODCOMMAND *m, BOOL bIT) const;
diff --git a/external/libmodplug-0.8.9.0/src/snd_fx.cpp b/external/libmodplug-0.8.9.0/src/snd_fx.cpp
index 845ecb3..7e0f682 100644
--- a/external/libmodplug-0.8.9.0/src/snd_fx.cpp
+++ b/external/libmodplug-0.8.9.0/src/snd_fx.cpp
@@ -7,6 +7,7 @@
 #include "stdafx.h"
 #include <stdlib.h>
 #include "sndfile.h"
+#define SNDFX_C
 #include "tables.h"
 
 #ifdef _MSC_VER
@@ -23,7 +24,6 @@ DWORD CSoundFile::GetLength(BOOL bAdjust, BOOL bTotal)
 	UINT nMusicSpeed=m_nDefaultSpeed, nMusicTempo=m_nDefaultTempo, nNextRow=0;
 	UINT nMaxRow = 0, nMaxPattern = 0, nNextStartRow = 0;
 	LONG nGlbVol = m_nDefaultGlobalVolume, nOldGlbVolSlide = 0;
-	BYTE samples[MAX_CHANNELS];
 	BYTE instr[MAX_CHANNELS];
 	BYTE notes[MAX_CHANNELS];
 	BYTE vols[MAX_CHANNELS];
@@ -37,7 +37,6 @@ DWORD CSoundFile::GetLength(BOOL bAdjust, BOOL bTotal)
 	memset(patloop, 0, sizeof(patloop));
 	memset(oldparam, 0, sizeof(oldparam));
 	memset(chnvols, 64, sizeof(chnvols));
-	memset(samples, 0, sizeof(samples));
 	for (UINT icv=0; icv<m_nChannels; icv++)
 		chnvols[icv] = ChnSettings[icv].nVolume;
 	nMaxRow = m_nNextRow;
diff --git a/external/libmodplug-0.8.9.0/src/sndmix.cpp b/external/libmodplug-0.8.9.0/src/sndmix.cpp
index 426f8ab..8f1d612 100644
--- a/external/libmodplug-0.8.9.0/src/sndmix.cpp
+++ b/external/libmodplug-0.8.9.0/src/sndmix.cpp
@@ -6,6 +6,7 @@
 
 #include "libmodplug/stdafx.h"
 #include "libmodplug/sndfile.h"
+#define SNDMIX_C
 #include "tables.h"
 
 // Volume ramp length, in 1/10 ms
diff --git a/external/libmodplug-0.8.9.0/src/tables.h b/external/libmodplug-0.8.9.0/src/tables.h
index c301788..a3f5339 100644
--- a/external/libmodplug-0.8.9.0/src/tables.h
+++ b/external/libmodplug-0.8.9.0/src/tables.h
@@ -10,6 +10,7 @@
 //#pragma data_seg(".tables")
 #endif
 
+#ifdef SNDFX_C
 static const BYTE ImpulseTrackerPortaVolCmd[16] =
 {
 	0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60,
@@ -61,8 +62,9 @@ static const WORD S3MFineTuneTable[16] =
 	7895,7941,7985,8046,8107,8169,8232,8280,
 	8363,8413,8463,8529,8581,8651,8723,8757,	// 8363*2^((i-8)/(12*8))
 };
+#endif
 
-
+#ifdef SNDMIX_C
 // Sinus table
 static const int16_t ModSinusTable[64] =
 {
@@ -98,8 +100,9 @@ static const int16_t ModRandomTable[64] =
 	-23,88,21,-94,8,106,21,-112,6,109,20,-88,-30,9,-127,118,
 	42,-34,89,-4,-51,-72,21,-29,112,123,84,-101,-92,98,-54,-95
 };
+#endif
 
-
+#ifdef SNDFX_C
 // volume fade tables for Retrig Note:
 static const int8_t retrigTable1[16] =
 { 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 };
@@ -107,8 +110,6 @@ static const int8_t retrigTable1[16] =
 static const int8_t retrigTable2[16] =
 { 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 };
 
-
-
 static const WORD XMPeriodTable[104] = 
 {
 	907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814,
@@ -220,7 +221,9 @@ static const uint32_t XMLinearTable[768] =
 	271508,271263,271018,270774,270530,270286,270042,269798,
 	269555,269312,269069,268826,268583,268341,268099,267857 
 };
+#endif
 
+#ifdef SNDMIX_C
 static const int8_t ft2VibratoTable[256] = 
 {
 	0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23,
@@ -240,7 +243,7 @@ static const int8_t ft2VibratoTable[256] =
 	48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27,
 	26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2 
 };
-
+#endif
 
 static const DWORD FineLinearSlideUpTable[16] =
 {