@@ -3,10 +3,11 @@
* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*/
+#include <cstring>
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -1530,7 +1531,7 @@ void listTests()
int setExpectedResult(char *optarg, bool no_warnings)
{
- char *equal = strchr(optarg, '=');
+ char *equal = std::strchr(optarg, '=');
if (!equal || equal == optarg || !isdigit(equal[1]))
return 1;
@@ -3,10 +3,11 @@
* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*/
+#include <cstring>
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -1650,7 +1651,7 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt,
static int calc_node_val(const char *s)
{
- s = strrchr(s, '/') + 1;
+ s = std::strrchr(s, '/') + 1;
if (!memcmp(s, "cec", 3))
return atol(s + 3);
@@ -1917,7 +1918,7 @@ int main(int argc, char **argv)
case OptIgnore: {
bool all_la = !strncmp(optarg, "all", 3);
bool all_opcodes = true;
- const char *sep = strchr(optarg, ',');
+ const char *sep = std::strchr(optarg, ',');
unsigned la_mask = 0xffff, opcode, la = 0;
if (sep)
@@ -2068,7 +2069,7 @@ int main(int argc, char **argv)
size--;
break;
}
- value = strchr(value, ':');
+ value = std::strchr(value, ':');
if (value == NULL)
break;
value++;
@@ -2109,7 +2110,7 @@ int main(int argc, char **argv)
size--;
break;
}
- value = strchr(value, ':');
+ value = std::strchr(value, ':');
if (value == NULL)
break;
value++;
@@ -2150,7 +2151,7 @@ int main(int argc, char **argv)
size--;
break;
}
- value = strchr(value, ':');
+ value = std::strchr(value, ':');
if (value == NULL)
break;
value++;
@@ -2184,7 +2185,7 @@ int main(int argc, char **argv)
size--;
break;
}
- value = strchr(value, ':');
+ value = std::strchr(value, ':');
if (value == NULL)
break;
value++;
@@ -3,10 +3,11 @@
* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*/
+#include <cstring>
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -386,7 +387,7 @@ int main(int argc, char **argv)
case OptIgnore: {
bool all_la = !strncmp(optarg, "all", 3);
bool all_opcodes = true;
- const char *sep = strchr(optarg, ',');
+ const char *sep = std::strchr(optarg, ',');
unsigned la_mask = 0xffff, opcode, la = 0;
if (sep)
@@ -6,7 +6,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -18,6 +17,7 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <stdarg.h>
+#include <cstring>
#include <ctime>
#include <cerrno>
#include <string>
@@ -191,7 +191,7 @@ unsigned cec_parse_phys_addr(const char *value)
{
unsigned p1, p2, p3, p4;
- if (!strchr(value, '.'))
+ if (!std::strchr(value, '.'))
return strtoul(value, NULL, 0);
if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) {
fprintf(stderr, "Expected a physical address of the form x.x.x.x\n");
@@ -18,10 +18,11 @@
Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*/
+#include <cstring>
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -1582,7 +1583,7 @@ int main(int argc, char **argv)
break;
case OptStreamFrom:
case OptStreamFromHdr: {
- char *equal = strchr(optarg, '=');
+ char *equal = std::strchr(optarg, '=');
bool has_hdr = ch == OptStreamFromHdr;
if (equal == optarg)
@@ -1,7 +1,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -22,6 +21,7 @@
#include <sys/klog.h>
#endif
+#include <cstring>
#include <list>
#include <vector>
#include <map>
@@ -152,7 +152,7 @@ static int calc_node_val(const char *s)
{
int n = 0;
- s = strrchr(s, '/') + 1;
+ s = std::strrchr(s, '/') + 1;
for (unsigned i = 0; prefixes[i]; i++) {
unsigned l = strlen(prefixes[i]);
@@ -741,7 +741,7 @@ static bool parse_subset(char *optarg)
memset(&subset, 0, sizeof(subset));
while (*optarg) {
- p = strchr(optarg, ',');
+ p = std::strchr(optarg, ',');
if (p)
*p = 0;
if (optarg[0] == 0) {
@@ -808,7 +808,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg)
common_usage();
std::exit(EXIT_FAILURE);
}
- if (strchr(value, '=')) {
+ if (std::strchr(value, '=')) {
common_usage();
std::exit(EXIT_FAILURE);
}
@@ -824,7 +824,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg)
common_usage();
std::exit(EXIT_FAILURE);
}
- if (const char *equal = strchr(value, '=')) {
+ if (const char *equal = std::strchr(value, '=')) {
set_ctrls[std::string(value, (equal - value))] = equal + 1;
}
else {
@@ -1,7 +1,8 @@
+#include <cstring>
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <fcntl.h>
#include <ctype.h>
@@ -710,7 +711,7 @@ static unsigned short parse_phys_addr(const char *value)
{
unsigned p1, p2, p3, p4;
- if (!strchr(value, '.'))
+ if (!std::strchr(value, '.'))
return strtoul(value, NULL, 0);
if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) {
fprintf(stderr, "Expected a physical address of the form x.x.x.x\n");
@@ -1,7 +1,8 @@
+#include <cstring>
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -1660,7 +1661,7 @@ static FILE *open_output_file(cv4l_fd &fd)
if (!host_to)
return NULL;
- char *p = strchr(host_to, ':');
+ char *p = std::strchr(host_to, ':');
struct sockaddr_in serv_addr;
struct hostent *server;
struct v4l2_fract aspect;
@@ -1925,7 +1926,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
if (!host_from)
return NULL;
- char *p = strchr(host_from, ':');
+ char *p = std::strchr(host_from, ':');
int listen_fd;
socklen_t clilen;
struct sockaddr_in serv_addr = {}, cli_addr;
@@ -1,7 +1,8 @@
+#include <cstring>
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -98,7 +99,7 @@ void vbi_cmd(int ch, char *optarg)
std::exit(EXIT_FAILURE);
}
while (*optarg) {
- subs = strchr(optarg, ',');
+ subs = std::strchr(optarg, ',');
if (subs)
*subs = 0;
@@ -19,7 +19,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
@@ -43,6 +42,7 @@
#include <linux/videodev2.h>
+#include <cstring>
#include <list>
#include <vector>
#include <map>
@@ -731,7 +731,7 @@ int main(int argc, char **argv)
goto list_done;
}
- p = strchr(chip_info.name, ' ');
+ p = std::strchr(chip_info.name, ' ');
if (p)
*p = '\0';
name = chip_info.name;