Skip to contentSkip to conversation

Fixes compile problems on Mac OS 10.4 and under.

PATCH In review G 3 2 participants 2 messages Sep 18, 2009 – Dec 6, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

G 3

author
#1 lore raw

PATCH 1/1 Fixes compile problems on Mac OS 10.4 and under.

This patch eliminates all the warnings and errors that appear when compiling cocoa.m on Mac OS 10.4 and under.

---
 cocoa.m |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
cocoa.m +9 -1
index 55ff2b4..cb75e3e 100644
@@ -23,11 +23,17 @@
  */
 
 #import <Cocoa/Cocoa.h>
-
 #include "qemu-common.h"
 #include "console.h"
 #include "sysemu.h"
 
+#ifndef MAC_OS_X_VERSION_10_4
+#define MAC_OS_X_VERSION_10_4 1040
+#endif
+
+#ifndef __LITTLE_ENDIAN__
+#define __LITTLE_ENDIAN__ 0  /* assume PowerPC*/
+#endif
 
 //#define DEBUG
 
@@ -55,6 +61,8 @@ typedef struct {
 } QEMUScreen;
 
 int qemu_main(int argc, char **argv); // main defined in qemu/vl.c
+int cocoa_keycode_to_qemu(int keycode);
+
 NSWindow *normalWindow;
 id cocoaView;
 static DisplayChangeListener *dcl;
@@ -421,7 +429,7 @@ int cocoa_keycode_to_qemu(int keycode)
         [self ungrabMouse];
         [self setContentDimensions];
 // test if host support "enterFullScreenMode:withOptions" at  

compiletime
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
if ([NSView respondsToSelector:@selector
(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime

             [self exitFullScreenModeWithOptions:nil];
         } else {
@@ -430,7 +438,7 @@ int cocoa_keycode_to_qemu(int keycode)
             [normalWindow setContentView: self];
             [normalWindow makeKeyAndOrderFront: self];
             [NSMenu setMenuBarVisible:YES];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
         }
 #endif
     } else { // switch from desktop to fullscreen
@@ -438,7 +446,7 @@ int cocoa_keycode_to_qemu(int keycode)
         [self grabMouse];
         [self setContentDimensions];

// test if host support "enterFullScreenMode:withOptions" at
compiletime
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
if ([NSView respondsToSelector:@selector
(enterFullScreenMode:withOptions:)]) { // test if "enterFullScreenMode:withOptions" is supported on host at runtime
[self enterFullScreenMode:[NSScreen mainScreen]
withOptions:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO],
NSFullScreenModeAllScreens,
@@ -454,7 +462,7 @@ int cocoa_keycode_to_qemu(int keycode)

             [fullScreenWindow setHasShadow:NO];
             [fullScreenWindow setContentView:self];
             [fullScreenWindow makeKeyAndOrderFront:self];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
         }
 #endif
     }
@@ -783,11 +791,10 @@ int cocoa_keycode_to_qemu(int keycode)
     if(returnCode == NSCancelButton) {
         exit(0);
     } else if(returnCode == NSOKButton) {

- char *bin = "qemu";
- char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
-
+ char bin[5] = "qemu";

+        char *img = (char*)[ [ sheet filename ] cString];
         char **argv = (char**)malloc( sizeof(char*)*3 );
-
+		[sheet close];
         asprintf(&argv[0], "%s", bin);
         asprintf(&argv[1], "-hda");
         asprintf(&argv[2], "%s", img);
Signature · 1 line
1.6.4.2
#2 lore raw

Am 18.09.2009 um 18:18 schrieb G 3:

Quoted 13 lines

This patch eliminates all the warnings and errors that appear when compiling cocoa.m on Mac OS 10.4 and under.

---
cocoa.m | 25 ++++++++++++++++---------

1 files changed, 16 insertions(+), 9 deletions(-)
cocoa.m +0 -0
index 55ff2b4..cb75e3e 100644
@@ -23,11 +23,17 @@
 */

cocoa.m line 32

Quoted 10 lines
cocoa.m +3 -1
 
 #import <Cocoa/Cocoa.h>
-
 #include "qemu-common.h"
 #include "console.h"
 #include "sysemu.h"
 
+#ifndef MAC_OS_X_VERSION_10_4
+#define MAC_OS_X_VERSION_10_4 1040
+#endif

I've picked this part up...

Quoted 10 lines
cocoa.m +1 -1
@@ -421,7 +429,7 @@ int cocoa_keycode_to_qemu(int keycode)
        [self ungrabMouse];
        [self setContentDimensions];
 // test if host support "enterFullScreenMode:withOptions" at compiletime
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
        if ([NSView  

respondsToSelector:@selector(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime

            [self exitFullScreenModeWithOptions:nil];
        } else {

... but why do you do these changes? On v10.4 respondsToSelector: should simply return NO at runtime and not call the method. Are there warnings?

Andreas