aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2021-04-23 19:47:38 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-05-26 13:05:41 +0200
commit9438348faaf848f011470760d5a07dcb5e762720 (patch)
treee7d18c0f98cf9f5345cee0577e0f1e432155afb8
parentdee1ba88a3e44665a5da822d5408708b150dcf51 (diff)
mass constexpr conversions
Use constexpr instead of const, ensuring these are all initialized at compile time. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-compliance/cec-test-adapter.cpp12
-rw-r--r--utils/cec-ctl/cec-ctl.cpp12
-rw-r--r--utils/cec-follower/cec-processing.cpp4
-rw-r--r--utils/common/media-info.cpp12
-rw-r--r--utils/common/v4l2-info.cpp28
-rw-r--r--utils/rds-ctl/rds-ctl.cpp2
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp2
-rw-r--r--utils/v4l2-compliance/v4l2-test-buffers.cpp2
-rw-r--r--utils/v4l2-compliance/v4l2-test-colors.cpp10
-rw-r--r--utils/v4l2-compliance/v4l2-test-formats.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-edid.cpp10
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-misc.cpp6
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-overlay.cpp10
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-selection.cpp4
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-stds.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-subdev.cpp12
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-tuner.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-vbi.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-vidcap.cpp4
-rw-r--r--utils/v4l2-ctl/v4l2-ctl.cpp6
-rw-r--r--utils/v4l2-dbg/v4l2-dbg.cpp2
22 files changed, 74 insertions, 74 deletions
diff --git a/utils/cec-compliance/cec-test-adapter.cpp b/utils/cec-compliance/cec-test-adapter.cpp
index cf1b6191..df7feb21 100644
--- a/utils/cec-compliance/cec-test-adapter.cpp
+++ b/utils/cec-compliance/cec-test-adapter.cpp
@@ -14,8 +14,8 @@
#include "cec-compliance.h"
-static const __u8 tx_ok_retry_mask = CEC_TX_STATUS_OK | CEC_TX_STATUS_MAX_RETRIES;
-static const __u32 msg_fl_mask = CEC_MSG_FL_REPLY_TO_FOLLOWERS | CEC_MSG_FL_RAW;
+static constexpr __u8 tx_ok_retry_mask = CEC_TX_STATUS_OK | CEC_TX_STATUS_MAX_RETRIES;
+static constexpr __u32 msg_fl_mask = CEC_MSG_FL_REPLY_TO_FOLLOWERS | CEC_MSG_FL_RAW;
// Flush any pending messages
static int flush_pending_msgs(struct node *node)
@@ -107,24 +107,24 @@ static int testAdapPhysAddr(struct node *node)
static int testAdapLogAddrs(struct node *node)
{
- static const __u8 la_types[] = {
+ static constexpr __u8 la_types[] = {
CEC_LOG_ADDR_TYPE_TV,
CEC_LOG_ADDR_TYPE_RECORD,
CEC_LOG_ADDR_TYPE_TUNER,
CEC_LOG_ADDR_TYPE_AUDIOSYSTEM
};
- static const __u8 prim_dev_types[] = {
+ static constexpr __u8 prim_dev_types[] = {
CEC_OP_PRIM_DEVTYPE_TV,
CEC_OP_PRIM_DEVTYPE_RECORD,
CEC_OP_PRIM_DEVTYPE_TUNER,
CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM
};
- static const __u8 all_dev_types[2] = {
+ static constexpr __u8 all_dev_types[2] = {
CEC_OP_ALL_DEVTYPE_TV | CEC_OP_ALL_DEVTYPE_RECORD |
CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM,
CEC_OP_ALL_DEVTYPE_RECORD | CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM,
};
- static const __u8 features[12] = {
+ static constexpr __u8 features[12] = {
0x90, 0x00, 0x8e, 0x00,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index b1db4aac..79e707c7 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -2179,7 +2179,7 @@ int main(int argc, char **argv)
usage();
return 1;
case OptVendorCommand: {
- static const char *arg_names[] = {
+ static constexpr const char *arg_names[] = {
"payload",
nullptr
};
@@ -2213,7 +2213,7 @@ int main(int argc, char **argv)
break;
}
case OptCustomCommand: {
- static const char *arg_names[] = {
+ static constexpr const char *arg_names[] = {
"cmd",
"payload",
nullptr
@@ -2256,7 +2256,7 @@ int main(int argc, char **argv)
break;
}
case OptVendorCommandWithID: {
- static const char *arg_names[] = {
+ static constexpr const char *arg_names[] = {
"vendor-id",
"cmd",
nullptr
@@ -2295,7 +2295,7 @@ int main(int argc, char **argv)
break;
}
case OptVendorRemoteButtonDown: {
- static const char *arg_names[] = {
+ static constexpr const char *arg_names[] = {
"rc-code",
nullptr
};
@@ -2344,7 +2344,7 @@ int main(int argc, char **argv)
break;
case OptTestPowerCycle: {
- static const char *arg_names[] = {
+ static constexpr const char *arg_names[] = {
"polls",
"sleep",
nullptr
@@ -2371,7 +2371,7 @@ int main(int argc, char **argv)
}
case OptStressTestPowerCycle: {
- static const char *arg_names[] = {
+ static constexpr const char *arg_names[] = {
"cnt",
"min-sleep",
"max-sleep",
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index c76ec54e..5b9db19f 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -41,8 +41,8 @@ struct la_info la_info[15];
static struct timespec start_monotonic;
static struct timeval start_timeofday;
-static const time_t time_to_transient = 1;
-static const time_t time_to_stable = 8;
+static constexpr time_t time_to_transient = 1;
+static constexpr time_t time_to_stable = 8;
static const char *get_ui_cmd_string(__u8 ui_cmd)
{
diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
index 3a5477e8..410e18cd 100644
--- a/utils/common/media-info.cpp
+++ b/utils/common/media-info.cpp
@@ -33,7 +33,7 @@ static std::string num2s(unsigned num, bool is_hex = true)
return buf;
}
-static struct {
+static constexpr struct {
const char *devname;
enum media_type type;
} media_types[] = {
@@ -255,7 +255,7 @@ int mi_get_media_fd(int fd, const char *bus_info)
return media_fd;
}
-static const flag_def entity_flags_def[] = {
+static constexpr flag_def entity_flags_def[] = {
{ MEDIA_ENT_FL_DEFAULT, "default" },
{ MEDIA_ENT_FL_CONNECTOR, "connector" },
{ 0, nullptr }
@@ -266,7 +266,7 @@ std::string mi_entflags2s(__u32 flags)
return flags2s(flags, entity_flags_def);
}
-static const flag_def interface_types_def[] = {
+static constexpr flag_def interface_types_def[] = {
{ MEDIA_INTF_T_DVB_FE, "DVB Front End" },
{ MEDIA_INTF_T_DVB_DEMUX, "DVB Demuxer" },
{ MEDIA_INTF_T_DVB_DVR, "DVB DVR" },
@@ -299,7 +299,7 @@ std::string mi_ifacetype2s(__u32 type)
return "FAIL: Unknown (" + num2s(type) + ")";
}
-static const flag_def entity_functions_def[] = {
+static constexpr flag_def entity_functions_def[] = {
{ MEDIA_ENT_F_UNKNOWN, "FAIL: Uninitialized Function" },
{ MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN, "FAIL: Unknown V4L2 Sub-Device" },
{ MEDIA_ENT_T_DEVNODE_UNKNOWN, "FAIL: Unknown Device Node" },
@@ -392,7 +392,7 @@ bool mi_func_requires_intf(__u32 function)
}
}
-static const flag_def pad_flags_def[] = {
+static constexpr flag_def pad_flags_def[] = {
{ MEDIA_PAD_FL_SINK, "Sink" },
{ MEDIA_PAD_FL_SOURCE, "Source" },
{ MEDIA_PAD_FL_MUST_CONNECT, "Must Connect" },
@@ -404,7 +404,7 @@ std::string mi_padflags2s(__u32 flags)
return flags2s(flags, pad_flags_def);
}
-static const flag_def link_flags_def[] = {
+static constexpr flag_def link_flags_def[] = {
{ MEDIA_LNK_FL_ENABLED, "Enabled" },
{ MEDIA_LNK_FL_IMMUTABLE, "Immutable" },
{ MEDIA_LNK_FL_DYNAMIC, "Dynamic" },
diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp
index cb3cb91f..b8f2c865 100644
--- a/utils/common/v4l2-info.cpp
+++ b/utils/common/v4l2-info.cpp
@@ -201,7 +201,7 @@ std::string buftype2s(int type)
}
}
-static const flag_def bufcap_def[] = {
+static constexpr flag_def bufcap_def[] = {
{ V4L2_BUF_CAP_SUPPORTS_MMAP, "mmap" },
{ V4L2_BUF_CAP_SUPPORTS_USERPTR, "userptr" },
{ V4L2_BUF_CAP_SUPPORTS_DMABUF, "dmabuf" },
@@ -345,7 +345,7 @@ std::string quantization2s(int val)
}
}
-static const flag_def pixflags_def[] = {
+static constexpr flag_def pixflags_def[] = {
{ V4L2_PIX_FMT_FLAG_PREMUL_ALPHA, "premultiplied-alpha" },
{ 0, nullptr }
};
@@ -355,7 +355,7 @@ std::string pixflags2s(unsigned flags)
return flags2s(flags, pixflags_def);
}
-static const flag_def service_def[] = {
+static constexpr flag_def service_def[] = {
{ V4L2_SLICED_TELETEXT_B, "teletext" },
{ V4L2_SLICED_VPS, "vps" },
{ V4L2_SLICED_CAPTION_525, "cc" },
@@ -369,7 +369,7 @@ std::string service2s(unsigned service)
}
#define FMTDESC_DEF(enc_type) \
-static const flag_def fmtdesc_ ## enc_type ## _def[] = { \
+static constexpr flag_def fmtdesc_ ## enc_type ## _def[] = { \
{ V4L2_FMT_FLAG_COMPRESSED, "compressed" }, \
{ V4L2_FMT_FLAG_EMULATED, "emulated" }, \
{ V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM, "continuous-bytestream" }, \
@@ -393,7 +393,7 @@ std::string fmtdesc2s(unsigned flags, bool is_hsv)
}
#define MBUS_DEF(enc_type) \
-static const flag_def mbus_ ## enc_type ## _def[] = { \
+static constexpr flag_def mbus_ ## enc_type ## _def[] = { \
{ V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE, "csc-colorspace" }, \
{ V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC, "csc-"#enc_type }, \
{ V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION, "csc-quantization" }, \
@@ -411,7 +411,7 @@ std::string mbus2s(unsigned flags, bool is_hsv)
return flags2s(flags, mbus_ycbcr_def);
}
-static const flag_def selection_targets_def[] = {
+static constexpr flag_def selection_targets_def[] = {
{ V4L2_SEL_TGT_CROP_ACTIVE, "crop" },
{ V4L2_SEL_TGT_CROP_DEFAULT, "crop_default" },
{ V4L2_SEL_TGT_CROP_BOUNDS, "crop_bounds" },
@@ -519,7 +519,7 @@ std::string std2s(v4l2_std_id std, const char *sep)
std::string ctrlflags2s(__u32 flags)
{
- static const flag_def def[] = {
+ static constexpr flag_def def[] = {
{ V4L2_CTRL_FLAG_GRABBED, "grabbed" },
{ V4L2_CTRL_FLAG_DISABLED, "disabled" },
{ V4L2_CTRL_FLAG_READ_ONLY, "read-only" },
@@ -536,7 +536,7 @@ std::string ctrlflags2s(__u32 flags)
return flags2s(flags, def);
}
-static const flag_def in_status_def[] = {
+static constexpr flag_def in_status_def[] = {
{ V4L2_IN_ST_NO_POWER, "no power" },
{ V4L2_IN_ST_NO_SIGNAL, "no signal" },
{ V4L2_IN_ST_NO_COLOR, "no color" },
@@ -560,7 +560,7 @@ std::string in_status2s(__u32 status)
return status ? flags2s(status, in_status_def) : "ok";
}
-static const flag_def input_cap_def[] = {
+static constexpr flag_def input_cap_def[] = {
{ V4L2_IN_CAP_DV_TIMINGS, "DV timings" },
{ V4L2_IN_CAP_STD, "SDTV standards" },
{ V4L2_IN_CAP_NATIVE_SIZE, "Native Size" },
@@ -572,7 +572,7 @@ std::string input_cap2s(__u32 capabilities)
return capabilities ? flags2s(capabilities, input_cap_def) : "not defined";
}
-static const flag_def output_cap_def[] = {
+static constexpr flag_def output_cap_def[] = {
{ V4L2_OUT_CAP_DV_TIMINGS, "DV timings" },
{ V4L2_OUT_CAP_STD, "SDTV standards" },
{ V4L2_OUT_CAP_NATIVE_SIZE, "Native Size" },
@@ -630,7 +630,7 @@ std::string fbufflags2s(unsigned fl)
return s;
}
-static const flag_def dv_standards_def[] = {
+static constexpr flag_def dv_standards_def[] = {
{ V4L2_DV_BT_STD_CEA861, "CTA-861" },
{ V4L2_DV_BT_STD_DMT, "DMT" },
{ V4L2_DV_BT_STD_CVT, "CVT" },
@@ -675,7 +675,7 @@ std::string dvflags2s(unsigned vsync, int val)
return s;
}
-static const flag_def dv_caps_def[] = {
+static constexpr flag_def dv_caps_def[] = {
{ V4L2_DV_BT_CAP_INTERLACED, "Interlaced" },
{ V4L2_DV_BT_CAP_PROGRESSIVE, "Progressive" },
{ V4L2_DV_BT_CAP_REDUCED_BLANKING, "Reduced Blanking" },
@@ -688,7 +688,7 @@ std::string dv_caps2s(__u32 flags)
return flags2s(flags, dv_caps_def);
}
-static const flag_def tc_flags_def[] = {
+static constexpr flag_def tc_flags_def[] = {
{ V4L2_TC_FLAG_DROPFRAME, "dropframe" },
{ V4L2_TC_FLAG_COLORFRAME, "colorframe" },
{ V4L2_TC_USERBITS_field, "userbits-field" },
@@ -702,7 +702,7 @@ std::string tc_flags2s(__u32 flags)
return flags2s(flags, tc_flags_def);
}
-static const flag_def buffer_flags_def[] = {
+static constexpr flag_def buffer_flags_def[] = {
{ V4L2_BUF_FLAG_MAPPED, "mapped" },
{ V4L2_BUF_FLAG_QUEUED, "queued" },
{ V4L2_BUF_FLAG_DONE, "done" },
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 8161aa45..80a9396a 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -382,7 +382,7 @@ static void parse_freq_seek(char *optarg, struct v4l2_hw_freq_seek &seek)
char *subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"dir",
"wrap",
"spacing",
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 90a50361..b25e3464 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -1618,7 +1618,7 @@ int main(int argc, char **argv)
case OptStreamAllColorTest:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"color",
"skip",
"perc",
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 045f8d54..e515fea4 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -845,7 +845,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_
cv4l_queue &m2m_q, unsigned frame_count, int pollmode,
unsigned &capture_count)
{
- static const char *pollmode_str[] = {
+ static constexpr const char *pollmode_str[] = {
"",
" (select)",
" (epoll)",
diff --git a/utils/v4l2-compliance/v4l2-test-colors.cpp b/utils/v4l2-compliance/v4l2-test-colors.cpp
index 55a81694..887b2fd4 100644
--- a/utils/v4l2-compliance/v4l2-test-colors.cpp
+++ b/utils/v4l2-compliance/v4l2-test-colors.cpp
@@ -59,22 +59,22 @@ struct color {
double r, g, b, a;
};
-static const double bt601[3][3] = {
+static constexpr double bt601[3][3] = {
{ 1, 0, 1.4020 },
{ 1, -0.3441, -0.7141 },
{ 1, 1.7720, 0 },
};
-static const double rec709[3][3] = {
+static constexpr double rec709[3][3] = {
{ 1, 0, 1.5748 },
{ 1, -0.1873, -0.4681 },
{ 1, 1.8556, 0 },
};
-static const double smpte240m[3][3] = {
+static constexpr double smpte240m[3][3] = {
{ 1, 0, 1.5756 },
{ 1, -0.2253, -0.4767 },
{ 1, 1.8270, 0 },
};
-static const double bt2020[3][3] = {
+static constexpr double bt2020[3][3] = {
{ 1, 0, 1.4746 },
{ 1, -0.1646, -0.5714 },
{ 1, 1.8814, 0 },
@@ -465,7 +465,7 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3],
}
}
-static const char * const colors[] = {
+static constexpr const char *colors[] = {
"red",
"green",
"blue"
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 60ebf559..3761b1fa 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -27,7 +27,7 @@
#include "compiler.h"
#include "v4l2-compliance.h"
-static const __u32 buftype2cap[] = {
+static constexpr __u32 buftype2cap[] = {
0,
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_M2M,
V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_M2M,
diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
index fba9734c..557f1d00 100644
--- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
@@ -659,19 +659,19 @@ static void print_edid_mods(const struct v4l2_edid *e)
}
loc = get_edid_vid_cap_location(e->edid, e->blocks * 128);
if (loc >= 0) {
- static const char *pt_scan[] = {
+ static constexpr const char *pt_scan[] = {
"No Data",
"Always Overscanned",
"Always Underscanned",
"Supports both over- and underscan"
};
- static const char *it_scan[] = {
+ static constexpr const char *it_scan[] = {
"IT Formats not supported",
"Always Overscanned",
"Always Underscanned",
"Supports both over- and underscan"
};
- static const char *ce_scan[] = {
+ static constexpr const char *ce_scan[] = {
"CE Formats not supported",
"Always Overscanned",
"Always Underscanned",
@@ -1088,7 +1088,7 @@ void edid_cmd(int ch, char *optarg)
break;
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"pad",
"type",
"edid",
@@ -1322,7 +1322,7 @@ void edid_cmd(int ch, char *optarg)
break;
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"pad",
"startblock",
"blocks",
diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
index 1853608a..dc587aeb 100644
--- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
@@ -178,7 +178,7 @@ void misc_cmd(int ch, char *optarg)
case OptSetJpegComp:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"app0", "app1", "app2", "app3",
"app4", "app5", "app6", "app7",
"app8", "app9", "appa", "appb",
@@ -235,7 +235,7 @@ void misc_cmd(int ch, char *optarg)
case OptTryEncoderCmd:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"cmd",
"flags",
nullptr
@@ -258,7 +258,7 @@ void misc_cmd(int ch, char *optarg)
case OptTryDecoderCmd:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"cmd",
"flags",
"stop_pts",
diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
index 639a4175..5493222d 100644
--- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
@@ -209,7 +209,7 @@ void overlay_cmd(int ch, char *optarg)
case OptTryOverlayFormat:
subs = optarg;
while (subs && *subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"chromakey",
"global_alpha",
"left",
@@ -260,7 +260,7 @@ void overlay_cmd(int ch, char *optarg)
subs = optarg;
memset(&r, 0, sizeof(r));
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"left",
"top",
"width",
@@ -303,12 +303,12 @@ void overlay_cmd(int ch, char *optarg)
case OptSetFBuf:
subs = optarg;
while (*subs != '\0') {
- const unsigned chroma_flags = V4L2_FBUF_FLAG_CHROMAKEY |
+ constexpr unsigned chroma_flags = V4L2_FBUF_FLAG_CHROMAKEY |
V4L2_FBUF_FLAG_SRC_CHROMAKEY;
- const unsigned alpha_flags = V4L2_FBUF_FLAG_GLOBAL_ALPHA |
+ constexpr unsigned alpha_flags = V4L2_FBUF_FLAG_GLOBAL_ALPHA |
V4L2_FBUF_FLAG_LOCAL_ALPHA |
V4L2_FBUF_FLAG_LOCAL_INV_ALPHA;
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"chromakey",
"src_chromakey",
"global_alpha",
diff --git a/utils/v4l2-ctl/v4l2-ctl-selection.cpp b/utils/v4l2-ctl/v4l2-ctl-selection.cpp
index 4633776f..68a39c14 100644
--- a/utils/v4l2-ctl/v4l2-ctl-selection.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-selection.cpp
@@ -93,7 +93,7 @@ static void parse_crop(char *optarg, unsigned int &set_crop, v4l2_rect &vcrop)
char *subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"left",
"top",
"width",
@@ -153,7 +153,7 @@ static int parse_selection(char *optarg, unsigned int &set_sel, v4l2_selection &
char *subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"target",
"flags",
"left",
diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
index 82571f93..08154df4 100644
--- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
@@ -160,7 +160,7 @@ static int parse_timing_subopt(char **subopt_str, int *value)
int opt;
char *opt_str;
- static const char * const subopt_list[] = {
+ static constexpr const char *subopt_list[] = {
"width",
"height",
"interlaced",
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index b8dc30fb..62424e4c 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -503,7 +503,7 @@ static void print_buffer(FILE *f, struct v4l2_buffer &buf)
static_cast<__u64>(buf.timestamp.tv_sec), static_cast<__u64>(buf.timestamp.tv_usec),
timestamp_type2s(buf.flags).c_str(), timestamp_src2s(buf.flags).c_str());
if (buf.flags & V4L2_BUF_FLAG_TIMECODE) {
- static const int fps_types[] = { 0, 24, 25, 30, 50, 60 };
+ static constexpr int fps_types[] = { 0, 24, 25, 30, 50, 60 };
int fps = buf.timecode.type;
if (fps > 5)
diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index ecfd3244..33cc1342 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -97,7 +97,7 @@ void subdev_cmd(int ch, char *optarg)
case OptListSubDevFrameSizes:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"pad",
"code",
nullptr
@@ -119,7 +119,7 @@ void subdev_cmd(int ch, char *optarg)
case OptListSubDevFrameIntervals:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"pad",
"code",
"width",
@@ -153,7 +153,7 @@ void subdev_cmd(int ch, char *optarg)
case OptGetSubDevSelection:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"pad",
"target",
nullptr
@@ -187,7 +187,7 @@ void subdev_cmd(int ch, char *optarg)
ffmt.field = V4L2_FIELD_ANY;
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"width",
"height",
"code",
@@ -256,7 +256,7 @@ void subdev_cmd(int ch, char *optarg)
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"target",
"flags",
"left",
@@ -309,7 +309,7 @@ void subdev_cmd(int ch, char *optarg)
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"pad",
"fps",
nullptr
diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
index 7d6f6f3e..177aa8e6 100644
--- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
@@ -157,7 +157,7 @@ static void parse_freq_seek(char *optarg, struct v4l2_hw_freq_seek &seek)
char *subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"dir",
"wrap",
"spacing",
diff --git a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
index 33191aa6..dc7b4282 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
@@ -123,7 +123,7 @@ void vbi_cmd(int ch, char *optarg)
subs = optarg;
memset(&raw->fmt.vbi, 0, sizeof(raw->fmt.vbi));
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"samplingrate",
"offset",
"samplesperline",
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
index c66c248a..cca2d4b4 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
@@ -133,7 +133,7 @@ void vidcap_cmd(int ch, char *optarg)
case OptListFrameIntervals:
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"width",
"height",
"pixelformat",
@@ -395,7 +395,7 @@ void vidcap_list(cv4l_fd &fd)
void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q)
{
- static const char img[16] = {
+ static constexpr char img[16] = {
'.', ',', ':', ';', '!', '|', 'i', 'c',
'n', 'o', 'm', 'I', 'C', 'N', 'O', 'M',
};
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index d91577e1..95b8a2e7 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -523,7 +523,7 @@ void printfmt(int fd, const struct v4l2_format &vfmt)
static std::string frmtype2s(unsigned type)
{
- static const char *types[] = {
+ static constexpr const char *types[] = {
"Unknown",
"Discrete",
"Continuous",
@@ -764,7 +764,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat,
flags = 0;
subs = optarg;
while (*subs != '\0') {
- static const char *const subopts[] = {
+ static constexpr const char *subopts[] = {
"width",
"height",
"pixelformat",
@@ -1033,7 +1033,7 @@ static int open_media_bus_info(const std::string &bus_info)
}
static const char *make_devname(const char *device, const char *devname,
- const std::string &media_bus_info)
+ const std::string &media_bus_info)
{
if (device[0] >= '0' && device[0] <= '9' && strlen(device) <= 3) {
static char newdev[32];
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 47b1263c..d711c9e4 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -494,7 +494,7 @@ int main(int argc, char **argv)
break;
while (*subs != '\0') {
- static const char * const subopts[] = {
+ static constexpr const char *subopts[] = {
"min",
"max",
nullptr

Privacy Policy