Message ID | 20230630180423.558337-7-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp593094wrs; Fri, 30 Jun 2023 11:06:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHu4hqcuji1QboC3fxPDZUBltM91GocQZ+8lyYAmyxDSTnbyJCxAcaDPXFqwflA7w+W/2+7 X-Received: by 2002:a05:6358:cc2f:b0:134:e5ec:6ab6 with SMTP id gx47-20020a056358cc2f00b00134e5ec6ab6mr3363667rwb.25.1688148396134; Fri, 30 Jun 2023 11:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688148396; cv=none; d=google.com; s=arc-20160816; b=MfCfdaHhBgumJOGyZSSrv10NHt2S07SGtiNP2+EMKVRYCL61QlKmIxljIf44wluF4u CySSjAgb0etY4GCgKAdKh5i8pV0sqzRiyT6dPoel5w0TlFF0KzTzJ/3t8TY7J/C+fBuS XRwA3FBS4fmb+4Rmo3MVfTU2bEEEgZ525XDcyKqbM8O1/Jhc+RX+QHxm/Guu1VPq9Z0d +NAmAWd9B8/Zg8UXAT6oh5OhgfDoN75ZzfUQedu6IarngbAPWScll+rXpftt0eaRP85D Ew2w1j6KzpwzvrAeO8hXMOjy0wgArRGzT6u3sgpW65umU4wPeLUg6RKnUePtP/RbDXjT 5UDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JwYXISrmUwYEeEBYbvf+rC+BgUtqy99AwD9pTl/rVpc=; fh=OltHerz+Vf7zZkebZbScoRT4WgVwJDskRS7DoEjx2Hw=; b=My4fEsM1veEyZVvAHQzeBZVb06VSUA7Eyyt3uQMES6H3cUKfGRAzPO1NqnRnHvydyE yoAZrUe3iO3P+u9veJ3fgYtt+J2lKjq5hUswrAOj6Cd8Zc/Ac0oiDGBLFD8n1VxsPotG go3sCcJRkUSbKp7SSyfEd/U8HFBUOOjmD/RN+b2tnv2hdOFwO2wKZGthEvbXwEteATGb 814PvWYvUE/5+XxUhAoBo4bT1RBuf1wQTaZ4fX/D64/TWyMJlky0MarE9SdAomKJg0V0 stL75zpPO1HSslxYxfVRqMnkHH5lqnOToEtm3F9mM5hlzH7hScZbL7XDESWWVAleSESS 1ATg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MpO2MOS4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m20-20020ac85b14000000b004033ec2f5e4si1401790qtw.464.2023.06.30.11.06.35 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 11:06:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MpO2MOS4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1qFIUB-0008Q2-PO; Fri, 30 Jun 2023 14:04:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1qFITx-0008IJ-Rc for qemu-devel@nongnu.org; Fri, 30 Jun 2023 14:04:35 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1qFITt-0006yt-Pq for qemu-devel@nongnu.org; Fri, 30 Jun 2023 14:04:32 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc12181b6so19815185e9.2 for <qemu-devel@nongnu.org>; Fri, 30 Jun 2023 11:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688148267; x=1690740267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JwYXISrmUwYEeEBYbvf+rC+BgUtqy99AwD9pTl/rVpc=; b=MpO2MOS4a98PEtb2uWvjbuhddvjIe20YxqcF3E3H8bVlwK2tLZ+90AxPHqHk9qJqzY 2gPtLSIJj3hFE7C7usNN64fgOBoeoS1cfO+DgM9sqo+7CDm0hKlcQMZRRpypk6QfckWf bvc+EDldvonBgUdZaLLFTNZiWzwcVPW9s5V7wyfWRmeJ5H0kcOfvuctgcK8FZfP+ubtP crRYg39gl7y1/tj3at73i2yv333nzywosh2ljppkTeyHCmb/nipiGbdYcOLzut/ZVBlH GfDxrp7inwXlasLtPzcSdO6mtjMIDfi2tNoauXOuNsX0wBMdcysR9puTXZ5G3OsskeL4 DCbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688148267; x=1690740267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JwYXISrmUwYEeEBYbvf+rC+BgUtqy99AwD9pTl/rVpc=; b=XIEKQjqB3mtCd64lJhemvdt2cH4vvwb5ZCWyBf22MhBqY6eApOJ/7+1HkR82An4eHX EpoW8l844Y+UKS26I+MUU+pumBY/axgt1oXiUqkSyH1WGO6EZ7ZWqvd7UHOvnrpZnO0T 3ReIDR/NnaGY4lc3izbdwuUSLMlsY/+hzRzF8YOOwcpR+7FrDO8qVifmczphUcO9/Nsr Czwb48vLBJ2Muvb/RdTUGD31m7Jce5CmhDlqsx1Q6fIhMyL8uhxRq6p5XHJ7jVKFWofW GB6EmrNgC8o7QbfYPtX/hjxQcz8aAQ5BqVwj4BwC316t7d5SLbP8X5xV25rbx26L5Idi 3K/g== X-Gm-Message-State: AC+VfDya2dUWhhDihmaRAGeRIeovqphnf0fNfFASfrRXVDuqnHQwdcq2 S2DzCNLvd5ipwtgJ8bZPHFCWOw== X-Received: by 2002:a05:600c:2299:b0:3fb:b2a5:aeac with SMTP id 25-20020a05600c229900b003fbb2a5aeacmr2508315wmf.20.1688148267615; Fri, 30 Jun 2023 11:04:27 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id y5-20020a05600c364500b003fbc9d178a8sm1192326wmq.4.2023.06.30.11.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 11:04:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8BF481FFC1; Fri, 30 Jun 2023 19:04:24 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= <berrange@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Leonardo Bras <leobras@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Peter Xu <peterx@redhat.com>, Juan Quintela <quintela@redhat.com>, Beraldo Leal <bleal@redhat.com>, Radoslaw Biernacki <rad@semihalf.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Peter Maydell <peter.maydell@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Riku Voipio <riku.voipio@iki.fi>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Mahmoud Mandour <ma.mandourr@gmail.com>, Alexandre Iooss <erdnaxe@crans.org>, =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>, =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= <philmd@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Bin Meng <bmeng.cn@gmail.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Bandan Das <bsd@redhat.com>, Cleber Rosa <crosa@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Leif Lindholm <quic_llindhol@quicinc.com>, Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>, qemu-arm@nongnu.org, Darren Kenny <darren.kenny@oracle.com>, Alexander Bulekov <alxndr@bu.edu> Subject: [PATCH v4 06/38] qemu-keymap: properly check return from xkb_keymap_mod_get_index Date: Fri, 30 Jun 2023 19:03:51 +0100 Message-Id: <20230630180423.558337-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230630180423.558337-1-alex.bennee@linaro.org> References: <20230630180423.558337-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
maintainer omnibus: testing, fuzz, plugins, documentation, gdbstub (pre-PR)
|
expand
|
diff --git a/qemu-keymap.c b/qemu-keymap.c index 229866e004..8c80f7a4ed 100644 --- a/qemu-keymap.c +++ b/qemu-keymap.c @@ -140,6 +140,18 @@ static void usage(FILE *out) names.options ?: "-"); } +static xkb_mod_mask_t get_mod(struct xkb_keymap *map, const char *name) +{ + xkb_mod_index_t mod; + xkb_mod_mask_t mask = 0; + + mod = xkb_keymap_mod_get_index(map, name); + if (mod != XKB_MOD_INVALID) { + mask = (1 << mod); + } + return mask; +} + int main(int argc, char *argv[]) { struct xkb_context *ctx; @@ -215,14 +227,10 @@ int main(int argc, char *argv[]) mod, xkb_keymap_mod_get_name(map, mod)); } - mod = xkb_keymap_mod_get_index(map, "Shift"); - shift = (1 << mod); - mod = xkb_keymap_mod_get_index(map, "Control"); - ctrl = (1 << mod); - mod = xkb_keymap_mod_get_index(map, "AltGr"); - altgr = (1 << mod); - mod = xkb_keymap_mod_get_index(map, "NumLock"); - numlock = (1 << mod); + shift = get_mod(map, "Shift"); + ctrl = get_mod(map, "Control"); + altgr = get_mod(map, "AltGr"); + numlock = get_mod(map, "NumLock"); state = xkb_state_new(map); xkb_keymap_key_for_each(map, walk_map, state);