Patch Detail
Show a patch.
GET /api/1.1/patches/19468/?format=api
{ "id": 19468, "url": "https://patchwork.libcamera.org/api/1.1/patches/19468/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19468/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20240124075604.2635498-1-paul.elder@ideasonboard.com>", "date": "2024-01-24T07:56:04", "name": "apps: common: dng_writer: Add a default case for switch-case on a modulo", "commit_ref": "64502c8d4a3c0f440bf265a5ad03be00653957ba", "pull_url": null, "state": "accepted", "archived": false, "hash": "7370b710a674b6ce3a49cf71cfb9c4a7cfc94d67", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19468/mbox/", "series": [ { "id": 4161, "url": "https://patchwork.libcamera.org/api/1.1/series/4161/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4161", "date": "2024-01-24T07:56:04", "name": "apps: common: dng_writer: Add a default case for switch-case on a modulo", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4161/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19468/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19468/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 99271C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Jan 2024 07:56:21 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AEC5462949;\n\tWed, 24 Jan 2024 08:56:20 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CE1A261D23\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jan 2024 08:56:18 +0100 (CET)", "from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp\n\t[175.177.49.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8C7A9BEB;\n\tWed, 24 Jan 2024 08:55:03 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mE4jJJzr\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1706082904;\n\tbh=yaxxWlCzAwmFr8go2TpRU7rt6eCC8e7ZUfjiOtqs61k=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=mE4jJJzrd2cA6k6pNe1fum4mgwVHzerI10eAvoJyTP9eaBvDnZEmAajFYZ7HhtprL\n\tPEMaJaMaRs24DOeRC4k8nJlJZAmi/I82v+NMn08uw6C0cXFSEV3rOvj1Vl5E4FjG79\n\t5fcraQoKIgRh8455cSwleChvV8zrnri5Py9nX4k4=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH] apps: common: dng_writer: Add a default case for switch-case\n\ton a modulo", "Date": "Wed, 24 Jan 2024 16:56:04 +0900", "Message-Id": "<20240124075604.2635498-1-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.39.2", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Clearly all cases in the switch are already satisfied, but some\ncompilers fail to realize this and spit out an error:\n\nCompiler version: gcc 11.2.0 \"aarch64-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.11) 11.2.0\"\n\n../../src/apps/common/dng_writer.cpp: In function ‘void thumbScanlineIPU3(const FormatInfo&, void*, const void*, unsigned int, unsigned int)’:\n../../src/apps/common/dng_writer.cpp:277:55: error: ‘val4’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;\n | ^~~~\n../../src/apps/common/dng_writer.cpp:277:48: error: ‘val3’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;\n | ^~~~\n../../src/apps/common/dng_writer.cpp:277:41: error: ‘val2’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;\n | ^~~~\n../../src/apps/common/dng_writer.cpp:277:34: error: ‘val1’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;\n | ^~~~\n\nAdd a default case for the switch-case on a modulo to silence this.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=207\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/apps/common/dng_writer.cpp | 1 +\n 1 file changed, 1 insertion(+)", "diff": "diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp\nindex c945edce7..82bc065a5 100644\n--- a/src/apps/common/dng_writer.cpp\n+++ b/src/apps/common/dng_writer.cpp\n@@ -248,6 +248,7 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output,\n \n \t\tuint16_t val1, val2, val3, val4;\n \t\tswitch (pixelInBlock % 4) {\n+\t\tdefault:\n \t\tcase 0:\n \t\t\tval1 = (in[1] & 0x03) << 14 | (in[0] & 0xff) << 6;\n \t\t\tval2 = (in[2] & 0x0f) << 12 | (in[1] & 0xfc) << 4;\n", "prefixes": [] }