[libcamera-devel] [PATCH 1/3] test: camera: Remove redundant call of std::string::c_str()

Marvin Schmidt marvin.schmidt1987 at gmail.com
Mon Aug 29 20:58:47 CEST 2022


libcamera::File::exists() takes a const reference to a std::string and
clang-tidy's readability-redundant-string-cstr check warns about it:

> ../test/camera/camera_reconfigure.cpp:182:21: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
>                         if (File::exists(pname.c_str())) {
>                                          ^~~~~~~~~~~~~
>                                          pname

Signed-off-by: Marvin Schmidt <marvin.schmidt1987 at gmail.com>
---
 test/camera/camera_reconfigure.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/camera/camera_reconfigure.cpp b/test/camera/camera_reconfigure.cpp
index f6076baa..d12e2413 100644
--- a/test/camera/camera_reconfigure.cpp
+++ b/test/camera/camera_reconfigure.cpp
@@ -179,7 +179,7 @@ private:
 				continue;
 
 			string pname("/proc/" + string(ptr->d_name) + "/comm");
-			if (File::exists(pname.c_str())) {
+			if (File::exists(pname)) {
 				ifstream pfile(pname.c_str());
 				string comm;
 				getline(pfile, comm);
-- 
2.37.2



More information about the libcamera-devel mailing list