From patchwork Fri Sep 18 16:18:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 33861 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8033CB7B77 for ; Sat, 19 Sep 2009 02:19:54 +1000 (EST) Received: from localhost ([127.0.0.1]:58466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MogBb-0000ql-TN for incoming@patchwork.ozlabs.org; Fri, 18 Sep 2009 12:19:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MogAy-0000oa-Er for qemu-devel@nongnu.org; Fri, 18 Sep 2009 12:19:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MogAq-0000hN-Qq for qemu-devel@nongnu.org; Fri, 18 Sep 2009 12:19:08 -0400 Received: from [199.232.76.173] (port=43986 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MogAq-0000hK-6a for qemu-devel@nongnu.org; Fri, 18 Sep 2009 12:19:04 -0400 Received: from mail-qy0-f197.google.com ([209.85.221.197]:56101) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MogAp-000374-SY for qemu-devel@nongnu.org; Fri, 18 Sep 2009 12:19:04 -0400 Received: by qyk35 with SMTP id 35so757802qyk.19 for ; Fri, 18 Sep 2009 09:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:mime-version:in-reply-to :references:content-type:message-id:content-transfer-encoding:from :subject:date:to:x-mailer; bh=cnAqqk7LITGCl7I0x3kXCesr4Odr9DucqMQgRvp5KKA=; b=v7RLfHf6UfjRGnBLwn2yLri8sMSv8GkNEe/NmHvSx2ZwSojTCXY9y87ot3YCDVI42c D8moCHkm7ycgb4obbIS9IE1to32rZDNxJBtLWQaBg4gi2SPq2/KS5QtgohUzF4GRxs3v WXRETYc61nvx+uUma+uQ1WMa5RW1TkpDGQXV0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:content-type:message-id :content-transfer-encoding:from:subject:date:to:x-mailer; b=biZvgefVBWez0ZFdAMjnZTYnTRV54AseQRSdsTVroDKhdNey+5cnH3V2JEavYuoT0S uei1eyrllUTrpzogjXDviruEncUgIKeI37blSF4i3zviJFBQTpy7f6uAMPZZrO2wGaNF 9RUNw6bxGOQMcxnx4qI4U15D1hz5hKtxAJkuI= Received: by 10.224.22.212 with SMTP id o20mr1534242qab.164.1253290712670; Fri, 18 Sep 2009 09:18:32 -0700 (PDT) Received: from ?192.168.0.3? (adsl-76-226-84-60.dsl.sfldmi.sbcglobal.net [76.226.84.60]) by mx.google.com with ESMTPS id 23sm489567qyk.11.2009.09.18.09.18.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 18 Sep 2009 09:18:31 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v753.1) In-Reply-To: <4ab3b028.a153f10a.20ec.ffff9551SMTPIN_ADDED@mx.google.com> References: <4ab3b028.a153f10a.20ec.ffff9551SMTPIN_ADDED@mx.google.com> Message-Id: <56828424-D6AF-4289-97D9-A5B7643871A4@gmail.com> From: G 3 Date: Fri, 18 Sep 2009 12:18:22 -0400 To: qemu-devel@nongnu.org X-Mailer: Apple Mail (2.753.1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH] Fixes compile problems on Mac OS 10.4 and under. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch eliminates all the warnings and errors that appear when compiling cocoa.m on Mac OS 10.4 and under. Signed-off-by: John Arbuckle --- cocoa.m | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) "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); diff --git a/cocoa.m b/cocoa.m index 55ff2b4..cb75e3e 100644 --- a/cocoa.m +++ b/cocoa.m @@ -23,11 +23,17 @@ */ #import - #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