diff mbox

Minor fixes to OS X.

Message ID BLU0-SMTP174D7653CDE261B3B4C1C12B9D00@phx.gbl
State New
Headers show

Commit Message

C.W. Betts March 26, 2013, 10:18 p.m. UTC
This patch contains minor fixes for the Cocoa UI.


From c36f0f8e4602fe014a3a383d6bb181401e72e8fe Mon Sep 17 00:00:00 2001
From: "C.W. Betts" <computers57@hotmail.com>
Date: Sun, 24 Mar 2013 11:52:14 -0600
Subject: [PATCH 2/3] Minor Cocoa UI improvements. Use fileSystemRepresentation
 to get a file name from an NSString. Define NSInteger on pre-Leopard systems,
 and use it on -openPanelDidEnd:returnCode:contextInfo: so that it's
 consistant with the signature requested in 64-bit code.

---
 ui/cocoa.m | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Peter Maydell March 26, 2013, 10:28 p.m. UTC | #1
On 26 March 2013 22:18, C.W. Betts <computers57@hotmail.com> wrote:
> This patch contains minor fixes for the Cocoa UI.

(cc'ing Andreas as the Cocoa maintainer)

> From c36f0f8e4602fe014a3a383d6bb181401e72e8fe Mon Sep 17 00:00:00 2001
> From: "C.W. Betts" <computers57@hotmail.com>
> Date: Sun, 24 Mar 2013 11:52:14 -0600
> Subject: [PATCH 2/3] Minor Cocoa UI improvements. Use fileSystemRepresentation
>  to get a file name from an NSString. Define NSInteger on pre-Leopard systems,
>  and use it on -openPanelDidEnd:returnCode:contextInfo: so that it's
>  consistant with the signature requested in 64-bit code.

Thanks for this patch. A couple of things, really all stylistic;
the code changes themselves look good to me.

You need to include a Signed-off-by: line, or we can't accept
the patch; this is really important.

Also if you were able to tweak the format you're sending the patches
[so the patch Subject is in the email subject and the email body
starts immediately with the rest of the commit message] that would
be great. (http://wiki.qemu.org/Contribute/SubmitAPatch might help
but it's a bit vague about driving git I'm afraid.)

If you could split this up into two patches (one for NSInteger and one
for fileSystemRepresentation) that would be best.

Just as a heads-up there are a set of cocoa UI patches I submitted
that are currently on the list and awaiting review; these are going
to conflict with your patches because they change some of the
same lines.

-- PMM

>
> ---
>  ui/cocoa.m | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 048cc97..edd62be 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -68,6 +68,10 @@ static DisplayChangeListener *dcl;
>  int gArgc;
>  char **gArgv;
>
> +#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4)
> +typedef int NSInteger;
> +#endif
> +
>  // keymap conversion
>  int keymap[] =
>  {
> @@ -350,11 +354,7 @@ QemuCocoaView *cocoaView;
>          } else {
>              // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
>              const NSRect *rectList;
> -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
>              NSInteger rectCount;
> -#else
> -            int rectCount;
> -#endif
>              int i;
>              CGImageRef clipImageRef;
>              CGRect clipRect;
> @@ -712,7 +712,7 @@ QemuCocoaView *cocoaView;
>  {
>  }
>  - (void)startEmulationWithArgc:(int)argc argv:(char**)argv;
> -- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
> +- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
>  - (void)toggleFullScreen:(id)sender;
>  - (void)showQEMUDoc:(id)sender;
>  - (void)showQEMUTec:(id)sender;
> @@ -802,7 +802,7 @@ QemuCocoaView *cocoaView;
>      exit(status);
>  }
>
> -- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
> +- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
>  {
>      COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n");
>
> @@ -810,7 +810,7 @@ QemuCocoaView *cocoaView;
>          exit(0);
>      } else if(returnCode == NSOKButton) {
>          const char *bin = "qemu";
> -        char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
> +        char *img = (char*)[ [ sheet filename ] fileSystemRepresentation];
>
>          char **argv = (char**)malloc( sizeof(char*)*3 );
>
> --
> 1.8.2
>
>
diff mbox

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 048cc97..edd62be 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -68,6 +68,10 @@  static DisplayChangeListener *dcl;
 int gArgc;
 char **gArgv;
 
+#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4)
+typedef int NSInteger;
+#endif
+
 // keymap conversion
 int keymap[] =
 {
@@ -350,11 +354,7 @@  QemuCocoaView *cocoaView;
         } else {
             // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
             const NSRect *rectList;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
             NSInteger rectCount;
-#else
-            int rectCount;
-#endif
             int i;
             CGImageRef clipImageRef;
             CGRect clipRect;
@@ -712,7 +712,7 @@  QemuCocoaView *cocoaView;
 {
 }
 - (void)startEmulationWithArgc:(int)argc argv:(char**)argv;
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
 - (void)toggleFullScreen:(id)sender;
 - (void)showQEMUDoc:(id)sender;
 - (void)showQEMUTec:(id)sender;
@@ -802,7 +802,7 @@  QemuCocoaView *cocoaView;
     exit(status);
 }
 
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
 {
     COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n");
 
@@ -810,7 +810,7 @@  QemuCocoaView *cocoaView;
         exit(0);
     } else if(returnCode == NSOKButton) {
         const char *bin = "qemu";
-        char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
+        char *img = (char*)[ [ sheet filename ] fileSystemRepresentation];
 
         char **argv = (char**)malloc( sizeof(char*)*3 );