{"id":23468,"url":"https://patchwork.libcamera.org/api/1.1/patches/23468/?format=json","web_url":"https://patchwork.libcamera.org/patch/23468/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250604130741.9228-8-laurent.pinchart@ideasonboard.com>","date":"2025-06-04T13:07:41","name":"[v2,7/7] gstreamer: Replace NULL with nullptr","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"48e0ed01f0f4fe94fab36f3e75f4b25fcd3812af","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23468/mbox/","series":[{"id":5204,"url":"https://patchwork.libcamera.org/api/1.1/series/5204/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5204","date":"2025-06-04T13:07:34","name":"gstreamer: Miscellaneous cleanups + two fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/5204/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23468/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23468/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 8B02EC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Jun 2025 13:08:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 83D4368DCC;\n\tWed,  4 Jun 2025 15:08:07 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2100068DC4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Jun 2025 15:08:01 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 148B9E9B;\n\tWed,  4 Jun 2025 15:07:58 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AHP5W7Wc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749042478;\n\tbh=ngJzRp2goVAmlgmuUmxkDuVfDCLV776dIXKMxzo4xI8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=AHP5W7Wcd6n++H4ZamyNMtcSarZjLAdZmtLFB+Ak6VxwKCKbvSGolGp3YqCTpoYIP\n\tBftRM/dZ8Ejbq8HsMqEQZpGe7Evwf1pumDc9V9/rzznhZ2+sPgEuObnpPBARzH8phh\n\tWLVRIB1Supuyulkw2RTHUN+B4+4tRkzT67KyTaN0=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Hou Qi <qi.hou@nxp.com>,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>","Subject":"[PATCH v2 7/7] gstreamer: Replace NULL with nullptr","Date":"Wed,  4 Jun 2025 16:07:41 +0300","Message-ID":"<20250604130741.9228-8-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.49.0","In-Reply-To":"<20250604130741.9228-1-laurent.pinchart@ideasonboard.com>","References":"<20250604130741.9228-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","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":"Usage of NULL has slowly crept in the libcamerasrc sources. Replace it\nwith nullptr.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/gstreamer/gstlibcamera-controls.cpp.in |  2 +-\n src/gstreamer/gstlibcamerapad.cpp          |  2 +-\n src/gstreamer/gstlibcamerasrc.cpp          | 23 +++++++++++-----------\n 3 files changed, 14 insertions(+), 13 deletions(-)","diff":"diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in\nindex 89c530da0b4a..2a16b39a93d9 100644\n--- a/src/gstreamer/gstlibcamera-controls.cpp.in\n+++ b/src/gstreamer/gstlibcamera-controls.cpp.in\n@@ -68,7 +68,7 @@ static const GEnumValue {{ ctrl.name|snake_case }}_types[] = {\n \t\t\"{{ enum.gst_name }}\"\n \t},\n {%- endfor %}\n-\t{0, NULL, NULL}\n+\t{0, nullptr, nullptr}\n };\n \n #define TYPE_{{ ctrl.name|snake_case|upper }} \\\ndiff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp\nindex 3bc2bc87e773..81a0ef44cc6f 100644\n--- a/src/gstreamer/gstlibcamerapad.cpp\n+++ b/src/gstreamer/gstlibcamerapad.cpp\n@@ -102,7 +102,7 @@ gst_libcamera_stream_role_get_type()\n \t\t\t\"libcamera::Viewfinder\",\n \t\t\t\"view-finder\",\n \t\t},\n-\t\t{ 0, NULL, NULL }\n+\t\t{ 0, nullptr, nullptr }\n \t};\n \n \tif (!type)\ndiff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex eec8163e88e7..16b1d08b3053 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -367,10 +367,10 @@ int GstLibcameraSrcState::processRequest()\n \n \t\tif (video_pool) {\n \t\t\t/* Only set video pool when a copy is needed. */\n-\t\t\tGstBuffer *copy = NULL;\n+\t\t\tGstBuffer *copy = nullptr;\n \t\t\tconst GstVideoInfo info = gst_libcamera_pad_get_video_info(srcpad);\n \n-\t\t\tret = gst_buffer_pool_acquire_buffer(video_pool, &copy, NULL);\n+\t\t\tret = gst_buffer_pool_acquire_buffer(video_pool, &copy, nullptr);\n \t\t\tif (ret != GST_FLOW_OK) {\n \t\t\t\tgst_buffer_unref(buffer);\n \t\t\t\tGST_ELEMENT_ERROR(src_, RESOURCE, SETTINGS,\n@@ -541,8 +541,8 @@ static std::tuple<GstBufferPool *, int>\n gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,\n \t\t\t\tGstCaps *caps, const GstVideoInfo *info)\n {\n-\tg_autoptr(GstQuery) query = NULL;\n-\tg_autoptr(GstBufferPool) pool = NULL;\n+\tg_autoptr(GstQuery) query = nullptr;\n+\tg_autoptr(GstBufferPool) pool = nullptr;\n \tconst gboolean need_pool = true;\n \n \t/*\n@@ -554,8 +554,8 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,\n \n \tif (!gst_pad_peer_query(srcpad, query))\n \t\tGST_DEBUG_OBJECT(self, \"Didn't get downstream ALLOCATION hints\");\n-\telse if (gst_query_find_allocation_meta(query, GST_VIDEO_META_API_TYPE, NULL))\n-\t\treturn { NULL, 0 };\n+\telse if (gst_query_find_allocation_meta(query, GST_VIDEO_META_API_TYPE, nullptr))\n+\t\treturn { nullptr, 0 };\n \n \tGST_WARNING_OBJECT(self, \"Downstream doesn't support video meta, need to copy frame.\");\n \n@@ -564,7 +564,8 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,\n \t * create a new pool.\n \t */\n \tif (gst_query_get_n_allocation_pools(query) > 0)\n-\t\tgst_query_parse_nth_allocation_pool(query, 0, &pool, NULL, NULL, NULL);\n+\t\tgst_query_parse_nth_allocation_pool(query, 0, &pool, nullptr,\n+\t\t\t\t\t\t    nullptr, nullptr);\n \n \tif (!pool) {\n \t\tGstStructure *config;\n@@ -583,7 +584,7 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,\n \t\tGST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,\n \t\t\t\t  (\"Failed to active buffer pool\"),\n \t\t\t\t  (\"gst_libcamera_src_negotiate() failed.\"));\n-\t\treturn { NULL, -EINVAL };\n+\t\treturn { nullptr, -EINVAL };\n \t}\n \n \treturn { reinterpret_cast<GstBufferPool *>(g_steal_pointer(&pool)), 0 };\n@@ -660,7 +661,7 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n \tfor (gsize i = 0; i < state->srcpads_.size(); i++) {\n \t\tGstPad *srcpad = state->srcpads_[i];\n \t\tconst StreamConfiguration &stream_cfg = state->config_->at(i);\n-\t\tGstBufferPool *video_pool = NULL;\n+\t\tGstBufferPool *video_pool = nullptr;\n \t\tGstVideoInfo info;\n \n \t\tg_autoptr(GstCaps) caps = gst_libcamera_stream_configuration_to_caps(stream_cfg, transfer[i]);\n@@ -1065,7 +1066,7 @@ gst_libcamera_src_request_new_pad(GstElement *element, GstPadTemplate *templ,\n \t\t\t\t  const gchar *name, [[maybe_unused]] const GstCaps *caps)\n {\n \tGstLibcameraSrc *self = GST_LIBCAMERA_SRC(element);\n-\tg_autoptr(GstPad) pad = NULL;\n+\tg_autoptr(GstPad) pad = nullptr;\n \n \tGST_DEBUG_OBJECT(self, \"new request pad created\");\n \n@@ -1079,7 +1080,7 @@ gst_libcamera_src_request_new_pad(GstElement *element, GstPadTemplate *templ,\n \t\tGST_ELEMENT_ERROR(element, STREAM, FAILED,\n \t\t\t\t  (\"Internal data stream error.\"),\n \t\t\t\t  (\"Could not add pad to element\"));\n-\t\treturn NULL;\n+\t\treturn nullptr;\n \t}\n \n \tgst_child_proxy_child_added(GST_CHILD_PROXY(self), G_OBJECT(pad), GST_OBJECT_NAME(pad));\n","prefixes":["v2","7/7"]}