summaryrefslogtreecommitdiff
path: root/v4l2-apps/util/v4l2-dbg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'v4l2-apps/util/v4l2-dbg.cpp')
-rw-r--r--v4l2-apps/util/v4l2-dbg.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp
index 8323f2120..2561f42b2 100644
--- a/v4l2-apps/util/v4l2-dbg.cpp
+++ b/v4l2-apps/util/v4l2-dbg.cpp
@@ -245,9 +245,9 @@ static int doioctl(int fd, int request, void *parm, const char *name)
return retVal;
}
-static int parse_subopt(char **subs, char * const *subopts, char **value)
+static int parse_subopt(char **subs, const char * const *subopts, char **value)
{
- int opt = getsubopt(subs, subopts, value);
+ int opt = getsubopt(subs, (char * const *)subopts, value);
if (opt == -1) {
fprintf(stderr, "Invalid suboptions specified\n");
@@ -272,7 +272,7 @@ int main(int argc, char **argv)
/* command args */
int ch;
- char *device = strdup("/dev/video0"); /* -d device */
+ const char *device = "/dev/video0"; /* -d device */
struct v4l2_capability vcap; /* list_cap */
struct v4l2_register set_reg;
struct v4l2_register get_reg;
@@ -311,18 +311,20 @@ int main(int argc, char **argv)
usage();
return 0;
case OptSetDevice:
- device = strdup(optarg);
+ device = optarg;
if (device[0] >= '0' && device[0] <= '9' && device[1] == 0) {
+ static char newdev[20];
char dev = device[0];
- sprintf(device, "/dev/video%c", dev);
+ sprintf(newdev, "/dev/video%c", dev);
+ device = newdev;
}
break;
case OptSetRegister:
subs = optarg;
set_reg.match_type = V4L2_CHIP_MATCH_I2C_DRIVER;
while (*subs != '\0') {
- static char *const subopts[] = {
+ static const char * const subopts[] = {
"type",
"chip",
"reg",
@@ -352,7 +354,7 @@ int main(int argc, char **argv)
subs = optarg;
get_reg.match_type = V4L2_CHIP_MATCH_I2C_DRIVER;
while (*subs != '\0') {
- static char *const subopts[] = {
+ static const char * const subopts[] = {
"type",
"chip",
"min",
@@ -382,7 +384,7 @@ int main(int argc, char **argv)
subs = optarg;
set_reg.match_type = V4L2_CHIP_MATCH_I2C_DRIVER;
while (*subs != '\0') {
- static char *const subopts[] = {
+ static const char *const subopts[] = {
"type",
"chip",
NULL
@@ -424,7 +426,6 @@ int main(int argc, char **argv)
strerror(errno));
exit(1);
}
- free(device);
doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP");
capabilities = vcap.capabilities;