From 239693cbb2e5f09448d2a9c6c700613a654ca043 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 13 Sep 2014 17:52:12 +0200
Subject: Haiku and gcc2 fixes.


diff --git a/mpc2sv8/CMakeLists.txt b/mpc2sv8/CMakeLists.txt
index eea0df0..694a391 100755
--- a/mpc2sv8/CMakeLists.txt
+++ b/mpc2sv8/CMakeLists.txt
@@ -24,10 +24,6 @@ if(WIN32)
 target_link_libraries(mpc2sv8 winmm)
 endif(WIN32)
 
-if(NOT MSVC)
-target_link_libraries(mpc2sv8 m)
-endif(NOT MSVC)
-
 if(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
 target_link_libraries(mpc2sv8 ossaudio)
 endif(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
diff --git a/mpcchap/CMakeLists.txt b/mpcchap/CMakeLists.txt
index 743d5b6..7b379d5 100755
--- a/mpcchap/CMakeLists.txt
+++ b/mpcchap/CMakeLists.txt
@@ -23,8 +23,4 @@ endif(SHARED)
 target_link_libraries(mpcchap mpcenc_static)
 target_link_libraries(mpcchap ${CUEFILE_LIBRARY})
 
-if(NOT MSVC)
-target_link_libraries(mpcchap m)
-endif(NOT MSVC)
-
 install(TARGETS mpcchap RUNTIME DESTINATION bin)
diff --git a/mpccut/CMakeLists.txt b/mpccut/CMakeLists.txt
index 7d15ce2..1c35147 100755
--- a/mpccut/CMakeLists.txt
+++ b/mpccut/CMakeLists.txt
@@ -20,8 +20,4 @@ endif(SHARED)
 
 target_link_libraries(mpccut mpcenc_static)
 
-if(NOT MSVC)
-target_link_libraries(mpccut m)
-endif(NOT MSVC)
-
 install(TARGETS mpccut RUNTIME DESTINATION bin)
diff --git a/mpcdec/CMakeLists.txt b/mpcdec/CMakeLists.txt
index da3123f..404711c 100755
--- a/mpcdec/CMakeLists.txt
+++ b/mpcdec/CMakeLists.txt
@@ -12,10 +12,6 @@ endif(MSVC)
 
 add_executable(mpcdec_cmd mpcdec.c)
 
-if(NOT MSVC)
-target_link_libraries(mpcdec_cmd m)
-endif(NOT MSVC)
-
 target_link_libraries(mpcdec_cmd wavformat_static)
 
 if(SHARED)
diff --git a/mpcenc/CMakeLists.txt b/mpcenc/CMakeLists.txt
index f16824a..d3321b8 100755
--- a/mpcenc/CMakeLists.txt
+++ b/mpcenc/CMakeLists.txt
@@ -18,10 +18,6 @@ if(WIN32)
 target_link_libraries(mpcenc winmm)
 endif(WIN32)
 
-if(NOT MSVC)
-target_link_libraries(mpcenc m)
-endif(NOT MSVC)
-
 if(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
 target_link_libraries(mpcenc ossaudio)
 endif(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
diff --git a/mpcenc/keyboard.c b/mpcenc/keyboard.c
index 6522b97..a8c81b1 100755
--- a/mpcenc/keyboard.c
+++ b/mpcenc/keyboard.c
@@ -17,6 +17,7 @@
  */
 
 #include "mpcenc.h"
+#include <sys/time.h>
 
 #if defined _WIN32  ||  defined __TURBOC__
 
diff --git a/mpcgain/CMakeLists.txt b/mpcgain/CMakeLists.txt
index 5445faf..1c125de 100755
--- a/mpcgain/CMakeLists.txt
+++ b/mpcgain/CMakeLists.txt
@@ -25,8 +25,4 @@ else(SHARED)
   target_link_libraries(mpcgain mpcdec_static)
 endif(SHARED)
 
-if(NOT MSVC)
-target_link_libraries(mpcgain m)
-endif(NOT MSVC)
-
 install(TARGETS mpcgain RUNTIME DESTINATION bin)
diff --git a/mpcgain/mpcgain.c b/mpcgain/mpcgain.c
index d367fff..eb804f1 100755
--- a/mpcgain/mpcgain.c
+++ b/mpcgain/mpcgain.c
@@ -77,8 +77,8 @@ static mpc_inline MPC_SAMPLE_FORMAT max_abs(MPC_SAMPLE_FORMAT a, MPC_SAMPLE_FORM
 
 static MPC_SAMPLE_FORMAT analyze_get_max(MPC_SAMPLE_FORMAT * sample_buffer, int sample_nb)
 {
-	Float_t left_samples[MPC_FRAME_LENGTH * sizeof(Float_t)];
-	Float_t right_samples[MPC_FRAME_LENGTH * sizeof(Float_t)];
+	float_t left_samples[MPC_FRAME_LENGTH * sizeof(float_t)];
+	float_t right_samples[MPC_FRAME_LENGTH * sizeof(float_t)];
 	MPC_SAMPLE_FORMAT max = 0;
 	int i;
 
diff --git a/wavcmp/wavcmp.c b/wavcmp/wavcmp.c
index 702a352..f4b61b6 100755
--- a/wavcmp/wavcmp.c
+++ b/wavcmp/wavcmp.c
@@ -45,6 +45,7 @@ main(int argc, char **argv)
 	int is_wav_output;
 	int err;
 	int total_samples, total_diff;
+	t_wav_input_file_callback wavi_fc;
 
 	if(4 < argc && argc < 3)
 	{
@@ -52,7 +53,6 @@ main(int argc, char **argv)
 		return 0;
 	}
 
-	t_wav_input_file_callback wavi_fc;
 	memset(&wav_in_1, 0, sizeof wav_in_1);
 	wavi_fc.m_read      = wav_read;
 	wavi_fc.m_user_data = fopen(argv[1], "rb");
@@ -102,6 +102,7 @@ main(int argc, char **argv)
 	{
 		short sample_buff[2][512];
 		unsigned int samples[2];
+		int i = 0;
 
 		samples[0] = waveformat_input_process_int16(& wav_in_1, sample_buff[0], 512);
 		samples[1] = waveformat_input_process_int16(& wav_in_2, sample_buff[1], 512);
@@ -109,7 +110,6 @@ main(int argc, char **argv)
 		if (samples[0] != samples[1] || samples[0] == 0)
 			break;
 
-		int i = 0;
 		for( ; i < samples[0]; i++) {
 			sample_buff[0][i] -= sample_buff[1][i];
 			if (sample_buff[0][i]) {
-- 
1.8.3.4

