]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix format specifier warnings in nsterm.m
authorCharalampos Mitrodimas <charmitro@posteo.net>
Thu, 19 Dec 2024 13:28:05 +0000 (13:28 +0000)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:38:53 +0000 (16:38 +0100)
Resolve warnings caused by mismatched format specifiers in `NSLog` and
`fprintf` calls.

This was observed when compiled with Clang version
19.1.6 (arm64-apple-darwin).

Warnings fixed:
- "format specifies type 'unsigned int' but the argument has type
  'IOReturn' (aka 'int')"

* src/nsterm.m: Cast `IOReturn` (aka `int`) to `unsigned int` for `%x`
format specifiers in `NSLog`.  (Bug#74971)

(cherry picked from commit ab3888515694f89a24f64e94292c578af86eeaee)

src/nsterm.m

index c705a3c78f4670365450ff0278844ad19e3c14b2..5793bb961e8bd752a9e41b72c0f9db74921adf07 100644 (file)
@@ -6955,8 +6955,12 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
 
 #ifndef NS_IMPL_GNUSTEP
       if (NS_KEYLOG)
-        fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",
-                 code, fnKeysym, flags, emacs_event->modifiers);
+       fprintf (stderr,
+                "keyDown: code = %x\tfnKey = %x\tflags = %x\tmods = "
+                "%x\n",
+                (unsigned int) code, (unsigned int) fnKeysym,
+                (unsigned int) flags,
+                (unsigned int) emacs_event->modifiers);
 #endif
 
       /* If it was a function key or had control-like modifiers, pass
@@ -10761,7 +10765,7 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
 
       IOReturn lockStatus = IOSurfaceLock (surface, 0, nil);
       if (lockStatus != kIOReturnSuccess)
-        NSLog (@"Failed to lock surface: %x", lockStatus);
+        NSLog (@"Failed to lock surface: %x", (unsigned int)lockStatus);
 
       [self copyContentsTo:surface];
 
@@ -10808,7 +10812,7 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
 
   IOReturn lockStatus = IOSurfaceUnlock (currentSurface, 0, nil);
   if (lockStatus != kIOReturnSuccess)
-    NSLog (@"Failed to unlock surface: %x", lockStatus);
+    NSLog (@"Failed to unlock surface: %x", (unsigned int)lockStatus);
 }
 
 
@@ -10849,7 +10853,8 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
 
   lockStatus = IOSurfaceLock (source, kIOSurfaceLockReadOnly, nil);
   if (lockStatus != kIOReturnSuccess)
-    NSLog (@"Failed to lock source surface: %x", lockStatus);
+    NSLog (@"Failed to lock source surface: %x",
+          (unsigned int) lockStatus);
 
   sourceData = IOSurfaceGetBaseAddress (source);
   destinationData = IOSurfaceGetBaseAddress (destination);
@@ -10861,7 +10866,7 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
 
   lockStatus = IOSurfaceUnlock (source, kIOSurfaceLockReadOnly, nil);
   if (lockStatus != kIOReturnSuccess)
-    NSLog (@"Failed to unlock source surface: %x", lockStatus);
+    NSLog (@"Failed to unlock source surface: %x", (unsigned int)lockStatus);
 }
 
 #undef CACHE_MAX_SIZE