From patchwork Mon Jun 8 15:22:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3994 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 38FFE603C5 for ; Mon, 8 Jun 2020 17:22:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="tBvFcBuj"; 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=VwQ6/Q2g383+ErzqF5PW50gXSkTev9Dem7OuFL9KUlc=; b=tBvFcBujvZr1RvzoE04bbGkeOl2YwMJsqVsx1Zj8fouc3MUpiUitCYQP91/BOi0vCdmN oifuDOvBizLubO/5W29Vud67Iy/8K1dFKAsJeAV1febvs6aw5J3Q/MhftZ/nznSkdNa84i NMsZ0+1Nj/Ai+Kc+n9B55r2D9TiN2KmZM= Received: by filter0072p3las1.sendgrid.net with SMTP id filter0072p3las1-16738-5EDE57A1-192 2020-06-08 15:22:10.096468264 +0000 UTC m=+489557.898165555 Received: from mail.uajain.com (unknown) by ismtpd0006p1hnd1.sendgrid.net (SG) with ESMTP id -2T_qH9rQcWPMFslfW7rKA Mon, 08 Jun 2020 15:22:09.642 +0000 (UTC) From: Umang Jain Date: Mon, 08 Jun 2020 15:22:10 +0000 (UTC) Message-Id: <20200608152202.5876-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcIQ89AvAiYjJmgYkN1WcnPb0WM4+w+LgMup123cR1wvxSuR2JaLxXoPW4uMd+FnmH4e1ETkJsQeSYKXHIVLC5cLBWm8fc15l2LBKP7zPp+mOReKELopOjSjoEixlqGQNJDDz5xtcGNrd2do0wV40YdlMucSl1lSxjuqupGXFhNOIX2TsOC2kwGzLtO0IST+qg To: libcamera-devel@lists.libcamera.org, laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com 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 15:22:12 -0000 The hex stream output helper was introduced in f391048a7b98 ("libcamera: utils: Add hex stream output helper"). It simplifies writing hexadecimal values to an ostream which can be used 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. Fixes: f391048a7b98 ("libcamera: utils: Add hex stream output helper") 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;