[PATCH 2/3] utils: switch strstr to std variant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



strstr has const overloads in std, avoiding pointless conversions.

Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
 utils/libcecutil/cec-log.cpp       | 2 +-
 utils/v4l2-ctl/v4l2-ctl-common.cpp | 4 ++--
 utils/v4l2-ctl/v4l2-ctl-misc.cpp   | 6 +++---
 utils/v4l2-dbg/v4l2-dbg.cpp        | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp
index 9410c071..0dcb4675 100644
--- a/utils/libcecutil/cec-log.cpp
+++ b/utils/libcecutil/cec-log.cpp
@@ -62,7 +62,7 @@ static void log_arg(const struct cec_arg *arg, const char *arg_name, __u32 val)
 		}
 		return;
 	case CEC_ARG_TYPE_U16:
-		if (strstr(arg_name, "phys-addr"))
+		if (std::strstr(arg_name, "phys-addr"))
 			printf("\t%s: %x.%x.%x.%x\n", arg_name, cec_phys_addr_exp(val));
 		else
 			printf("\t%s: %u (0x%04x)\n", arg_name, val, val);
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 47f5da1a..0640a521 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -1190,13 +1190,13 @@ void common_get(cv4l_fd &_fd)
 				char *q;
 
 				buf[len] = 0;
-				while ((q = strstr(p, "START STATUS"))) {
+				while ((q = std::strstr(p, "START STATUS"))) {
 					p = q + 1;
 				}
 				if (p) {
 					while (p > buf && *p != '<') p--;
 					q = p;
-					while ((q = strstr(q, "<6>"))) {
+					while ((q = std::strstr(q, "<6>"))) {
 						memcpy(q, "   ", 3);
 					}
 					printf("%s", p);
diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
index 6db87568..deb481b4 100644
--- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
@@ -212,11 +212,11 @@ void misc_cmd(int ch, char *optarg)
 				jpegcomp.quality = strtol(value, 0L, 0);
 				break;
 			case 17:
-				if (strstr(value, "dht"))
+				if (std::strstr(value, "dht"))
 					jpegcomp.jpeg_markers |= V4L2_JPEG_MARKER_DHT;
-				if (strstr(value, "dqt"))
+				if (std::strstr(value, "dqt"))
 					jpegcomp.jpeg_markers |= V4L2_JPEG_MARKER_DQT;
-				if (strstr(value, "dri"))
+				if (std::strstr(value, "dri"))
 					jpegcomp.jpeg_markers |= V4L2_JPEG_MARKER_DRI;
 				break;
 			case 18:
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 86266376..06301ae0 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -784,14 +784,14 @@ list_done:
 				char *q;
 
 				buf[len] = 0;
-				while ((q = strstr(p, "START STATUS"))) {
+				while ((q = std::strstr(p, "START STATUS"))) {
 					found_status = true;
 					p = q + 1;
 				}
 				if (found_status) {
 					while (p > buf && *p != '<') p--;
 					q = p;
-					while ((q = strstr(q, "<6>"))) {
+					while ((q = std::strstr(q, "<6>"))) {
 						memcpy(q, "   ", 3);
 					}
 					printf("%s", p);
-- 
2.26.2




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux