From patchwork Mon Feb 20 04:55:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 18287 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 A4AA5BDCBF for ; Mon, 20 Feb 2023 04:58:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B785962605; Mon, 20 Feb 2023 05:58:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1676869096; bh=rz+vBPGv2sY+xaFwrP7wed7D1St4rOkRoYm0Al1q6Gk=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=0KqD+/KjUmJXjiK+icv77Xe2T2uWT70Py+WO1/v2uQRN8ka6/zxgnifWmwu8MJXhy D7X/bUS2q3K5Fsz/l6n1tiJyEwoUeHqZEKpLfaYKAKEG1E6vfB6J83kLaiV5y9A/s8 mFsBAMEPDkpWUq2gCwXYcQ+sE7ukVjorKsDh5ohrSSfqUYyJz8J7NoVC6uHIGb0WJl O9VCAejHWFPrzM0Mk91NTs8JdnLzixRtv+0fOi+SbrhD+VRYP3wbVwJyPT+Vu6Q7Ig qf9HmYYzzZIPCxz1ZlzQ1f+Wtk3kb2GZZfv2MOs01KxCD4emmcd9eIMbxduiMAfuCw ZZRQM4kB+okbg== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B34DB61EE3 for ; Mon, 20 Feb 2023 05:58:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="PiHNqhOu"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676869092; 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=P6f4qRJQKx0cJfK+V7sX1xIizszDgS31+8N2Nc2zU0Y=; b=PiHNqhOuIlzqeNSMw47ia/AVmAa28Osr1BPLXEUd1h66inJPA6uLUtT6qY0qYThuRzDpl0 y/HodvOlNXoP1j6Spj3xZbNsg5cdX+DUFNaUePjoQBQfm7vHo4VSyNS8lZzZMfbglOrlha eeXRWjwiG4003hgyr2E1bAdxbu5atRs= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-192-Q0Xcf0daPLWY78kc9XvGYw-1; Sun, 19 Feb 2023 23:58:11 -0500 X-MC-Unique: Q0Xcf0daPLWY78kc9XvGYw-1 Received: by mail-wm1-f72.google.com with SMTP id j7-20020a05600c1c0700b003dc5dd44c0cso56688wms.8 for ; Sun, 19 Feb 2023 20:58:10 -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=P6f4qRJQKx0cJfK+V7sX1xIizszDgS31+8N2Nc2zU0Y=; b=PUFr1O0JkHha3nyituseDwBdX605dZ5QaWqYIHUcyj3yMmZubVep7FjImF0LPIR2Bt gEDAHifWsAk6DH4IeiMN9jaRHUIkg/3icdpI1aTz6LyFNVSOSmikhhAKfazluOTKmf73 Xz6p1M63JRwvkIXxDdOrt0VeTOIrj2bGna6s6EIUWtZA/LRuRX8KAURab6f1+fQQnYxF /QMoHsN8DHdIAdCuv1qq2GVxIh2rXrtXEesbw8SiyN6Js2/CNa545kYTsi8p27fR29zL D3+O6iLyIZpuR/+t6oys/hEyIhJ9vh7QSwG9xyWc0WYJAFUzktfmRM10C60OigN+kesp KHGg== X-Gm-Message-State: AO0yUKX/bmgPJ4h7husYVw9/zek72mAbEjO9nzxBA8kyCPz8qahhmFRM UHux9iH6uNeBPV0+t1bFoPQsr74L530+5vG8joX8HUygUGW/iadXxcsdg13zipKpwtMm/a3Sxcj mZQXhOq5oliBRj0UPeVpM8Q7xj31AauT9mcz1n4aaHIpLs3NevJs4IoL+VniGJMV6VJUCx3upsy NS8BMNlHWIK+QCKkXj X-Received: by 2002:a05:600c:2ed2:b0:3e0:e77:3056 with SMTP id q18-20020a05600c2ed200b003e00e773056mr5211930wmn.30.1676869089764; Sun, 19 Feb 2023 20:58:09 -0800 (PST) X-Google-Smtp-Source: AK7set9EIsOrDswotPufTeyjOOdKmhOAJQ5SUl3Y9wVweAEp0/qXSGCJ+cwfLrBewCDaIM7LWn8oNQ== X-Received: by 2002:a05:600c:2ed2:b0:3e0:e77:3056 with SMTP id q18-20020a05600c2ed200b003e00e773056mr5211913wmn.30.1676869089390; Sun, 19 Feb 2023 20:58:09 -0800 (PST) Received: from p1.. ([94.201.248.122]) by smtp.gmail.com with ESMTPSA id 12-20020a05600c020c00b003dc3f3d77e3sm12900812wmi.7.2023.02.19.20.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 20:58:09 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Feb 2023 04:55:24 +0000 Message-Id: <20230220045523.3884-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 v3] 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 v3: - Added comment explaining change made because of false negative in gcc Changes in v2: - Added const - Made patch mergeable by accounting for new directory structure --- src/apps/cam/file_sink.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/apps/cam/file_sink.cpp b/src/apps/cam/file_sink.cpp index b32aad24..01846cdb 100644 --- a/src/apps/cam/file_sink.cpp +++ b/src/apps/cam/file_sink.cpp @@ -114,13 +114,17 @@ 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]; - + /* + * formerly "const FrameMetadata::Plane &" + * causing false negative (gcc 13): + * "possibly dangling reference to a temporary" + */ + 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;