From patchwork Mon Jun 8 13:24:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3986 Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9718561027 for ; Mon, 8 Jun 2020 15:24:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="bn0mlFJ3"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:mime-version:to:cc:content-transfer-encoding: content-type; s=s1; bh=UNBiLZAaaRgnb/+gkXesISEjpGhYdbe3uUVm6erhUU8=; b=bn0mlFJ3wMWK+X915tUIWucDFy1xO3zVwO3YoFtUpU3siieTcZCOtvhzJ6VgzbP1rra/ 8fDkAnN20Oi0gV6D7bePdQwCI8USnjITkFTgtRnzXsuDXSm3IZV9DI9ww9bHPfYv9SJt3S 4J+1p8uxA5uheyFKtjLLDpk6ttAap5hv4= Received: by filterdrecv-p3mdw1-6f5df8956d-n66lk with SMTP id filterdrecv-p3mdw1-6f5df8956d-n66lk-17-5EDE3BF2-E 2020-06-08 13:24:02.289788716 +0000 UTC m=+407407.655616022 Received: from mail.uajain.com (unknown) by ismtpd0003p1maa1.sendgrid.net (SG) with ESMTP id kMPHC9JaSuS_0VXAGU7PHQ for ; Mon, 08 Jun 2020 13:24:01.646 +0000 (UTC) From: Umang Jain Date: Mon, 08 Jun 2020 13:24:02 +0000 (UTC) Message-Id: <20200608132356.33328-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcp6CL6ozs3IeZvk96OtB41JBdNkBEV+sF3FeC3+sz9lPa/qnGitvKxJFBfaHZWyNY5XjJVJ5ZF/3Rgb+ZhiFkAnPSzB7ieen5dAZboT6+H4YsblOTm/n+cF2Dh4vf4TB4Sbh/ZTfpbfgn2TBMEWNNKJT/eQi88mHQ6tOcbSuzNV10qkla8IktgcVFdo82q09QL59hobR+CWxsAo/PWDAAYQ== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH] test: v4l2_subdevice: list_formats: Port to use utils::hex() output helper 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-List-Received-Date: Mon, 08 Jun 2020 13:24:06 -0000 The hex stream output helper was introduced in f391048a. It simplifies writing hexadecimal values to an ostream which can be used here in this test too. As the helper doesn't modify the stream configuration (refer to utils::hex() documentation), this eliminates the need of restoring the stream's format state as pointed out by the coverity scan. Reported-by: Coverity CID=279058 Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- test/v4l2_subdevice/list_formats.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp index 25503c3..a55af11 100644 --- a/test/v4l2_subdevice/list_formats.cpp +++ b/test/v4l2_subdevice/list_formats.cpp @@ -5,12 +5,12 @@ * libcamera V4L2 Subdevice format handling test */ -#include #include #include #include +#include "libcamera/internal/utils.h" #include "libcamera/internal/v4l2_subdevice.h" #include "v4l2_subdevice_test.h" @@ -36,8 +36,7 @@ void ListFormatsTest::printFormats(unsigned int pad, { cout << "Enumerate formats on pad " << pad << endl; for (const SizeRange &size : sizes) { - cout << " mbus code: 0x" << setfill('0') << setw(4) - << hex << code << endl; + cout << " mbus code: " << utils::hex(code, 4) << endl; cout << " min width: " << dec << size.min.width << endl; cout << " min height: " << dec << size.min.height << endl; cout << " max width: " << dec << size.max.width << endl;