diff mbox series

[v3,10/16] ui/cocoa: Clean up global variable shadowing

Message ID 20231004120019.93101-11-philmd@linaro.org
State Superseded
Headers show
Series (few more) Steps towards enabling -Wshadow | expand

Commit Message

Philippe Mathieu-Daudé Oct. 4, 2023, noon UTC
Fix:

  ui/cocoa.m:346:20: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
      QemuCocoaView *cocoaView = userInfo;
                     ^
  ui/cocoa.m:342:16: note: previous declaration is here
  QemuCocoaView *cocoaView;
                 ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 ui/cocoa.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Akihiko Odaki Oct. 5, 2023, 5:15 a.m. UTC | #1
On 2023/10/04 21:00, Philippe Mathieu-Daudé wrote:
> Fix:
> 
>    ui/cocoa.m:346:20: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>        QemuCocoaView *cocoaView = userInfo;
>                       ^
>    ui/cocoa.m:342:16: note: previous declaration is here
>    QemuCocoaView *cocoaView;
>                   ^
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   ui/cocoa.m | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index df6d13be38..15477288fd 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -343,9 +343,9 @@ - (void) raiseAllKeys;
>   
>   static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEventRef cgEvent, void *userInfo)
>   {
> -    QemuCocoaView *cocoaView = userInfo;
> +    QemuCocoaView *view = userInfo;
>       NSEvent *event = [NSEvent eventWithCGEvent:cgEvent];
> -    if ([cocoaView isMouseGrabbed] && [cocoaView handleEvent:event]) {
> +    if ([view isMouseGrabbed] && [view handleEvent:event]) {
>           COCOA_DEBUG("Global events tap: qemu handled the event, capturing!\n");
>           return NULL;
>       }

Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
diff mbox series

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index df6d13be38..15477288fd 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -343,9 +343,9 @@  - (void) raiseAllKeys;
 
 static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEventRef cgEvent, void *userInfo)
 {
-    QemuCocoaView *cocoaView = userInfo;
+    QemuCocoaView *view = userInfo;
     NSEvent *event = [NSEvent eventWithCGEvent:cgEvent];
-    if ([cocoaView isMouseGrabbed] && [cocoaView handleEvent:event]) {
+    if ([view isMouseGrabbed] && [view handleEvent:event]) {
         COCOA_DEBUG("Global events tap: qemu handled the event, capturing!\n");
         return NULL;
     }