From patchwork Tue Feb 14 12:14:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 18284 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id DD946BDB1C for ; Tue, 14 Feb 2023 12:16:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD6ED625F4; Tue, 14 Feb 2023 13:16:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1676376968; bh=jkW/HKMRB0WHC8FJ1K3xkUjpTeCPNBeurYvn+0k1bKs=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=HwYxWmLvGvGxoRANqzra2+5f6mjvxWr2WNS3H2f/FCYGqtd6n/xNxsOdcLeHho3Wl jF+4dJEQd4XuCTPxVGVqy/4nX2mhEGLyjN4rsevHPRgH+Z2WpW7fzIDdp79UXTktrO fwwaMWwYXQAx28h9XfVEpX5cBEv+Qowb0vCPHJ0xsS44smTXQAaIQJH36AV3alZrCw ZdYO8oNyOgF8fFlUjvi0M4WNInvHYWaRiIrsNEgY/QJdImdwPFEWXvn5V8MGEmqzuD PphspGnjFBBQtgY6Jt+zsKYkbeiO8fFtA3JOPsOeDe8kt/cL9RfbzXgeQJuzBAh/TI 5BdjZxClpomWQ== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 53730625DF for ; Tue, 14 Feb 2023 13:16:07 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="akSHG4BF"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676376966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rss/3iY3yquhKZM8hl8/PDAH4cQ5H8vUwXboU/osCH4=; b=akSHG4BFW2KCQrbuSHhwp+AngHdwJt7TWFGN92BSExPS8eOA2KoqjT6qJiBbcyG376Fw3G IXKvltkpl/Z8yH7xZUSWLYSYAcfX6h6QxP5pJIbLEkc3jKB98rj7p9GkTElYeiPbPd6qpi HXboTdPPtaP6EvvWFrFvc/8uovhrOqk= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-225-CnKgllymPlG5rSQNGvpJcA-1; Tue, 14 Feb 2023 07:16:05 -0500 X-MC-Unique: CnKgllymPlG5rSQNGvpJcA-1 Received: by mail-wm1-f70.google.com with SMTP id l38-20020a05600c1d2600b003ddff4b9a40so8545259wms.9 for ; Tue, 14 Feb 2023 04:16:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rss/3iY3yquhKZM8hl8/PDAH4cQ5H8vUwXboU/osCH4=; b=7qKKeV7DWbka8UToLi04/zuMXCWPfIaCKX082mKeycbL/08QKJwQ9FPYwHHGEdh5xH bMIwYZHJMtbfH0O1bfgfYcqIOczPA14ODVS2tIfqfzeMcXxTtFuM26iP8Uwzv1pGUCO2 L2klXHvneyfG2p5yegVq9yNZyTU/zMh/81BT7rZ785/qVPNuon8DfHVyuiGB4Aj0gswO vTLkZbVjjSXnELc7equ/uQb32cvy0rAc7kWg1de67LBGHg29LOtvEbrm7XM6vmdcoupY qOkmtfVbp+sg+Lyu2MHQkRiBhbhvHlqQ1F/PGyYEk8bPYwpLukAZZ8eDfEhVAxsUEo6u 8SoA== X-Gm-Message-State: AO0yUKXeXgvsjqVuWFOjZSKQ/rvT0bIurveZWKDaiiRhwEXva+u1fCkn wJsTBB0i52plLRTPrge1AQgCLCAPbcf+Fh4K4XSvm43/XBFvxRWBg6+uB4pJZYU+TtAK+LisS1E URnPi//pNfvxsXTCXIfO1n20ftBsrRmtMueOIQi704GJ73+50exISnUmUhXQ/7Q9dPQP62aM/Zr 4DsubQckEW1B4vK8QOvEA= X-Received: by 2002:a7b:cbd2:0:b0:3da:fc30:bfc5 with SMTP id n18-20020a7bcbd2000000b003dafc30bfc5mr1818346wmi.13.1676376963718; Tue, 14 Feb 2023 04:16:03 -0800 (PST) X-Google-Smtp-Source: AK7set94pFN24eajt+loix69QMSKIsDnTQhZleNTH+tyBuEj4G9ZulvplWioQ3Ks/JT6G971hI78UQ== X-Received: by 2002:a7b:cbd2:0:b0:3da:fc30:bfc5 with SMTP id n18-20020a7bcbd2000000b003dafc30bfc5mr1818326wmi.13.1676376963384; Tue, 14 Feb 2023 04:16:03 -0800 (PST) Received: from localhost.localdomain ([2001:bb6:963d:9e00:7585:fe90:1658:512f]) by smtp.gmail.com with ESMTPSA id he7-20020a05600c540700b003e1f6e18c95sm1481898wmb.21.2023.02.14.04.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 04:16:02 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 14 Feb 2023 12:14:49 +0000 Message-Id: <20230214121448.54918-1-ecurtin@redhat.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following errors with gcc-13 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Curtin via libcamera-devel From: Eric Curtin Reply-To: Eric Curtin Cc: Khem Raj , wtaymans@redhat.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" ../git/src/cam/file_sink.cpp:92:45: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 92 | const FrameMetadata::Plane &meta = buffer->metadata().planes()[i]; | ^~~~ ../git/src/cam/file_sink.cpp:92:81: note: the temporary was destroyed at the end of the full expression '(& buffer->libcamera::FrameBuffer::metadata())->libcamera::FrameMetadata::planes().libcamera::Span::operator[](i)' 92 | const FrameMetadata::Plane &meta = buffer->metadata().planes()[i]; | ^ cc1plus: all warnings being treated as errors Co-developed-by: Khem Raj Signed-off-by: Eric Curtin Reviewed-by: Kieran Bingham --- Changes in v2: - Added const - Made patch mergeable by accounting for new directory structure --- src/apps/cam/file_sink.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/apps/cam/file_sink.cpp b/src/apps/cam/file_sink.cpp index b32aad24..d41569c9 100644 --- a/src/apps/cam/file_sink.cpp +++ b/src/apps/cam/file_sink.cpp @@ -114,13 +114,12 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer, } for (unsigned int i = 0; i < buffer->planes().size(); ++i) { - const FrameMetadata::Plane &meta = buffer->metadata().planes()[i]; - + const unsigned int bytesused = buffer->metadata().planes()[i].bytesused; Span data = image->data(i); - unsigned int length = std::min(meta.bytesused, data.size()); + const unsigned int length = std::min(bytesused, data.size()); - if (meta.bytesused > data.size()) - std::cerr << "payload size " << meta.bytesused + if (bytesused > data.size()) + std::cerr << "payload size " << bytesused << " larger than plane size " << data.size() << std::endl;