From patchwork Wed Apr 21 07:20:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE0D5C433B4 for ; Wed, 21 Apr 2021 07:20:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6426461427 for ; Wed, 21 Apr 2021 07:20:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235083AbhDUHVL (ORCPT ); Wed, 21 Apr 2021 03:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbhDUHVK (ORCPT ); Wed, 21 Apr 2021 03:21:10 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CD7AC06174A for ; Wed, 21 Apr 2021 00:20:38 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id h20so21131296plr.4 for ; Wed, 21 Apr 2021 00:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=8kAAOsS/FtGPnyLMlTHYD0eKa7nIeeaFOaw4EILg7ps=; b=Mj5fbrbEX4bmxQzxcGbCZV3s5oCVNGkLH1z6XdemvV8RKjdyQAP+3ZoqELNXz9wyih pGPc4LLjgrNIdXNQZSbfBosI4khGQ0AGhT5HlxjdbpB9Qfnh/0SL6TW1zPDd7tU6QD9p 2FRumCwQEEoIrqdfQL7dZKQPshNttYgbKKWkuMdwyUbk2rFKbCeq1pIRFDeAmwwIVrqu /6Vqn9pe4MpYjLx/JupaHCHseBRShp//apHpy/P+7BJxZbs/KfS9/TqR25NrDk0CfIHD pC46fewHYVJ9/bJ8lbvxcaLkCgQXsuPxKnHMTd8cyRYVGDTE7Tqo78DEa/oDdDCrXHZE mk6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=8kAAOsS/FtGPnyLMlTHYD0eKa7nIeeaFOaw4EILg7ps=; b=FbUJ5a2YLQyc41Luw52I1MQSBuy/ydvnYkimRcqqv96npqxEqnobY7Of151QP3KDRQ WMVGVGVJetUzIVJYl/ibwFsnpDPJkQ5Nx5H1sxyY+fZKWLSg9TCSAL8fZq3NE1C1iQ8p CuJDdlOKt2vIa51zPyfrNS8h3TsjqLOkjxKEOIQg0cTMueT/H8hd/hNznBQpHPgsYFWz 662/FbKAoCi77PKGha4lB80tzcKnY8XLmRratle6mafEtfP9hHqGZ/3uzF51g/Fp/o0g Ev25aN0iJu5JJ/FmNY/GEnHOh3LavygMDq9SmgjTo6jGvhMkeX4UhDq5OtonlyP1Cc5P PYdQ== X-Gm-Message-State: AOAM533TU0aityoRymto2I+waygXcW2lMoRAPn7LDtjOOA59bnua/R9p 6Ykwdk1FhsImG7VTAtAaJE0Bbd+SZL2vzQ== X-Google-Smtp-Source: ABdhPJxYyWuvaZ6b6uOKXdGNbJNWKz7b6HB5PtrPkV0nX8CxtDicDqB45bvtUJV1shPIWIsN80mCYA== X-Received: by 2002:a17:902:b08a:b029:ec:af20:5602 with SMTP id p10-20020a170902b08ab02900ecaf205602mr11468570plr.71.1618989637267; Wed, 21 Apr 2021 00:20:37 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:36 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 1/8] clang-tidy: use auto Date: Wed, 21 Apr 2021 00:20:28 -0700 Message-Id: <20210421072035.4188497-1-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with modernize-use-auto Signed-off-by: Rosen Penev --- utils/cec-ctl/cec-ctl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 107dcfab2..c17265a5c 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -1833,7 +1833,7 @@ static __u16 parse_phys_addr_from_edid(const char *edid_path) static void *thread_edid_poll(void *arg) { - struct node *node = static_cast(arg); + auto node = static_cast(arg); __u16 phys_addr; bool has_edid; char dummy; From patchwork Wed Apr 21 07:20:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2691C433ED for ; Wed, 21 Apr 2021 07:20:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9663461427 for ; Wed, 21 Apr 2021 07:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235509AbhDUHVM (ORCPT ); Wed, 21 Apr 2021 03:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235210AbhDUHVL (ORCPT ); Wed, 21 Apr 2021 03:21:11 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B969CC06174A for ; Wed, 21 Apr 2021 00:20:38 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id t22so20799558ply.1 for ; Wed, 21 Apr 2021 00:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=y2Wy26eehSv0lHvenlaSe1nkyEj1Si4bGcBx65VhGMI=; b=jNV1x/kq2oMdNB8YUaqzv6q1+JSTpa6m1e8NnZsEnfmbRfbNPm+jrK0WBBKbds6PDk MOnL9TR+vAHZSe6N/wqJB+4QUhVdRCjNK8tpBhNvUFXpS9aqcD2za1OqsmxPGygVJxaX r3a9jb4r3qK/gX+UMr86I10EFRXzbiSZXoxwITYU6CotO2755MahzPVG/GsEk4sxB5TN za64hBG4Dx5Zwm3o2B7kxUy80FE21FRNa/C+bXn3jmu4+vngzBFY8qRxBk/LVGgVe6kX TYYxZCcNHsrIbzqWiBR3rY5MxpcM2N9MQCMFlNgUtpDVBY3okZ6tM6fbpzcJ4alPT2Hv ugJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y2Wy26eehSv0lHvenlaSe1nkyEj1Si4bGcBx65VhGMI=; b=RmUaxFAt0jH6fdOK/vQitV9IikHUN2g3KQgScS1/kgYjS53J7qRiQ7sv3gciOi0jCH FbnrdNRWgRvQm21CqOsjQ0o8Rei1VGrDTmAFn45D9iayK8r2y3NDchDKyLkBV1i4mwBe AtCKQkLM0m/97OEZRF55p+LKJnrrI20CwPegL9QrEZp6ZMaXZtlK6TIRq49fnYArHmRF 9D+x4AlcV7SArcSUr05JaOcAJyXG69TglSM9aBVSg9KO4hFS2HAQ7UIhrUzi9avxYVPh DFdXSUAhFG5q3+JXVHvb9GvutdbxEWRL2tFrsGDi0kLRW3am4Iy67mNWkevfhdHq7jua JUKA== X-Gm-Message-State: AOAM531p6Mmp9nBQTxiXQlB4EtxFpw0LUTcvAZulpIrjZIrK3t+ZX1en xImuDpx/1WS5edTsJrbPCMx+SNSAw95YGw== X-Google-Smtp-Source: ABdhPJwd7yqdwdy6zwt7XmgB2dMCJfXQQRzDSJcFTXBzmDR9VYWTD/1EHmnWdrqp253C5/dZBPMYig== X-Received: by 2002:a17:902:7203:b029:e6:a8b1:8d37 with SMTP id ba3-20020a1709027203b02900e6a8b18d37mr32308841plb.44.1618989638123; Wed, 21 Apr 2021 00:20:38 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:37 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 2/8] clang-tidy: use nullptr Date: Wed, 21 Apr 2021 00:20:29 -0700 Message-Id: <20210421072035.4188497-2-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210421072035.4188497-1-rosenp@gmail.com> References: <20210421072035.4188497-1-rosenp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with modernize-use-nullptr Signed-off-by: Rosen Penev --- utils/libcecutil/cec-info.cpp | 2 +- utils/v4l2-compliance/v4l2-compliance.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/libcecutil/cec-info.cpp b/utils/libcecutil/cec-info.cpp index 22a687761..0172e8537 100644 --- a/utils/libcecutil/cec-info.cpp +++ b/utils/libcecutil/cec-info.cpp @@ -168,7 +168,7 @@ const char *cec_vendor2s(unsigned vendor) case 0x8065e9: return "Benq"; default: - return NULL; + return nullptr; } } diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 9f71332ce..90a503612 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -1460,7 +1460,7 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_ node.controls.find(VIVID_CID_DISCONNECT) != node.controls.end()) { if (node.node2) node.node2->close(); - node.node2 = NULL; + node.node2 = nullptr; printf("\ttest Disconnect: %s\n\n", ok(testVividDisconnect(&node))); } From patchwork Wed Apr 21 07:20:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 173B7C43461 for ; Wed, 21 Apr 2021 07:20:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4EC061004 for ; Wed, 21 Apr 2021 07:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235529AbhDUHVM (ORCPT ); Wed, 21 Apr 2021 03:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235421AbhDUHVL (ORCPT ); Wed, 21 Apr 2021 03:21:11 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A848C06174A for ; Wed, 21 Apr 2021 00:20:39 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id w10so28939567pgh.5 for ; Wed, 21 Apr 2021 00:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=lsJQGiylJ8Q0fC63RMBRAV5F1QZambfdv6JDw+W5Fz4=; b=JBrlyViKYWS32H4lIdRNpWGj9x2qcatsTYVFyryLNEqriZn4U/lrcGuCAIbHOoiPIG zNGfjFqRoZOqtoghWdWUHQrGWLc1p5oZt4T1/p8o2443YCoSYiJZ611d6VmFJX5vjmq2 2HXtTnk9waZvb/5dz0fbLarnSeeTi/R/jAm/3mdIXimkbAZ3o74hKc0/IfRYVY6eW9JD vdpkaezR0Q9XYs7Yng8UIgskNDrlddyTwXOeSQrFMkH+mae0gpyChOsgWwZ0Ke5qENnK xIhLFt5+z88/APLX/m2pRiqiVUCUE3MJFbPaFIvwlQxIVZGCDQAkRlMR4Lum09aJJEQA j1pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lsJQGiylJ8Q0fC63RMBRAV5F1QZambfdv6JDw+W5Fz4=; b=HEscAK9z/H+LdOnOzZCIt34CbP6Uni2avSbAiLM3i4H2JERxE3oBwMS4l1cQtKBGjN l4PBu6KqAVJyqJrEIebGXfflen2+jWzMVlgRBe4ySzZWLpDBM9Y5cxZU0/0gDE97S8Yb Em4HHddGCWgvNIybaPuLFdzKCW2C4fKXSdkTnENLXskgMCmqMtQBZMkPvfG+AgQtK/FZ vbS0F6h1lkdpq+WvunAEnixnoA2e8D80Y8Ld7fdajmoflNLlVKkTCElImBNC+mAIDpY1 xP/QH6eKkwZaafJQOsAiKGPmCcMqe+2eKRp1nZDCFtSGEZoNyvi09v12ZIYH63WGxGIw pKbw== X-Gm-Message-State: AOAM532Htd/7oh9aOQCVSLCxtwO75J64CMOd6azzNufHftZ02Nrr/AOz /DocJJi28p2dQS80pI7TMcuNKrvxcMwW+g== X-Google-Smtp-Source: ABdhPJwJ/flYRx8nBn37/BzUmcDRW3MQcdEd0YKUW/7knMOQWY2/gmSYYm80sM+9Mn+h+JxyJScyJA== X-Received: by 2002:a63:5112:: with SMTP id f18mr13182556pgb.379.1618989638844; Wed, 21 Apr 2021 00:20:38 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:38 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 3/8] remove unused ARRAY_SIZE Date: Wed, 21 Apr 2021 00:20:30 -0700 Message-Id: <20210421072035.4188497-3-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210421072035.4188497-1-rosenp@gmail.com> References: <20210421072035.4188497-1-rosenp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is a C construct that is not really needed in C++. Signed-off-by: Rosen Penev --- utils/cec-compliance/cec-compliance.h | 3 --- utils/cec-ctl/cec-pin.cpp | 2 -- utils/cec-follower/cec-follower.h | 3 --- utils/cec-follower/cec-processing.cpp | 3 --- utils/rds-ctl/rds-ctl.cpp | 2 -- 5 files changed, 13 deletions(-) diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h index 26c70c216..c558f043b 100644 --- a/utils/cec-compliance/cec-compliance.h +++ b/utils/cec-compliance/cec-compliance.h @@ -191,9 +191,6 @@ using vec_remote_subtests = std::vector; #define CEC_LOG_ADDR_MASK_ALL 0xffff -#define ARRAY_SIZE(a) \ - (sizeof(a) / sizeof(*a)) - #define COLOR_GREEN(s) "\033[32m" s "\033[0m" #define COLOR_RED(s) "\033[1;31m" s "\033[0m" #define COLOR_BOLD(s) "\033[1m" s "\033[0m" diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp index f9ecac7fb..30e5accf5 100644 --- a/utils/cec-ctl/cec-pin.cpp +++ b/utils/cec-ctl/cec-pin.cpp @@ -17,8 +17,6 @@ #include "cec-ctl.h" #include "cec-log.h" -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - static std::string find_opcode_name(__u8 opcode) { const char *name = cec_opcode2s(opcode); diff --git a/utils/cec-follower/cec-follower.h b/utils/cec-follower/cec-follower.h index 5b67a260f..7806a4b64 100644 --- a/utils/cec-follower/cec-follower.h +++ b/utils/cec-follower/cec-follower.h @@ -20,9 +20,6 @@ #include #include -#define ARRAY_SIZE(a) \ - (sizeof(a) / sizeof(*a)) - extern bool show_info; extern bool show_msgs; extern bool show_state; diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp index 83ffcc30b..024407471 100644 --- a/utils/cec-follower/cec-processing.cpp +++ b/utils/cec-follower/cec-processing.cpp @@ -29,9 +29,6 @@ /* Time between each polling message sent to a device */ #define POLL_PERIOD 15000 -#define ARRAY_SIZE(a) \ - (sizeof(a) / sizeof(*a)) - struct cec_enum_values { const char *type_name; __u8 value; diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index e27182821..8161aa453 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -27,8 +27,6 @@ #include #include -#define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0]))) - using dev_vec = std::vector; using dev_map = std::map; From patchwork Wed Apr 21 07:20:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215597 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78093C433B4 for ; Wed, 21 Apr 2021 07:20:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A2CD61004 for ; Wed, 21 Apr 2021 07:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235546AbhDUHVN (ORCPT ); Wed, 21 Apr 2021 03:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235421AbhDUHVM (ORCPT ); Wed, 21 Apr 2021 03:21:12 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C637C06174A for ; Wed, 21 Apr 2021 00:20:40 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id e9so4143358plj.2 for ; Wed, 21 Apr 2021 00:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=c/2RibfG4nS5rPwvMYLatU1oFvhbBRYrWgP4lB+fXPU=; b=oS6uWu1f0eqSrNfzlqzfDd2MZ0152E3nXkoebJUU0sp/a2AcW5vwfmNbTmYVQAwKMF c2h3Z1tbNoIyTEooYNQQjvcOcwCfANhzdG4YfOYTfLzmfN7rVLiNAjWow/AaBvH+oKAt FgRCnzbfYwqaoNxD8OKh76f1flB3qiRN7HdrlQeSQm9diGeejbhtHhZzO6Jb60UDlvAO Su78ORH8TetcpY6hXn9RWRFs4z6Y/XDjNIgm3XuAc/v5wM94FAGuWCSesLVfONFV5I1F Z8LS4Yuohw0/9rHmyKQSTs/BWizVWOXzrWJKm+/KQxDIdPYu3Lud0b9+669O5CqbAmF8 ZqCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c/2RibfG4nS5rPwvMYLatU1oFvhbBRYrWgP4lB+fXPU=; b=cU8ITNSbmNWCxQIuKjC2JxhCOlgmhCCg+OWumUXY4ZEySYee5OuHDdIRAijAb2pdUb TTKhqdYgbyBMAvDBUAXI3vK6uSO8KLWamwYsD3HOTMq6AxzXHx1jMK2fFAWFyng3IFMG ulUyFxGtpzcJWCjvCeN9tw7UOnvQ7hpcdjmL50L5IyNts4QNc7RzVR2V1C6HXvNJYTAY BrEsID3gvtZ/AHYxDBczjr/sbReiJH2idBcXZWRlYYBRGpCx/7EqX+f+V3hswD4lSBWp wSXFMCJrfTpSM52cH/VCvCZcxLPFkLKUhQSsmq9MNXR56DGDX5t1x5rq65eqZLFp8NEK RGHw== X-Gm-Message-State: AOAM533hZ1iT/92tL9/+zLR5K+2mAegDnVHPncUd64Qxod/z9NrOEsUx zY+K2LR9EScOIKvjWFyeuP85sCmUNb8/KA== X-Google-Smtp-Source: ABdhPJy+xxkFxrZGJb+FJWMJzZ50w5u5oeUWjVExbdvgLeMAZAkusIXiVPiLfj0gFwulmwW4KQR99A== X-Received: by 2002:a17:902:4c:b029:ec:a39a:41ad with SMTP id 70-20020a170902004cb02900eca39a41admr15147981pla.52.1618989639641; Wed, 21 Apr 2021 00:20:39 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:39 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 4/8] cec-tuner: std::array conversions Date: Wed, 21 Apr 2021 00:20:31 -0700 Message-Id: <20210421072035.4188497-4-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210421072035.4188497-1-rosenp@gmail.com> References: <20210421072035.4188497-1-rosenp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Allows getting rid of sizeof macros. Signed-off-by: Rosen Penev --- utils/cec-follower/cec-tuner.cpp | 140 +++++++++++++++---------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp index ac5c49950..b9c21684b 100644 --- a/utils/cec-follower/cec-tuner.cpp +++ b/utils/cec-follower/cec-tuner.cpp @@ -3,6 +3,7 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include #include #include @@ -13,10 +14,8 @@ #define NUM_ANALOG_FREQS 3 #define NUM_DIGITAL_CHANS 3 -#define TOT_ANALOG_FREQS (sizeof(analog_freqs_khz) / sizeof(analog_freqs_khz[0][0][0])) -#define TOT_DIGITAL_CHANS ((sizeof(digital_arib_data) / sizeof(digital_arib_data[0][0])) + \ - (sizeof(digital_atsc_data) / sizeof(digital_atsc_data[0][0])) + \ - (sizeof(digital_dvb_data) / sizeof(digital_dvb_data[0][0]))) +#define TOT_ANALOG_FREQS analog_freqs_khz[0][0].size() +#define TOT_DIGITAL_CHANS digital_arib_data[0].size() + digital_atsc_data[0].size() + digital_dvb_data[0].size() struct service_info { unsigned tsid; @@ -45,22 +44,22 @@ struct service_info { * * https://sichbopvr.com/frequency-tables/Brazil/Rio%20de%20Janeiro/Rio%20De%20Janeiro */ -static const struct service_info digital_arib_data[2][NUM_DIGITAL_CHANS] = -{ +using arib = std::array; +static constexpr std::array digital_arib_data{ // satellite, arib-bs - { + arib{ // tsid, onid, sid, fmt, major, minor - { 1032, 1, 30203, 1, 0, 30203 }, - { 1046, 1, 30505, 1, 0, 30505 }, - { 1060, 1, 30609, 1, 0, 30609 } + service_info{ 1032, 1, 30203, 1, 0, 30203 }, + service_info{ 1046, 1, 30505, 1, 0, 30505 }, + service_info{ 1060, 1, 30609, 1, 0, 30609 }, }, // terrestrial, arib-t - { + arib{ // tsid, onid, sid, fmt, major, minor - { 1519, 1519, 48608, 1, 0, 48608 }, - { 1624, 1624, 51992, 1, 0, 51992 }, - { 1905, 1905, 60960, 1, 0, 60960 } - } + service_info{ 1519, 1519, 48608, 1, 0, 48608 }, + service_info{ 1624, 1624, 51992, 1, 0, 51992 }, + service_info{ 1905, 1905, 60960, 1, 0, 60960 }, + }, }; /* @@ -84,22 +83,22 @@ static const struct service_info digital_arib_data[2][NUM_DIGITAL_CHANS] = * ATSC does not use ONIDs and SID will be used as the program number. All ATSC * channel number formats are 2 part. */ -static const struct service_info digital_atsc_data[2][NUM_DIGITAL_CHANS] = -{ +using atsc = std::array; +static constexpr std::array digital_atsc_data{ // satellite, atsc-sat - { + atsc{ // tsid, onid, sid, fmt, major, minor - { 2065, 0, 50316, 2, 3, 50316 }, - { 2090, 0, 50882, 2, 3, 50882 }, - { 2122, 0, 55295, 2, 3, 55295 } + service_info{ 2065, 0, 50316, 2, 3, 50316 }, + service_info{ 2090, 0, 50882, 2, 3, 50882 }, + service_info{ 2122, 0, 55295, 2, 3, 55295 }, }, // terrestrial, atsc-t - { + atsc{ // tsid, onid, sid, fmt, major, minor - { 1675, 0, 1, 2, 4, 1 }, - { 1675, 0, 2, 2, 4, 2 }, - { 1675, 0, 3, 2, 4, 3 } - } + service_info{ 1675, 0, 1, 2, 4, 1 }, + service_info{ 1675, 0, 2, 2, 4, 2 }, + service_info{ 1675, 0, 3, 2, 4, 3 }, + }, }; /* @@ -119,22 +118,22 @@ static const struct service_info digital_atsc_data[2][NUM_DIGITAL_CHANS] = * https://sichbopvr.com/frequency-tables/Sweden/Skane%20Lan/Malm%c3%b6 * */ -static const struct service_info digital_dvb_data[2][NUM_DIGITAL_CHANS] = -{ +using dvb = std::array; +static constexpr std::array digital_dvb_data{ // satellite, dvb-s2 - { + dvb{ // tsid, onid, sid, fmt, major, minor - { 61, 70, 7193, 1, 0, 24 }, - { 65, 70, 7040, 1, 0, 72 }, - { 28, 70, 7012, 1, 0, 101 } + service_info{ 61, 70, 7193, 1, 0, 24 }, + service_info{ 65, 70, 7040, 1, 0, 72 }, + service_info{ 28, 70, 7012, 1, 0, 101 }, }, // terrestrial, dvb-t - { + dvb{ // tsid, onid, sid, fmt, major, minor - { 1002, 8400, 2025, 1, 0, 21 }, - { 1004, 8400, 84, 1, 0, 31 }, - { 1004, 8945, 1040, 1, 0, 1040 } - } + service_info{ 1002, 8400, 2025, 1, 0, 21 }, + service_info{ 1004, 8400, 84, 1, 0, 31 }, + service_info{ 1004, 8945, 1040, 1, 0, 1040 }, + }, }; /* @@ -150,71 +149,72 @@ static const struct service_info digital_dvb_data[2][NUM_DIGITAL_CHANS] = * * https://en.wikipedia.org/wiki/Television_channel_frequencies */ -static unsigned int analog_freqs_khz[3][9][NUM_ANALOG_FREQS] = -{ +using khz = std::array; +using freqs = std::array; +static constexpr std::array analog_freqs_khz{ // cable - { + freqs{ // pal-bg - { 471250, 479250, 487250 }, + khz{ 471250, 479250, 487250 }, // secam-lq - { 615250, 623250, 631250 }, + khz{ 615250, 623250, 631250 }, // pal-m - { 501250, 507250, 513250 }, + khz{ 501250, 507250, 513250 }, // ntsc-m - { 519250, 525250, 531250 }, + khz{ 519250, 525250, 531250 }, // pal-i - { 45750, 53750, 61750 }, + khz{ 45750, 53750, 61750 }, // secam-dk - { 759250, 767250, 775250 }, + khz{ 759250, 767250, 775250 }, // secam-bg - { 495250, 503250, 511250 }, + khz{ 495250, 503250, 511250 }, // secam-l - { 639250, 647250, 655250 }, + khz{ 639250, 647250, 655250 }, // pal-dk - { 783250, 791250, 799250 } + khz{ 783250, 791250, 799250 }, }, // satellite - { + freqs{ // pal-bg - { 519250, 527250, 535250 }, + khz{ 519250, 527250, 535250 }, // secam-lq - { 663250, 671250, 679250 }, + khz{ 663250, 671250, 679250 }, // pal-m - { 537250, 543250, 549250 }, + khz{ 537250, 543250, 549250 }, // ntsc-m - { 555250, 561250, 567250 }, + khz{ 555250, 561250, 567250 }, // pal-i - { 175250, 183250, 191250 }, + khz{ 175250, 183250, 191250 }, // secam-dk - { 807250, 815250, 823250 }, + khz{ 807250, 815250, 823250 }, // secam-bg - { 543250, 551250, 559250 }, + khz{ 543250, 551250, 559250 }, // secam-l - { 687250, 695250, 703250 }, + khz{ 687250, 695250, 703250 }, // pal-dk - { 831250, 839250, 847250 } + khz{ 831250, 839250, 847250 }, }, // terrestrial - { + freqs{ // pal-bg - { 567250, 575250, 583250 }, + khz{ 567250, 575250, 583250 }, // secam-lq - { 711250, 719250, 727250 }, + khz{ 711250, 719250, 727250 }, // pal-m - { 573250, 579250, 585250 }, + khz{ 573250, 579250, 585250 }, // ntsc-m - { 591250, 597250, 603250 }, + khz{ 591250, 597250, 603250 }, // pal-i - { 199250, 207250, 215250 }, + khz{ 199250, 207250, 215250 }, // secam-dk - { 145250, 153250, 161250 }, + khz{ 145250, 153250, 161250 }, // secam-bg - { 591250, 599250, 607250 }, + khz{ 591250, 599250, 607250 }, // secam-l - { 735250, 743250, 751250 }, + khz{ 735250, 743250, 751250 }, // pal-dk - { 169250, 177250, 185250 } - } + khz{ 169250, 177250, 185250 }, + }, }; void tuner_dev_info_init(struct state *state) From patchwork Wed Apr 21 07:20:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAF3FC433B4 for ; Wed, 21 Apr 2021 07:20:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9873E61427 for ; Wed, 21 Apr 2021 07:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236735AbhDUHVP (ORCPT ); Wed, 21 Apr 2021 03:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235548AbhDUHVO (ORCPT ); Wed, 21 Apr 2021 03:21:14 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D5F5C06174A for ; Wed, 21 Apr 2021 00:20:41 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id y32so28914815pga.11 for ; Wed, 21 Apr 2021 00:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PJ/S/k3FWC2OeQ4AWPZOkhr9dS9J8DY0WyKmH92BPIk=; b=Yz2yAUt2dbiDAjVdKcZyr0rOkSZk7EfeRuZjXhl0bDX169BvXAzbUxY4Jj1jxZxvV5 85Yuilr3NUYf6yF6ACJUkH9RjjsA1sc9CXAqAfO9kjRQjMt1VLX0ZHT7+4E+y0BiSbWj /WgMMfPAfg7NNHD9jUv1JmW8PBZWHSqT8gViBnFy0yYB8YukoGgLJT+0NaDyBrxAsGn4 E7nSS8pE0sCVj1tUbmb8T10zlisDHCyYQQQAhFAwhVDhMieCo93cxVey3jxLZt95ZWm4 wtOh0PydKVruaeEa1TmuJxQtA36dwZmjuFc62LP+yjUyvJTnh9YliOkydS8d0dPw/Fyu Jiuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PJ/S/k3FWC2OeQ4AWPZOkhr9dS9J8DY0WyKmH92BPIk=; b=FLc5F9FB4CZHrg0wdZC+mDT5DgmsGKtRICUyJyWEDpZXvrM36fBV9Vu7jHa0QhGSOp +Fk6yUbE/aHXUlnNqSo3AsfA4zg9Msded8VyOhHdUN0DNw2f8nEflWduNxt8NoNoZeCw 75ckyVuLMtAJLdbLjKqPX5OFtmb/kHaWn1c5nquxUktcDsSj/dBmZapeKqOFTYUr5AF8 eZWmPj33vKWf161DC4Coyb6SsCfsC1wnXiavQ7aO07NLIRV8D33fAvB+xiRaNzNKnknw eKdADV4/9L0cg5AokmwuC0OQ7dchGzSCW122fEgIdxA5tCnFO/pTpkCj89FXsqLPTSMX 3IFQ== X-Gm-Message-State: AOAM531YOV1J2E0YjekrYegbTXAjgxsQ3nbTuZdD3yXLW9nGjNLAoLoj 5GxQxkiXlJnuNezawYIMGgxGQlzsp+8gzA== X-Google-Smtp-Source: ABdhPJzszYsazpVKpjg6+/GMxk902Qwt6qr9Bap/1RCtxaVcNoTshn6yn2J7F2KYtVQzCW7RQdzfbQ== X-Received: by 2002:a63:556:: with SMTP id 83mr20282469pgf.188.1618989640455; Wed, 21 Apr 2021 00:20:40 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:39 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 5/8] v4l2-info: remove a strange sizeof usage Date: Wed, 21 Apr 2021 00:20:32 -0700 Message-Id: <20210421072035.4188497-5-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210421072035.4188497-1-rosenp@gmail.com> References: <20210421072035.4188497-1-rosenp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The array has a nullptr and 0 member for some reason. Remove and convert loop to a for range one. Signed-off-by: Rosen Penev --- utils/common/v4l2-info.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp index cb3cb91f7..0359cf137 100644 --- a/utils/common/v4l2-info.cpp +++ b/utils/common/v4l2-info.cpp @@ -3,6 +3,8 @@ * Copyright 2018 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include + #include static std::string num2s(unsigned num, bool is_hex = true) @@ -411,21 +413,20 @@ std::string mbus2s(unsigned flags, bool is_hsv) return flags2s(flags, mbus_ycbcr_def); } -static const flag_def selection_targets_def[] = { - { V4L2_SEL_TGT_CROP_ACTIVE, "crop" }, - { V4L2_SEL_TGT_CROP_DEFAULT, "crop_default" }, - { V4L2_SEL_TGT_CROP_BOUNDS, "crop_bounds" }, - { V4L2_SEL_TGT_COMPOSE_ACTIVE, "compose" }, - { V4L2_SEL_TGT_COMPOSE_DEFAULT, "compose_default" }, - { V4L2_SEL_TGT_COMPOSE_BOUNDS, "compose_bounds" }, - { V4L2_SEL_TGT_COMPOSE_PADDED, "compose_padded" }, - { V4L2_SEL_TGT_NATIVE_SIZE, "native_size" }, - { 0, nullptr } +static constexpr std::array selection_targets_def{ + flag_def{ V4L2_SEL_TGT_CROP_ACTIVE, "crop" }, + flag_def{ V4L2_SEL_TGT_CROP_DEFAULT, "crop_default" }, + flag_def{ V4L2_SEL_TGT_CROP_BOUNDS, "crop_bounds" }, + flag_def{ V4L2_SEL_TGT_COMPOSE_ACTIVE, "compose" }, + flag_def{ V4L2_SEL_TGT_COMPOSE_DEFAULT, "compose_default" }, + flag_def{ V4L2_SEL_TGT_COMPOSE_BOUNDS, "compose_bounds" }, + flag_def{ V4L2_SEL_TGT_COMPOSE_PADDED, "compose_padded" }, + flag_def{ V4L2_SEL_TGT_NATIVE_SIZE, "native_size" }, }; bool valid_seltarget_at_idx(unsigned i) { - return i < sizeof(selection_targets_def) / sizeof(selection_targets_def[0]) - 1; + return i < selection_targets_def.size(); } unsigned seltarget_at_idx(unsigned i) @@ -437,13 +438,9 @@ unsigned seltarget_at_idx(unsigned i) std::string seltarget2s(__u32 target) { - int i = 0; - - while (selection_targets_def[i].str != nullptr) { - if (selection_targets_def[i].flag == target) - return selection_targets_def[i].str; - i++; - } + for (const auto &def : selection_targets_def) + if (def.flag == target) + return def.str; return std::string("Unknown (") + num2s(target) + ")"; } From patchwork Wed Apr 21 07:20:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA297C43460 for ; Wed, 21 Apr 2021 07:20:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7974461427 for ; Wed, 21 Apr 2021 07:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236731AbhDUHVP (ORCPT ); Wed, 21 Apr 2021 03:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235421AbhDUHVO (ORCPT ); Wed, 21 Apr 2021 03:21:14 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E573AC06138B for ; Wed, 21 Apr 2021 00:20:41 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id h20so21131375plr.4 for ; Wed, 21 Apr 2021 00:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=81mtl71VNVXeAc/LoEtGnqgE0rmQcWx1oL6lnTpYEFU=; b=QwG7E9c5A70MtmjERKJ5WBTNZFDnhROkoY3yRJjTbVcbrGfjMRdwfMFeXscQ9McdOd jIPkKkWq093RBWv+VGgLWSo2cjJZPnWcoDhR3a7GLD+2MrjUf05G7jfx6qjupNAMzjH+ qP8MK4N5z16LEpmr2VP0Bym0+6dlXhTqemm7CYTwGVwigVqWRUDrmIG6fm3x6yixweCy DOiHYjXYV5bjmYyVuh8+X9xpxawyZ7pA5l7Jaa81s3srHmY/Sg251Fdp5YD6Z0jgQ3v8 2b+ukt1TsIqWzi477ci3mPXpvWAC7HDpmeQI4K24M59Ck0aYPtOlvfD1geDx16u77cAL eO5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=81mtl71VNVXeAc/LoEtGnqgE0rmQcWx1oL6lnTpYEFU=; b=R8UdOQ43iovj+4QGpNOJHtyBkbA3GjK0DHY1qp32V4+/i8R987WAFAyZVRj1dk3AiU 6V2jbAXqllVp3cC6S0baRdMKYXZQlI4ssysfGvmw2oK67n/xuI+qqLFzAJmLFIhuYcU8 RYum3zHUYy1kZz+0ZuxwvyowAzfyX0Sd+/an3mfyHOsIL1xSXzgfmUrFqqzdMy5qPps1 CyFY6UYwLmgTUhPLyAqC1zCMCxxTilhpRD7hLTH5ZHEWnwF2T7N94wLT1wqKIqXYgh9K urplWdjp5/V3NLWEmQ26dRr+cGqNrIAQAYnwNK1f9x55Bsd1MkO/GmdFPmBn2WRClZDG nQLA== X-Gm-Message-State: AOAM533mUw+2A7I2HOilqWiTfBI+ZQs7GVxCj291NG8As2nLWqP1NtPi rAeuL8jfn/M9WGe0UZFKKgHDC0KFJQPeIg== X-Google-Smtp-Source: ABdhPJy1CKPfxPbcSR7ooV6VcAtd9vL1G058fdmjvZTMkosWtkKMQIb5sTx+8S/IL/avKn02tGeSvA== X-Received: by 2002:a17:902:8bcb:b029:ec:a192:21cf with SMTP id r11-20020a1709028bcbb02900eca19221cfmr16156239plo.71.1618989641246; Wed, 21 Apr 2021 00:20:41 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:40 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 6/8] v4l2-utils: turn fb_formats to constexpr array Date: Wed, 21 Apr 2021 00:20:33 -0700 Message-Id: <20210421072035.4188497-6-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210421072035.4188497-1-rosenp@gmail.com> References: <20210421072035.4188497-1-rosenp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Forces evaluation at compile time and allows usage of a for range loop. Signed-off-by: Rosen Penev --- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp index 09de70c85..639a41757 100644 --- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -121,16 +122,15 @@ struct bitfield2fmt { __u32 pixfmt; }; -static const struct bitfield2fmt fb_formats[] = { - { 10, 5, 5, 5, 0, 5, 15, 1, V4L2_PIX_FMT_ARGB555 }, - { 11, 5, 5, 6, 0, 5, 0, 0, V4L2_PIX_FMT_RGB565 }, - { 1, 5, 6, 5, 11, 5, 0, 1, V4L2_PIX_FMT_RGB555X }, - { 0, 5, 5, 6, 11, 5, 0, 0, V4L2_PIX_FMT_RGB565X }, - { 16, 8, 8, 8, 0, 8, 0, 0, V4L2_PIX_FMT_BGR24 }, - { 0, 8, 8, 8, 16, 8, 0, 0, V4L2_PIX_FMT_RGB24 }, - { 16, 8, 8, 8, 0, 8, 24, 8, V4L2_PIX_FMT_ABGR32 }, - { 8, 8, 16, 8, 24, 8, 0, 8, V4L2_PIX_FMT_ARGB32 }, - { } +static constexpr std::array fb_formats{ + bitfield2fmt{ 10, 5, 5, 5, 0, 5, 15, 1, V4L2_PIX_FMT_ARGB555 }, + bitfield2fmt{ 11, 5, 5, 6, 0, 5, 0, 0, V4L2_PIX_FMT_RGB565 }, + bitfield2fmt{ 1, 5, 6, 5, 11, 5, 0, 1, V4L2_PIX_FMT_RGB555X }, + bitfield2fmt{ 0, 5, 5, 6, 11, 5, 0, 0, V4L2_PIX_FMT_RGB565X }, + bitfield2fmt{ 16, 8, 8, 8, 0, 8, 0, 0, V4L2_PIX_FMT_BGR24 }, + bitfield2fmt{ 0, 8, 8, 8, 16, 8, 0, 0, V4L2_PIX_FMT_RGB24 }, + bitfield2fmt{ 16, 8, 8, 8, 0, 8, 24, 8, V4L2_PIX_FMT_ABGR32 }, + bitfield2fmt{ 8, 8, 16, 8, 24, 8, 0, 8, V4L2_PIX_FMT_ARGB32 }, }; static bool match_bitfield(const struct fb_bitfield &bf, unsigned off, unsigned len) @@ -182,9 +182,7 @@ static int fbuf_fill_from_fb(struct v4l2_framebuffer &fb, const char *fb_device) if (vi.bits_per_pixel == 8) fb.fmt.pixelformat = V4L2_PIX_FMT_GREY; } else { - for (int i = 0; fb_formats[i].pixfmt; i++) { - const struct bitfield2fmt &p = fb_formats[i]; - + for (const auto &p : fb_formats) { if (match_bitfield(vi.blue, p.blue_off, p.blue_len) && match_bitfield(vi.green, p.green_off, p.green_len) && match_bitfield(vi.red, p.red_off, p.red_len) && From patchwork Wed Apr 21 07:20:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 732D1C433ED for ; Wed, 21 Apr 2021 07:20:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57B9E61432 for ; Wed, 21 Apr 2021 07:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236756AbhDUHVQ (ORCPT ); Wed, 21 Apr 2021 03:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236727AbhDUHVP (ORCPT ); Wed, 21 Apr 2021 03:21:15 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EEB2C06174A for ; Wed, 21 Apr 2021 00:20:42 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id v13so7532003ple.9 for ; Wed, 21 Apr 2021 00:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=L9QNhOfkitg4jDlWiEN6PC85EXYAfGnClF8IkWPpAEc=; b=JtO5Rjwa8cbD+86EiUiucsmouoE4e1h48R9l9krY0A0ccAJjlU8MQ6GwLuS5FXS5Rd 4/JW0/I7nbt2E49KJvTyYmqHHLATL4zEOxRPGIEXtXlGpr8f4BIWVHNr/7VNZGcRgeO0 ZcqGVbogkXLHMgbhm3IV6Q/QqtJcZfxhmdAADJ4U4kHtISIpTMigqSwFV1iZ0/a6z0/3 SAEbzbu9pa0WX+tPu8oGNVo3WC91FFtqnM/zeNOGhSmRuQOw9fCUjyylUShFiQjhLnyG p/G/bRA55gPC94AC7ig7ZAV6jSZjntJMxrjqCC1fa+cnFOHwlhsSCDOJ6tBt2LuhTYHw VsTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L9QNhOfkitg4jDlWiEN6PC85EXYAfGnClF8IkWPpAEc=; b=MscTFaQoH2BJa5igXd+FV4NDAL8sBkva8KmM1Ibd0g3K3Weu/dp0r5wPAkuDYBje0P dEOI8dS/EKyJbhmZPAaQPuS5D45Wg/asZgOitm7NF1D7ODsvGqyazd5jFElu60ry7tAb siOAL/ZARdbn7T1QMLKKwkFoo0/08kHtRs4reBOHej7dakkdU7qutd+03wGC40esh4/7 xxdcy2yDYa8Vp1dERFdrqTUpOmQ+iXCKIOjgzBaBJxS9cjOmI3GINW1aBIVYa/ySHGXk O8SWqXV8+JA5I0j/CmjW5+9ZXmYQ+oNjBh18cDx6jy5VWl/9oCFcfSeMuANtwVfTvKRS ntQQ== X-Gm-Message-State: AOAM532vMmacMxD6EEecECJhUsjcmAyQW0ZK5p2+nlh/a+WcE9rxCzZB vhDU642dWdBBNq7tZc4zKjMBnTS0v0q+pA== X-Google-Smtp-Source: ABdhPJwNVyEHbvFCHMgjGMgAlaUgy0mO4EgOWZBUy3Ku0Wub67Czc9o3Amjv0kkg9sOpI/mTmoKsAA== X-Received: by 2002:a17:902:6b81:b029:ea:dcc5:b841 with SMTP id p1-20020a1709026b81b02900eadcc5b841mr32379710plk.29.1618989641991; Wed, 21 Apr 2021 00:20:41 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:41 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 7/8] v4l2-utils: turn mbus_names into const vector Date: Wed, 21 Apr 2021 00:20:34 -0700 Message-Id: <20210421072035.4188497-7-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210421072035.4188497-1-rosenp@gmail.com> References: <20210421072035.4188497-1-rosenp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Allows usage of a more standard for loop. Signed-off-by: Rosen Penev --- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp index d0f391bba..f2be9442c 100644 --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp @@ -1,3 +1,5 @@ +#include + #include "v4l2-ctl.h" struct mbus_name { @@ -5,10 +7,9 @@ struct mbus_name { __u32 code; }; -static struct mbus_name mbus_names[] = { +static const std::vector mbus_names{ { "Fixed", MEDIA_BUS_FMT_FIXED }, #include "media-bus-format-names.h" - { nullptr, 0 } }; /* selection specified */ @@ -343,9 +344,9 @@ static void print_framefmt(const struct v4l2_mbus_framefmt &fmt) { __u32 colsp = fmt.colorspace; __u32 ycbcr_enc = fmt.ycbcr_enc; - unsigned int i; + size_t i; - for (i = 0; mbus_names[i].name; i++) + for (i = 0; i < mbus_names.size(); i++) if (mbus_names[i].code == fmt.code) break; printf("\tWidth/Height : %u/%u\n", fmt.width, fmt.height); @@ -554,9 +555,9 @@ void subdev_get(cv4l_fd &_fd) static void print_mbus_code(__u32 code) { - unsigned int i; + size_t i; - for (i = 0; mbus_names[i].name; i++) + for (i = 0; i < mbus_names.size(); i++) if (mbus_names[i].code == code) break; if (mbus_names[i].name) @@ -568,9 +569,8 @@ static void print_mbus_code(__u32 code) static void print_mbus_codes(int fd, __u32 pad) { - struct v4l2_subdev_mbus_code_enum mbus_code; + struct v4l2_subdev_mbus_code_enum mbus_code = {}; - memset(&mbus_code, 0, sizeof(mbus_code)); mbus_code.pad = pad; mbus_code.which = V4L2_SUBDEV_FORMAT_TRY; From patchwork Wed Apr 21 07:20:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 12215605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2137FC43460 for ; Wed, 21 Apr 2021 07:20:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 019FD6142D for ; Wed, 21 Apr 2021 07:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236763AbhDUHVR (ORCPT ); Wed, 21 Apr 2021 03:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235548AbhDUHVP (ORCPT ); Wed, 21 Apr 2021 03:21:15 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62EEEC06174A for ; Wed, 21 Apr 2021 00:20:43 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id b17so28927993pgh.7 for ; Wed, 21 Apr 2021 00:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=K+OhM81Oh238gSow0sGcpWOkJq4Dr+zbW6YcgC1WmZU=; b=jvKAQ9WI5gzPbVRy0tN98LGUiC17QBkVnKEqV8XMSXO5IF0oQ6EUTSxDtYmJG3Gvqz M1spPGmeKGuZOdlwInoKVS7ymT10AHWvyXZ1IdhznTNcnxOzOqedLQVmxIvQ8WUUo611 BRhCaPF+Um/pa7Jd/PqEFnVOKfpaj8JZRu4E5uooNYobJOg2RZV3fXvDsDxNyt0uL7pJ ZAx3FvVuR+1hp61XFXBsnmVxXBU3DyZ093B3iXtp/vwAQx/ICMU/zJgG3n1bTpGsv/ki LyTQkqkhAVmw+Uoa/0IWizWOhiFgwm+xZCc3GkXwAByPVMPY7BqxTIe7wSF+AXpr5F3m lrOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K+OhM81Oh238gSow0sGcpWOkJq4Dr+zbW6YcgC1WmZU=; b=ZMCzAe2P0qaUZgdF1T4iwHa0Y6Uum6ogU+1HHkd6213soHthRWQgR2dpHaTZ8FTKDn /LFOcmH+ca4qO3jwy5Ue1T1sFZC2ADSehAP/R1ZX/hcAiXx5syJid2H77q/uWTT3p5S4 pjOYJqJQO/aDrKtCRD/S6N6ttQNT6mNIKl5jSe8yRwtew01PqDTLRmpkf/PQ9w4kGfJh WXOHunehtyqYZZxw5O8twRpOoYJrN0b3Z/wybpRO+uk7KFBusBbYBvN5HW99a7ZxzOYr uJ4sAjXNKw2HVJvZsulGBq79jf964pDUOO5+xVUHgl7fwfSLHrCZAiru+iks40jHtBSm 75sQ== X-Gm-Message-State: AOAM533Vd+yI841M7yOHtsmnMhUpGMCUVYljBNL8XTgMAAWsuVVK9xyL tuhegqo4GIz7SbZ/qY559VKVWV4k+WhdJw== X-Google-Smtp-Source: ABdhPJwz8G3KFOQKozbxuZQBatdF7tCfP5YYeDOW9BkSYWoLNn8Ostvornu//3E9eKhuez/U5S6jFw== X-Received: by 2002:a17:90a:1c02:: with SMTP id s2mr9253080pjs.17.1618989642739; Wed, 21 Apr 2021 00:20:42 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id p10sm907815pfo.210.2021.04.21.00.20.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 00:20:42 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 8/8] v4l2-utils: turn prefixes to a constexpr array Date: Wed, 21 Apr 2021 00:20:35 -0700 Message-Id: <20210421072035.4188497-8-rosenp@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210421072035.4188497-1-rosenp@gmail.com> References: <20210421072035.4188497-1-rosenp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Allows usage of a single any_of instead of a raw loop. Signed-off-by: Rosen Penev --- utils/v4l2-ctl/v4l2-ctl-common.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index 17ad488dd..2b6dd6d13 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -116,28 +116,14 @@ void common_usage() ); } -static const char *prefixes[] = { - "video", - "radio", - "vbi", - "swradio", - "v4l-subdev", - "v4l-touch", - "media", - nullptr +static constexpr std::array prefixes{ + "video", "radio", "vbi", "swradio", "v4l-subdev", "v4l-touch", "media", }; static bool is_v4l_dev(const char *name) { - for (unsigned i = 0; prefixes[i]; i++) { - unsigned l = strlen(prefixes[i]); - - if (!memcmp(name, prefixes[i], l)) { - if (isdigit(name[l])) - return true; - } - } - return false; + return std::any_of(prefixes.begin(), prefixes.end(), + [=](const char *prefix) { return !strcmp(name, prefix) && isdigit(name[strlen(prefix)]); }); } static int calc_node_val(const char *s) @@ -146,7 +132,7 @@ static int calc_node_val(const char *s) s = std::strrchr(s, '/') + 1; - for (unsigned i = 0; prefixes[i]; i++) { + for (size_t i = 0; i < prefixes.size(); i++) { unsigned l = strlen(prefixes[i]); if (!memcmp(s, prefixes[i], l)) {