From a64c0834374825da9f52ba526e399ec3b652977f Mon Sep 17 00:00:00 2001
From: Robin Gareus <robin@gareus.org>
Date: Fri, 2 Dec 2011 02:24:28 +0100
Subject: [PATCH 1/6] OSX fixes: explicit typecasts and glib includes

* replace all <glib/FILENAME.h> includes with <glib.h> for glib-2.31.2
  #error "Only <glib.h> can be included directly."

* work around "looses precision" and implicit typecast errors:
	  size_t/SInt32 for OSX and void*/int for 32/64bit
---
 gtk2_ardour/engine_dialog.cc                 |   12 ++++++------
 libs/appleutility/CAComponent.cpp            |    4 ++--
 libs/appleutility/CAComponentDescription.cpp |    2 +-
 libs/ardour/ardour/graph.h                   |    2 +-
 libs/ardour/coreaudiosource.cc               |    6 +++---
 libs/ardour/globals.cc                       |    2 +-
 libs/ardour/operations.cc                    |    2 +-
 libs/clearlooks-newer/animation.c            |    2 +-
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc
index 46098c5..1a10476 100644
--- a/gtk2_ardour/engine_dialog.cc
+++ b/gtk2_ardour/engine_dialog.cc
@@ -743,14 +743,14 @@ EngineControl::enumerate_coreaudio_devices ()
 	backend_devs.clear ();
 
 	err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices,
-					   &outSize, &isWritable);
+					   (UInt32*) &outSize, &isWritable);
 	if (err == noErr) {
 		// Calculate the number of device available...
 		int numCoreDevices = outSize / sizeof(AudioDeviceID);
 		// Make space for the devices we are about to get...
 		AudioDeviceID *coreDeviceIDs = new AudioDeviceID [numCoreDevices];
 		err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices,
-					       &outSize, (void *) coreDeviceIDs);
+					       (UInt32*) &outSize, (void *) coreDeviceIDs);
 		if (err == noErr) {
 			// Look for the CoreAudio device name...
 			char coreDeviceName[256];
@@ -764,7 +764,7 @@ EngineControl::enumerate_coreaudio_devices ()
 
 				err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
 								 0, true, kAudioDevicePropertyStreams,
-								 &outSize, &isWritable);
+								 (UInt32*) &outSize, &isWritable);
 
 				if (err != noErr || outSize == 0) {
 					continue;
@@ -772,7 +772,7 @@ EngineControl::enumerate_coreaudio_devices ()
 
 				err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
 								 0, false, kAudioDevicePropertyStreams,
-								 &outSize, &isWritable);
+								 (UInt32*) &outSize, &isWritable);
 
 				if (err != noErr || outSize == 0) {
 					continue;
@@ -780,11 +780,11 @@ EngineControl::enumerate_coreaudio_devices ()
 
 				err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
 								 0, true, kAudioDevicePropertyDeviceName,
-								 &outSize, &isWritable);
+								 (UInt32*) &outSize, &isWritable);
 				if (err == noErr) {
 					err = AudioDeviceGetProperty(coreDeviceIDs[i],
 								     0, true, kAudioDevicePropertyDeviceName,
-								     &nameSize, (void *) coreDeviceName);
+								     (UInt32*) &nameSize, (void *) coreDeviceName);
 					if (err == noErr) {
 						char drivername[128];
 
diff --git a/libs/appleutility/CAComponent.cpp b/libs/appleutility/CAComponent.cpp
index 700d9e2..9df4ce1 100644
--- a/libs/appleutility/CAComponent.cpp
+++ b/libs/appleutility/CAComponent.cpp
@@ -96,7 +96,7 @@ OSStatus		CAComponent::GetResourceVersion (UInt32 &outVersion) const
 	short thngResourceCount;
 	
 	short curRes = CurResFile();
-	require_noerr (result = OpenAComponentResFile( mComp, &componentResFileID), home);
+	require_noerr (result = OpenAComponentResFile( mComp, (ResFileRefNum*) &componentResFileID), home);
 	require_noerr (result = componentResFileID <= 0, home);
 	
 	UseResFile(componentResFileID);
@@ -247,7 +247,7 @@ void	_ShowCF (FILE* file, CFStringRef str)
 
 void	CAComponent::Print(FILE* file) const
 {
-	fprintf (file, "CAComponent: 0x%X", int(Comp()));
+	fprintf (file, "CAComponent: 0x%X", (int64_t) Comp());
 	if (mManuName) {
 		fprintf (file, ", Manu:"); _ShowCF (file, mManuName);
 		if (mAUName) fprintf (file, ", Name:"); _ShowCF (file, mAUName);
diff --git a/libs/appleutility/CAComponentDescription.cpp b/libs/appleutility/CAComponentDescription.cpp
index 261a2b8..35aa350 100644
--- a/libs/appleutility/CAComponentDescription.cpp
+++ b/libs/appleutility/CAComponentDescription.cpp
@@ -74,7 +74,7 @@ void 	CAComponentDescription::_CAShowComponentDescription(const ComponentDescrip
 		fprintf (file, "ComponentDescription: %s - ", StringForOSType(desc->componentType, str));
 		fprintf (file, "%s - ", StringForOSType(desc->componentSubType, str));
 		fprintf (file, "%s", StringForOSType(desc->componentManufacturer, str));		
-		fprintf (file, ", 0x%lX, 0x%lX\n", desc->componentFlags, desc->componentFlagsMask);
+		fprintf (file, ", 0x%lX, 0x%lX\n", (long unsigned int) desc->componentFlags, (long unsigned int) desc->componentFlagsMask);
 	}
 }
 
diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h
index f1ebba6..0079024 100644
--- a/libs/ardour/ardour/graph.h
+++ b/libs/ardour/ardour/graph.h
@@ -28,7 +28,7 @@
 
 #include <boost/shared_ptr.hpp>
 
-#include <glib/gatomic.h>
+#include <glib.h>
 #include <cassert>
 
 #include <pthread.h>
diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc
index ef99b9a..3b0323d 100644
--- a/libs/ardour/coreaudiosource.cc
+++ b/libs/ardour/coreaudiosource.cc
@@ -239,7 +239,7 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string&)
 	AudioStreamBasicDescription absd;
 	memset(&absd, 0, sizeof(absd));
 	size = sizeof(AudioStreamBasicDescription);
-	if (ExtAudioFileGetProperty (af, kExtAudioFileProperty_FileDataFormat, &size, &absd) != noErr) {
+	if (ExtAudioFileGetProperty (af, kExtAudioFileProperty_FileDataFormat, (UInt32*) &size, &absd) != noErr) {
 		goto out;
 	}
 
@@ -247,12 +247,12 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string&)
 	_info.channels   = absd.mChannelsPerFrame;
 
 	size = sizeof(_info.length);
-	if (ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &size, &_info.length) != noErr) {
+	if (ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, (UInt32*) &size, &_info.length) != noErr) {
 		goto out;
 	}
 
 	size = sizeof(CFStringRef);
