| Message ID | 20200608152202.5876-1-email@uajain.com |
|---|---|
| State | Accepted |
| Commit | 313d65ca2545534bba369331068bb57e65ac9318 |
| Headers | show |
| Series |
|
| Related | show |
Hi Umang, On 08/06/2020 16:22, Umang Jain wrote: > The hex stream output helper was introduced in f391048a7b98 ("libcamera: utils: > Add hex stream output helper"). It simplifies writing hexadecimal values to an That's the right way to reference another commit... > 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") But this patch doesn't 'fix' f391048a, in that this wasn't an issue introduced by that patch. I can just remove this tag when applying though, thanks. -- Kieran > Reported-by: Coverity CID=279058 > Signed-off-by: Umang Jain <email@uajain.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > 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 <iomanip> > #include <iostream> > #include <vector> > > #include <libcamera/geometry.h> > > +#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; >
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 <iomanip> #include <iostream> #include <vector> #include <libcamera/geometry.h> +#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;
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 <email@uajain.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- test/v4l2_subdevice/list_formats.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)