File mp3gain-1.6.1-fix_warnings.patch of Package mp3gain

From: Thomas Orgis <thomas.orgis@gmx.de>
Date: 2018-01-04 13:48:11 +0100

------------------------------------------------------------------------
r4 | thomas | 2018-02-04 10:54:33 +0100 (dom 04 de feb de 2018) | 1 línea

include ctype.h for toupper()

Index: mp3gain.c
===================================================================
--- mp3gain.c	(revisión: 3)
+++ mp3gain.c	(revisión: 4)
@@ -82,6 +82,7 @@
 
 #include <fcntl.h>
 #include <string.h>
+#include <ctype.h>
 
 #ifndef asWIN32DLL
 

------------------------------------------------------------------------
r5 | thomas | 2018-02-04 10:55:32 +0100 (dom 04 de feb de 2018) | 1 línea

silence gcc warning about possibly uninitialized nprocsamp

Index: mp3gain.c
===================================================================
--- mp3gain.c	(revisión: 4)
+++ mp3gain.c	(revisión: 5)
@@ -1473,7 +1473,7 @@
 	double dblGainChange;
 	int intGainChange = 0;
 	int intAlbumGainChange = 0;
-	int nprocsamp;
+	int nprocsamp = 0;
 	int first = 1;
 	int mainloop;
 	Float_t maxsample;

------------------------------------------------------------------------
r6 | thomas | 2018-02-04 13:19:20 +0100 (dom 04 de feb de 2018) | 4 líneas

Remove floating point math for computing static array sizes.

Current GCC complains about that, rightly so.


Index: gain_analysis.c
===================================================================
--- gain_analysis.c	(revisión: 5)
+++ gain_analysis.c	(revisión: 6)
@@ -105,13 +105,13 @@
 #define YULE_FILTER     filterYule
 #define BUTTER_FILTER   filterButter
 #define RMS_PERCENTILE      0.95        // percentile which is louder than the proposed level
-#define MAX_SAMP_FREQ   96000.          // maximum allowed sample frequency [Hz]
-#define RMS_WINDOW_TIME     0.050       // Time slice size [s]
-#define STEPS_per_dB      100.          // Table entries per dB
-#define MAX_dB            120.          // Table entries for 0...MAX_dB (normal max. values are 70...80 dB)
+#define MAX_SAMP_FREQ_KHZ  96           // maximum allowed sample frequency [kHz]
+#define RMS_WINDOW_TIME_MS 50           // Time slice size [ms]
+#define STEPS_per_dB      100           // Table entries per dB
+#define MAX_dB            120           // Table entries for 0...MAX_dB (normal max. values are 70...80 dB)
 
 #define MAX_ORDER               (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER)
-#define MAX_SAMPLES_PER_WINDOW  (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 1)      // max. Samples per Time slice
+#define MAX_SAMPLES_PER_WINDOW  (size_t) (MAX_SAMP_FREQ_KHZ * RMS_WINDOW_TIME_MS + 1)      // max. Samples per Time slice
 #define PINK_REF                64.82 //298640883795                              // calibration value
 
 Float_t          linprebuf [MAX_ORDER * 2];
@@ -261,7 +261,7 @@
         default:    return INIT_GAIN_ANALYSIS_ERROR;
     }
 
-    sampleWindow = (int) ceil (samplefreq * RMS_WINDOW_TIME);
+    sampleWindow = (int) ceil (samplefreq * RMS_WINDOW_TIME_MS / 1000.);
 
     lsum         = 0.;
     rsum         = 0.;

------------------------------------------------------------------------