From patchwork Sun May 10 22:19:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 48189 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6A12121578 for ; Sun, 10 May 2015 22:19:26 +0000 (UTC) Received: by lbbrr5 with SMTP id rr5sf34147495lbb.3 for ; Sun, 10 May 2015 15:19:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=AQ7uePkAU3CVB4cr5SdAcTkunpBM8T4MBGrvYQ/rHSE=; b=liuDO9wZScB0h4PMcXNjLOJHr1LpTpFsjvEjbJo9PjpxMUsOiVnv1a7xpuyTU+emo/ 7Vf2ddv6YBqtUNNvYKVaOLkVClOPDj7T2D8bPsg+rOc9AJG10C4EkalyYakYWdUfLxWc HQKYWmsu6ZurcfIS76ZWJO0XKm6bNj/8+XjRpgrd9oHiivXbwh68tE6YvFPexi+Yv0DD VSEKocuPNcQVz04gd4g86lrwHxrXnk5c/FAiRlfeTW7crP98Zac6qhT5mOJLip71fJm3 VbnXoB4u9ZjyOn1O2BfCNhDDHQTO2r0Ta1CNU6yzmH/2E46zPmILaHripYH8ofAaIW/A yPyQ== X-Gm-Message-State: ALoCoQnXNt3kPjrVolIMLDP/6nElTME+IXYlw+GFj6QG2+iHVMOKsHbFJSYmMJ9Cp7DN6Yyj8FT9 X-Received: by 10.152.206.36 with SMTP id ll4mr5662771lac.6.1431296365288; Sun, 10 May 2015 15:19:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.169 with SMTP id l9ls573409lah.52.gmail; Sun, 10 May 2015 15:19:25 -0700 (PDT) X-Received: by 10.152.37.65 with SMTP id w1mr5805420laj.111.1431296365075; Sun, 10 May 2015 15:19:25 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id lu5si7281131lac.6.2015.05.10.15.19.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 May 2015 15:19:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbuc2 with SMTP id uc2so82455778lbb.2 for ; Sun, 10 May 2015 15:19:24 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr5804025lac.41.1431296364800; Sun, 10 May 2015 15:19:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1195922lbb; Sun, 10 May 2015 15:19:24 -0700 (PDT) X-Received: by 10.152.28.73 with SMTP id z9mr5791041lag.93.1431296364214; Sun, 10 May 2015 15:19:24 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id rt1si7257512lbb.121.2015.05.10.15.19.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 10 May 2015 15:19:24 -0700 (PDT) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1YrZZC-0004Qk-8g; Sun, 10 May 2015 23:19:22 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Programmingkid , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Alexander Graf Subject: [PATCH 6/6] ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constants Date: Sun, 10 May 2015 23:19:21 +0100 Message-Id: <1431296361-16981-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1431296361-16981-1-git-send-email-peter.maydell@linaro.org> References: <1431296361-16981-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In OSX 10.10, the NSOKButton and NSCancelButton constants are deprecated and provoke compiler warnings. Avoid them by using the NSFileHandlingPanelCancelButton and NSFileHandlingPanelOKButton constants instead. These are the documented correct constants for the 10.6-and-up beginSheetModalForWindow API we use. We also use the same method for the pre-10.6 compatibility code path, but conveniently the constant values are the same and the constant names have been present since 10.0. Preferring the constant names that match the non-legacy API makes more sense anyway. Signed-off-by: Peter Maydell --- ui/cocoa.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index fade0fd..0a51fbc 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -902,9 +902,15 @@ QemuCocoaView *cocoaView; { COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n"); - if(returnCode == NSCancelButton) { + /* The NSFileHandlingPanelOKButton/NSFileHandlingPanelCancelButton values for + * returnCode strictly only apply for the 10.6-and-up beginSheetModalForWindow + * API. For the legacy pre-10.6 beginSheetForDirectory API they are NSOKButton + * and NSCancelButton. However conveniently the values are the same. + * We use the non-legacy names because the others are deprecated in OSX 10.10. + */ + if (returnCode == NSFileHandlingPanelCancelButton) { exit(0); - } else if(returnCode == NSOKButton) { + } else if (returnCode == NSFileHandlingPanelOKButton) { char *img = (char*)[ [ [ sheet URL ] path ] cStringUsingEncoding:NSASCIIStringEncoding]; char **argv = g_new(char *, 4);