Skip to contentSkip to conversation

ui/cocoa: Replace fprintf with error_report

PATCH In review Akihiko Odaki 3 participants 3 messages Feb 23, 2021 – Feb 24, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/cocoa: Replace fprintf with error_report

---
 ui/cocoa.m | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
ui/cocoa.m +3 -3
index 0ef5fdf3b7a..900bc984733 100644
@@ -270,7 +270,7 @@ static bool bool_with_iothread_lock(BoolCodeBlock block)
 static int cocoa_keycode_to_qemu(int keycode)
 {
     if (ARRAY_SIZE(mac_to_qkeycode_map) <= keycode) {
-        fprintf(stderr, "(cocoa) warning unknown keycode 0x%x\n", keycode);
+        error_report("(cocoa) warning unknown keycode 0x%x", keycode);
         return 0;
     }
     return mac_to_qkeycode_map[keycode];
@@ -1071,7 +1071,7 @@ - (id) init
         // create a view and add it to the window
         cocoaView = [[QemuCocoaView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 640.0, 480.0)];
         if(!cocoaView) {
-            fprintf(stderr, "(cocoa) can't create a view\n");
+            error_report("(cocoa) can't create a view");
             exit(1);
         }
 
@@ -1080,7 +1080,7 @@ - (id) init
             styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskClosable
             backing:NSBackingStoreBuffered defer:NO];
         if(!normalWindow) {
-            fprintf(stderr, "(cocoa) can't create window\n");
+            error_report("(cocoa) can't create window");
             exit(1);
         }
         [normalWindow setAcceptsMouseMovedEvents:YES];
Signature · 1 line
2.24.3 (Apple Git-128)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Akihiko Odaki
---
 ui/cocoa.m | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
ui/cocoa.m +2 -2
index 0ef5fdf3b7a..900bc984733 100644
@@ -270,7 +270,7 @@ static bool bool_with_iothread_lock(BoolCodeBlock block)
 static int cocoa_keycode_to_qemu(int keycode)
 {
     if (ARRAY_SIZE(mac_to_qkeycode_map) <= keycode) {
-        fprintf(stderr, "(cocoa) warning unknown keycode 0x%x\n", keycode);
+        error_report("(cocoa) warning unknown keycode 0x%x", keycode);
         return 0;
     }
     return mac_to_qkeycode_map[keycode];
@@ -1071,7 +1071,7 @@ - (id) init
         // create a view and add it to the window
         cocoaView = [[QemuCocoaView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 640.0, 480.0)];
         if(!cocoaView) {
-            fprintf(stderr, "(cocoa) can't create a view\n");
+            error_report("(cocoa) can't create a view");
             exit(1);
         }
 

ui/cocoa.m - (id) init · line 1086

Quoted 8 lines
ui/cocoa.m +1 -1
@@ -1080,7 +1080,7 @@ - (id) init
             styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskClosable
             backing:NSBackingStoreBuffered defer:NO];
         if(!normalWindow) {
-            fprintf(stderr, "(cocoa) can't create window\n");
+            error_report("(cocoa) can't create window");
             exit(1);
         }
         [normalWindow setAcceptsMouseMovedEvents:YES];

Alistair did this 3 years ago:
https://www.mail-archive.com/[email protected]/msg484556.html
but it was never merged... so: