Index: /libmpc/trunk/mpcdec/mpcdec.c
===================================================================
--- /libmpc/trunk/mpcdec/mpcdec.c	(revision 322)
+++ /libmpc/trunk/mpcdec/mpcdec.c	(revision 323)
@@ -73,8 +73,8 @@
 	printf("length: %d:%.2d (%u samples)\n", minutes, seconds, (mpc_uint32_t)mpc_streaminfo_get_length_samples(info));
 	printf("file size: %d Bytes\n", info->total_file_length);
-	printf("track peak: %2.2f dB\n", info->peak_title / 256.);
-	printf("track gain: %2.2f dB / %2.2f dB\n", info->gain_title / 256., info->gain_title == 0 ? 0 : 65. - info->gain_title / 256.);
-	printf("album peak: %2.2f dB\n", info->peak_album / 256.);
-	printf("album gain: %2.2f dB / %2.2f dB\n", info->gain_album / 256., info->gain_album == 0 ? 0 : 65. - info->gain_album / 256.);
+	printf("track peak: %2.2f dB\n", info->peak_title / 256.f);
+	printf("track gain: %2.2f dB / %2.2f dB\n", info->gain_title / 256.f, info->gain_title == 0 ? 0 : 64.82f - info->gain_title / 256.f);
+	printf("album peak: %2.2f dB\n", info->peak_album / 256.f);
+	printf("album gain: %2.2f dB / %2.2f dB\n", info->gain_album / 256.f, info->gain_album == 0 ? 0 : 64.82f - info->gain_album / 256.f);
 	printf("\n");
 
Index: /libmpc/trunk/mpcenc/mpcenc.c
===================================================================
--- /libmpc/trunk/mpcenc/mpcenc.c	(revision 322)
+++ /libmpc/trunk/mpcenc/mpcenc.c	(revision 323)
@@ -1733,13 +1733,14 @@
         memmove ( Main.S, Main.S + BLOCK, CENTER * sizeof(float) );
 
+        // adapt SamplesInWAV to the real number of contained samples
+		if ( myfeof (Wave.fp) ) {
+			stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
+							(long double)(SamplesInWAVE) / m.SampleFreq, (long double)(AllSamplesRead) / m.SampleFreq);
+			break;
+		}
+
         // read samples
         CurrentRead     = Read_WAV_Samples ( &Wave, (int)minf(BLOCK, SamplesInWAVE - AllSamplesRead), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
         AllSamplesRead += CurrentRead;
-
-        // adapt SamplesInWAV to the real number of contained samples
-        if ( myfeof (Wave.fp) ) {
-			stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
-							(long double)(SamplesInWAVE) / m.SampleFreq, (long double)(AllSamplesRead) / m.SampleFreq);
-        }
     }
 
