From patchwork Tue May 19 08:23:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 48736 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5090C21411 for ; Tue, 19 May 2015 08:28:04 +0000 (UTC) Received: by wiz9 with SMTP id 9sf4337922wiz.3 for ; Tue, 19 May 2015 01:28:03 -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:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=3rK/rdgiKYIsTI8y4ln85gEvwGENaew/Xf6O8o50SRI=; b=VrWtQV7hYHzYQWudBqwMAHnhKIgfOWESvwXp6gatcyNzmYHYvLYUy4SCxWnr9oFizy wVTc7j+iylEZwovtAvEYHC5n2foNrETlM1m0pRfQZfdStWA1GQOA2zfPW46Nx5c6mRBR GaVVmrvuc/2xxZVyfhFZvZ9Otqbtfepx26QwzyLW2lxrVTdze/WGgqxxob0c9CTUPPfx mYwf+mXYkc1xsayqL2ao525Nrm1aKAFUr9AU1G+JyAeL3/9tJrZxPfKSj03SA7mU76MN w/f84Dkc4ftgMy7rjTMX+7/xEK0t8O8ip21zJIDFddxmvcuOBa1s1KIPkvN3+S7TKijE NHNA== X-Gm-Message-State: ALoCoQl4SSKo5ks3xeVHD5WnSY0Ip2kUYo9w8rzxNxa31/QNYTFpBMvQ9B69ghOQ4kGsdvoaZhqW X-Received: by 10.194.236.230 with SMTP id ux6mr21099076wjc.5.1432024083675; Tue, 19 May 2015 01:28:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.193 with SMTP id 1ls26917law.41.gmail; Tue, 19 May 2015 01:28:03 -0700 (PDT) X-Received: by 10.152.87.13 with SMTP id t13mr12687382laz.66.1432024083384; Tue, 19 May 2015 01:28:03 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id gk6si8361104lbc.173.2015.05.19.01.28.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 May 2015 01:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lagv1 with SMTP id v1so11632808lag.3 for ; Tue, 19 May 2015 01:28:03 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr12842434lae.19.1432024083089; Tue, 19 May 2015 01:28:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp627109lbb; Tue, 19 May 2015 01:28:02 -0700 (PDT) X-Received: by 10.55.17.103 with SMTP id b100mr30192118qkh.71.1432024081893; Tue, 19 May 2015 01:28:01 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w19si1772810qkw.42.2015.05.19.01.28.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 May 2015 01:28:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:44441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yucsa-0004ho-RD for patch@linaro.org; Tue, 19 May 2015 04:28:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yucok-0006Fe-Tl for qemu-devel@nongnu.org; Tue, 19 May 2015 04:24:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yucog-0006Gd-Qo for qemu-devel@nongnu.org; Tue, 19 May 2015 04:24:02 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yucog-0006GF-8n for qemu-devel@nongnu.org; Tue, 19 May 2015 04:23:58 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Yucoe-0000by-8m; Tue, 19 May 2015 09:23:56 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 19 May 2015 09:23:54 +0100 Message-Id: <1432023835-2274-10-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432023835-2274-1-git-send-email-peter.maydell@linaro.org> References: <1432023835-2274-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PULL 09/10] ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constants X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Message-id: 1431296361-16981-7-git-send-email-peter.maydell@linaro.org --- 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);