-	if (AudioFormatGetProperty(kAudioFormatProperty_FormatName, sizeof(absd), &absd, &size, &name) != noErr) {
+	if (AudioFormatGetProperty(kAudioFormatProperty_FormatName, sizeof(absd), &absd, (UInt32*) &size, &name) != noErr) {
 		goto out;
 	}
 
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 5a2a2ad..ccc74fc 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -177,7 +177,7 @@ setup_hardware_optimization (bool try_optimization)
 #elif defined (__APPLE__) && defined (BUILD_VECLIB_OPTIMIZATIONS)
 		long sysVersion = 0;
 
-		if (noErr != Gestalt(gestaltSystemVersion, &sysVersion))
+		if (noErr != Gestalt(gestaltSystemVersion, (SInt32*) &sysVersion))
 			sysVersion = 0;
 
 		if (sysVersion >= 0x00001040) { // Tiger at least
diff --git a/libs/ardour/operations.cc b/libs/ardour/operations.cc
index 84da0f5..3cdd936 100644
--- a/libs/ardour/operations.cc
+++ b/libs/ardour/operations.cc
@@ -17,7 +17,7 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <glib/gquark.h>
+#include <glib.h>
 #include "ardour/operations.h"
 #include "i18n.h"
 
diff --git a/libs/clearlooks-newer/animation.c b/libs/clearlooks-newer/animation.c
index e6ac9fa..24766aa 100644
--- a/libs/clearlooks-newer/animation.c
+++ b/libs/clearlooks-newer/animation.c
@@ -27,7 +27,7 @@
 #include "animation.h"
 
 #ifdef HAVE_ANIMATION
-#include <glib/gtimer.h>
+#include <glib.h>
 
 struct _AnimationInfo {
 	GTimer *timer;
-- 
1.6.5.2

