utils: replace exit with std variant
PATCH 1/1 utils: replace exit with std variant
Also converted to the appropriate macros for clarity.
Signed-off-by Rosen Penev <[email protected]>
--- utils/cec-compliance/cec-compliance.cpp | 16 ++-- utils/cec-compliance/cec-compliance.h | 8 +- utils/cec-compliance/cec-test-adapter.cpp | 4 +- utils/cec-compliance/cec-test.cpp | 2 +- utils/cec-ctl/cec-ctl.cpp | 84 ++++++++++----------- utils/cec-follower/cec-follower.cpp | 6 +- utils/common/media-info.cpp | 2 +- utils/cx18-ctl/cx18-ctl.c | 8 +- utils/qvidcap/capture.cpp | 16 ++-- utils/qvidcap/paint.cpp | 8 +- utils/qvidcap/qvidcap.cpp | 28 +++---- utils/rds-ctl/rds-ctl.cpp | 20 ++--- utils/v4l2-compliance/v4l2-compliance.cpp | 26 +++---- utils/v4l2-compliance/v4l2-compliance.h | 4 +- utils/v4l2-compliance/v4l2-test-buffers.cpp | 4 +- utils/v4l2-ctl/v4l2-ctl-common.cpp | 14 ++-- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 28 +++---- utils/v4l2-ctl/v4l2-ctl-meta.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-misc.cpp | 6 +- utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-selection.cpp | 8 +- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 16 ++-- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 26 +++---- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 18 ++--- utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 6 +- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 4 +- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 16 ++-- utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 4 +- utils/v4l2-ctl/v4l2-ctl.cpp | 30 ++++---- utils/v4l2-dbg/v4l2-dbg.cpp | 12 +-- 30 files changed, 213 insertions(+), 215 deletions(-)
utils/cec-compliance/cec-compliance.cpp +8 -8
@@ -878,7 +878,7 @@ retry: res = doioctl(node, CEC_TRANSMIT, msg); if (res == ENODEV) { printf("Device was disconnected.\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (res == ENONET) { if (retried) {
@@ -1224,7 +1224,7 @@ int main(int argc, char **argv) show_colors = isatty(STDOUT_FILENO); else { usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptNoWarnings:
@@ -1285,7 +1285,7 @@ int main(int argc, char **argv) if (device.empty()) { fprintf(stderr, "Could not find a CEC device for the given driver/adapter combination\n"); - exit(1); + std::exit(EXIT_FAILURE); } } if (device.empty())
@@ -1294,7 +1294,7 @@ int main(int argc, char **argv) if ((fd = open(device.c_str(), O_RDWR)) < 0) { fprintf(stderr, "Failed to open %s: %s\n", device.c_str(), strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } struct node node = { };
@@ -1468,7 +1468,7 @@ int main(int argc, char **argv) if (missing_la) fprintf(stderr, "FAIL: missing logical address(es), use cec-ctl to configure this\n"); if (missing_la || missing_pa) - exit(-1); + std::exit(EXIT_FAILURE); if (!options[OptSkipInfo]) { printf("\nCompliance test for %s device %s:\n\n",
@@ -1493,7 +1493,7 @@ int main(int argc, char **argv) if (!node.remote_la_mask) { printf("\nFAIL: No remote devices found, exiting.\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (options[OptTestAdapter])
@@ -1507,7 +1507,7 @@ int main(int argc, char **argv) printf("\n"); if (options[OptTestFuzzing] && remote_la >= 0) - exit(testFuzzing(node, laddrs.log_addr[0], remote_la)); + std::exit(testFuzzing(node, laddrs.log_addr[0], remote_la)); unsigned remote_la_mask = node.remote_la_mask;
@@ -1533,5 +1533,5 @@ int main(int argc, char **argv) printf("Total for %s device %s: %d, Succeeded: %d, Failed: %d, Warnings: %d\n", caps.driver, device.c_str(), tests_total, tests_ok, tests_total - tests_ok, warnings); - exit(app_result); + std::exit(app_result); }
utils/cec-compliance/cec-compliance.h +3 -5
@@ -8,10 +8,8 @@#ifndef _CEC_COMPLIANCE_H_#define _CEC_COMPLIANCE_H_ -#include <stdarg.h> -#include <cerrno> #include <string> -#include <time.h> +#include <linux/cec-funcs.h> #include "cec-htng-funcs.h"
@@ -228,7 +226,7 @@ struct remote_subtest { show_colors ? COLOR_BOLD("warn") : "warn", \ __FILE__, __LINE__, ##args); \ if (exit_on_warn) \ - exit(1); \ + std::exit(EXIT_FAILURE); \ 0; \ })
@@ -259,7 +257,7 @@ struct remote_subtest { printf("\t\t%s: %s(%d): " fmt, show_colors ? \ COLOR_RED("fail") : "fail", __FILE__, __LINE__, ##args); \ if (exit_on_fail) \ - exit(1); \ + std::exit(EXIT_FAILURE); \ FAIL; \ })
utils/cec-compliance/cec-test-adapter.cpp +2 -2
@@ -1243,7 +1243,7 @@ void testAdapter(struct node &node, struct cec_log_addrs &laddrs, if (node.phys_addr == CEC_PHYS_ADDR_INVALID) { fprintf(stderr, "FAIL: without a valid physical address this test cannot proceed.\n"); fprintf(stderr, "Make sure that this CEC adapter is connected to another HDMI sink or source.\n"); - exit(1); + std::exit(EXIT_FAILURE); } printf("\tCEC_ADAP_G/S_LOG_ADDRS: %s\n", ok(testAdapLogAddrs(&node))); fcntl(node.fd, F_SETFL, fcntl(node.fd, F_GETFL) & ~O_NONBLOCK);
@@ -1275,7 +1275,7 @@ void testAdapter(struct node &node, struct cec_log_addrs &laddrs, if ((node2.fd = open(device, O_RDWR)) < 0) { fprintf(stderr, "Failed to open %s: %s\n", device, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } printf("\tCEC_G/S_MODE: %s\n", ok(testModes(&node, &node2)));
utils/cec-compliance/cec-test.cpp +1 -1
@@ -1507,7 +1507,7 @@ void collectTests() mapTestFuncs[name] != func) { fprintf(stderr, "Duplicate subtest name, but different tests: %s\n", tests[i].subtests[j].name); - exit(-1); + std::exit(EXIT_FAILURE); } mapTestFuncs[name] = func; mapTests[name] = DONT_CARE;
utils/cec-ctl/cec-ctl.cpp +42 -42
331 lines not on this page · raw message
utils/cec-follower/cec-follower.cpp +3 -3
@@ -451,7 +451,7 @@ int main(int argc, char **argv) if (device.empty()) { fprintf(stderr, "Could not find a CEC device for the given driver/adapter combination\n"); - exit(1); + std::exit(EXIT_FAILURE); } } if (device.empty())
@@ -460,7 +460,7 @@ int main(int argc, char **argv) if ((fd = open(device.c_str(), O_RDWR)) < 0) { fprintf(stderr, "Failed to open %s: %s\n", device.c_str(), strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } struct cec_caps caps = { };
@@ -533,7 +533,7 @@ int main(int argc, char **argv) if (missing_la) fprintf(stderr, "FAIL: missing logical address(es), use cec-ctl to configure this\n"); if (missing_la || missing_pa) - exit(-1); + std::exit(EXIT_FAILURE); testProcessing(&node, options[OptWallClock]); }
utils/common/media-info.cpp +1 -1
@@ -593,7 +593,7 @@ __u32 mi_media_info_for_fd(int media_fd, int fd, bool *is_invalid) if (fstat(fd, &sb) == -1) { fprintf(stderr, "failed to stat file\n"); - exit(1); + std::exit(EXIT_FAILURE); } ent_id = read_topology(media_fd, major(sb.st_rdev), minor(sb.st_rdev),
utils/cx18-ctl/cx18-ctl.c +4 -4
@@ -285,7 +285,7 @@ int main(int argc, char **argv)fprintf (stderr,"No value given to suboption <dir>\n" );usage (); -exit (1 ); +exit (EXIT_FAILURE ); } gpio_dir =strtoul (value,0L ,0 ); gpio_set_dir =1 ;
@@ -295,7 +295,7 @@ int main(int argc, char **argv)fprintf (stderr,"No value given to suboption <val>\n" );usage (); -exit (1 ); +exit (EXIT_FAILURE ); } gpio_out = (unsigned short )strtoul (value,0L ,0 );
@@ -304,7 +304,7 @@ int main(int argc, char **argv)fprintf (stderr,"Invalid suboptions specified\n" );usage (); -exit (1 ); +exit (EXIT_FAILURE );break ; } }
@@ -334,7 +334,7 @@ int main(int argc, char **argv)if (fd <0 ) {fprintf (stderr,"Failed to open %s: %s\n" , device,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); }/* Setting Opts */
utils/qvidcap/capture.cpp +8 -8
@@ -737,7 +737,7 @@ void CaptureWin::checkError(const char *msg) fprintf(stderr, "OpenGL Error (no: %u) code 0x%x: %s.\n", errNo++, err, msg); if (errNo) - exit(errNo); + std::exit(errNo); } void CaptureWin::configureTexture(size_t idx)
@@ -817,7 +817,7 @@ void CaptureWin::setModeFile(const QString &filename) m_file.setFileName(filename); if (!m_file.open(QIODevice::ReadOnly)) { fprintf(stderr, "could not open %s\n", filename.toUtf8().data()); - exit(1); + std::exit(EXIT_FAILURE); } m_canOverrideResolution = true; }
@@ -1137,7 +1137,7 @@ void CaptureWin::v4l2ReadEvent() if (m_cnt == 0) return; if (--m_cnt == 0) - exit(0); + std::exit(EXIT_SUCCESS); } void CaptureWin::v4l2ExceptionEvent()
@@ -1153,7 +1153,7 @@ void CaptureWin::v4l2ExceptionEvent() fprintf(stderr, "Unsupported format: '%s' %s\n", fcc2s(fmt.g_pixelformat()).c_str(), pixfmt2s(fmt.g_pixelformat()).c_str()); - exit(1); + std::exit(EXIT_FAILURE); } updateOrigValues(); m_updateShader = true;
@@ -1320,7 +1320,7 @@ void CaptureWin::sockReadEvent() if (m_cnt == 0) return; if (--m_cnt == 0) - exit(0); + std::exit(EXIT_SUCCESS); return; new_conn:
@@ -1495,7 +1495,7 @@ void CaptureWin::tpgUpdateFrame() delete m_timer; m_timer = NULL; if (!m_test) - exit(0); + std::exit(EXIT_SUCCESS); m_cnt = m_test;
@@ -1533,7 +1533,7 @@ void CaptureWin::tpgUpdateFrame() m_testState.field_idx = 0; if (mask_fmt || formats[++m_testState.fmt_idx] == 0) - exit(0); + std::exit(EXIT_SUCCESS); } } }
@@ -1543,7 +1543,7 @@ void CaptureWin::tpgUpdateFrame() while (!supportedFmt(formats[m_testState.fmt_idx])) if (formats[++m_testState.fmt_idx] == 0) - exit(0); + std::exit(EXIT_SUCCESS); m_v4l_fmt.s_pixelformat(formats[m_testState.fmt_idx]); updateV4LFormat(m_v4l_fmt);
utils/qvidcap/paint.cpp +4 -4
@@ -48,7 +48,7 @@ void CaptureWin::initializeGL() } if (m_uses_gl_red && glGetString(GL_VERSION)[0] < '3') { fprintf(stderr, "The openGL implementation does not support GL_RED/GL_RG\n"); - exit(1); + std::exit(EXIT_FAILURE); } QColor bg = QWidget::palette().color(QWidget::backgroundRole());
@@ -515,7 +515,7 @@ void CaptureWin::changeShader() if (!src_ok) { fprintf(stderr, "OpenGL Error: fragment shader compilation failed.\n"); - exit(1); + std::exit(EXIT_FAILURE); } // Mandatory vertex shader replaces fixed pipeline in GLES 2.0. In this case just a feedthrough shader.
@@ -541,12 +541,12 @@ void CaptureWin::changeShader() if (!src_ok) { fprintf(stderr, "OpenGL Error: vertex shader compilation failed.\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (!m_program->bind()) { fprintf(stderr, "OpenGL Error: shader bind failed.\n"); - exit(1); + std::exit(EXIT_FAILURE); } GLint loc = m_program->uniformLocation("uvtex");
utils/qvidcap/qvidcap.cpp +14 -14
@@ -319,7 +319,7 @@ __u32 read_u32(int fd) n = read(fd, &v, sizeof(v)); if (n != sizeof(v)) { fprintf(stderr, "could not read __u32\n"); - exit(1); + std::exit(EXIT_FAILURE); } return ntohl(v); }
@@ -336,7 +336,7 @@ int initSocket(int port, cv4l_fmt &fmt, v4l2_fract &pixelaspect) listen_fd = socket(AF_INET, SOCK_STREAM, 0); if (listen_fd < 0) { fprintf(stderr, "could not opening socket\n"); - exit(1); + std::exit(EXIT_FAILURE); } setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(int));
@@ -345,7 +345,7 @@ int initSocket(int port, cv4l_fmt &fmt, v4l2_fract &pixelaspect) serv_addr.sin_port = htons(port); if (bind(listen_fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { fprintf(stderr, "could not bind: %s\n", strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } } listen(listen_fd, 1);
@@ -353,17 +353,17 @@ int initSocket(int port, cv4l_fmt &fmt, v4l2_fract &pixelaspect) sock_fd = accept(listen_fd, (struct sockaddr *)&cli_addr, &clilen); if (sock_fd < 0) { fprintf(stderr, "could not accept\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (read_u32(sock_fd) != V4L_STREAM_ID) { fprintf(stderr, "unknown protocol ID\n"); - exit(1); + std::exit(EXIT_FAILURE); } __u32 version = read_u32(sock_fd); if (!version || version > V4L_STREAM_VERSION) { fprintf(stderr, "unknown protocol version %u\n", version); - exit(1); + std::exit(EXIT_FAILURE); } for (;;) { __u32 packet = read_u32(sock_fd);
@@ -371,7 +371,7 @@ int initSocket(int port, cv4l_fmt &fmt, v4l2_fract &pixelaspect) if (packet == V4L_STREAM_PACKET_END) { fprintf(stderr, "END packet read\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (packet == V4L_STREAM_PACKET_FMT_VIDEO)
@@ -385,7 +385,7 @@ int initSocket(int port, cv4l_fmt &fmt, v4l2_fract &pixelaspect) n = read(sock_fd, buf, rdsize); if (n < 0) { fprintf(stderr, "error reading %d bytes\n", sz); - exit(1); + std::exit(EXIT_FAILURE); } sz -= n; }
@@ -396,7 +396,7 @@ int initSocket(int port, cv4l_fmt &fmt, v4l2_fract &pixelaspect) if (sz != V4L_STREAM_PACKET_FMT_VIDEO_SIZE_FMT) { fprintf(stderr, "unsupported FMT_VIDEO size\n"); - exit(1); + std::exit(EXIT_FAILURE); } fmt.s_num_planes(read_u32(sock_fd)); fmt.s_pixelformat(read_u32(sock_fd));
@@ -416,7 +416,7 @@ int initSocket(int port, cv4l_fmt &fmt, v4l2_fract &pixelaspect) if (sz != V4L_STREAM_PACKET_FMT_VIDEO_SIZE_FMT_PLANE) { fprintf(stderr, "unsupported FMT_VIDEO plane size\n"); - exit(1); + std::exit(EXIT_FAILURE); } fmt.s_sizeimage(read_u32(sock_fd), i); fmt.s_bytesperline(read_u32(sock_fd), i);
@@ -675,11 +675,11 @@ int main(int argc, char **argv) video_device = getDeviceName("/dev/video", video_device); if (fd.open(video_device.toUtf8().data(), true) < 0) { perror((QString("could not open ") + video_device).toUtf8().data()); - exit(1); + std::exit(EXIT_FAILURE); } if (!fd.has_vid_cap()) { fprintf(stderr, "%s is not a video capture device\n", video_device.toUtf8().data()); - exit(1); + std::exit(EXIT_FAILURE); } fd.g_fmt(fmt);
@@ -787,7 +787,7 @@ int main(int argc, char **argv) fcc2s(fmt.g_pixelformat()).c_str(), pixfmt2s(fmt.g_pixelformat()).c_str()); if (mode != AppModeSocket) - exit(1); + std::exit(EXIT_FAILURE); sock_fd = initSocket(port, fmt, pixelaspect); } win.setPixelAspect(pixelaspect);
@@ -813,7 +813,7 @@ int main(int argc, char **argv) q.queue_all(&fd); win.setQueue(&q); if (fd.streamon()) - exit(1); + std::exit(EXIT_FAILURE); } else { struct tpg_data *tpg = win.getTPG();
utils/rds-ctl/rds-ctl.cpp +10 -10
@@ -339,7 +339,7 @@ static dev_vec list_devices() dp = opendir("/dev"); if (dp == NULL) { perror ("Couldn't open the directory"); - exit(1); + std::exit(EXIT_FAILURE); } while ((ep = readdir(dp))) if (is_radio_dev(ep->d_name))
@@ -414,7 +414,7 @@ static void parse_freq_seek(char *optarg, struct v4l2_hw_freq_seek &seek) break; default: usage_tuner(); - exit(1); + std::exit(EXIT_FAILURE); } } }
@@ -724,7 +724,7 @@ static void read_rds_from_fd(const int fd) /* create an rds handle for the current device */ if (!(rds_handle = v4l2_rds_create(params.options[OptRBDS]))) { fprintf(stderr, "Failed to init RDS lib: %s\n", strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } /* try to receive and decode RDS data */
@@ -748,7 +748,7 @@ static int parse_cl(int argc, char **argv) if (argc == 1) { usage_hint(); - exit(1); + std::exit(EXIT_FAILURE); } for (i = 0; long_options[i].name; i++) { if (!isalpha(long_options[i].val))
@@ -976,18 +976,18 @@ int main(int argc, char **argv) parse_cl(argc, argv); if (params.options[OptHelp]) { usage(); - exit(0); + std::exit(EXIT_SUCCESS); } /* File Mode: disables all other features, except for RDS decoding */ if (params.filemode_active) { if ((fd = open(params.fd_name, O_RDONLY|O_NONBLOCK)) < 0){ perror("error opening file"); - exit(1); + std::exit(EXIT_FAILURE); } read_rds_from_fd(fd); close(fd); - exit(0); + std::exit(EXIT_SUCCESS); } /* Device Mode: open the radio device as read-only and non-blocking */
@@ -996,7 +996,7 @@ int main(int argc, char **argv) dev_vec devices = list_devices(); if (devices.empty()) { fprintf(stderr, "No RDS-capable device found\n"); - exit(1); + std::exit(EXIT_FAILURE); } strncpy(params.fd_name, devices[0].c_str(), sizeof(params.fd_name)); params.fd_name[sizeof(params.fd_name) - 1] = '\0';
@@ -1005,7 +1005,7 @@ int main(int argc, char **argv) if ((fd = open(params.fd_name, O_RDONLY | O_NONBLOCK)) < 0) { fprintf(stderr, "Failed to open %s: %s\n", params.fd_name, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } doioctl(fd, VIDIOC_QUERYCAP, &vcap);
@@ -1021,5 +1021,5 @@ int main(int argc, char **argv) read_rds_from_fd(fd); close(fd); - exit(app_result); + std::exit(app_result); }
utils/v4l2-compliance/v4l2-compliance.cpp +13 -13
@@ -486,7 +486,7 @@ static void signal_handler_interrupt(int signum) { restoreState(); printf("\n"); - exit(-1); + std::exit(EXIT_FAILURE); } static void determine_codec_mask(struct node &node)
@@ -1544,7 +1544,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - exit(0); + std::exit(EXIT_FAILURE); case OptSetDevice: device = make_devname(optarg, "video", media_bus_info); break;
@@ -1619,7 +1619,7 @@ int main(int argc, char **argv) color_component = 2; else { usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case 1:
@@ -1634,7 +1634,7 @@ int main(int argc, char **argv) break; default: usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -1647,7 +1647,7 @@ int main(int argc, char **argv) show_colors = isatty(STDOUT_FILENO); else { usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptNoWarnings:
@@ -1669,13 +1669,13 @@ int main(int argc, char **argv) fprintf(stderr, "Option `%s' requires a value\n", argv[optind]); usage(); - exit(1); + std::exit(EXIT_FAILURE); case '?': if (argv[optind]) fprintf(stderr, "Unknown argument `%s'\n", argv[optind]); usage(); - exit(1); + std::exit(EXIT_FAILURE); } } if (optind < argc) {
@@ -1684,7 +1684,7 @@ int main(int argc, char **argv) fprintf(stderr, "%s ", argv[optind++]); fprintf(stderr, "\n"); usage(); - exit(1); + std::exit(EXIT_FAILURE); } bool direct = !options[OptUseWrapper]; int fd;
@@ -1694,12 +1694,12 @@ int main(int argc, char **argv) if (type == MEDIA_TYPE_CANT_STAT) { fprintf(stderr, "Cannot open device %s, exiting.\n", device.c_str()); - exit(1); + std::exit(EXIT_FAILURE); } if (type == MEDIA_TYPE_UNKNOWN) { fprintf(stderr, "Unable to detect what device %s is, exiting.\n", device.c_str()); - exit(1); + std::exit(EXIT_FAILURE); } node.device = device.c_str();
@@ -1721,7 +1721,7 @@ int main(int argc, char **argv) if (fd < 0) { fprintf(stderr, "Failed to open %s: %s\n", device.c_str(), strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } if (!expbuf_device.empty()) {
@@ -1731,7 +1731,7 @@ int main(int argc, char **argv) if (fd < 0) { fprintf(stderr, "Failed to open %s: %s\n", expbuf_device.c_str(), strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } }
@@ -1742,5 +1742,5 @@ int main(int argc, char **argv) if (media_fd >= 0) close(media_fd); - exit(app_result); + std::exit(app_result); }
utils/v4l2-compliance/v4l2-compliance.h +2 -2
@@ -208,7 +208,7 @@ private: COLOR_BOLD("warn") : "warn", \ __FILE__, __LINE__, ##args); \ if (exit_on_warn) \ - exit(1); \ + std::exit(EXIT_FAILURE); \ } while (0) #define warn_once(fmt, args...) \
@@ -232,7 +232,7 @@ private: printf("\t\t%s: %s(%d): " fmt, show_colors ? \ COLOR_RED("fail") : "fail", __FILE__, __LINE__, ##args); \ if (exit_on_fail) \ - exit(1); \ + std::exit(EXIT_FAILURE); \ 1; \ })
utils/v4l2-compliance/v4l2-test-buffers.cpp +2 -2
@@ -2254,7 +2254,7 @@ static int testBlockingDQBuf(struct node *node, cv4l_queue &q) cv4l_buffer buf(q.g_type(), V4L2_MEMORY_MMAP); node->dqbuf(buf); - exit(0); + std::exit(EXIT_SUCCESS); } /* Wait for the child process to start and block */
@@ -2273,7 +2273,7 @@ static int testBlockingDQBuf(struct node *node, cv4l_queue &q) * be blocked by the DQBUF! */ node->streamoff(q.g_type()); - exit(0); + std::exit(EXIT_SUCCESS); } int wstatus_streamoff = 0;
utils/v4l2-ctl/v4l2-ctl-common.cpp +7 -7
@@ -695,13 +695,13 @@ void common_process_controls(cv4l_fd &fd) for (ctrl_get_list::iterator iter = get_ctrls.begin(); iter != get_ctrls.end(); ++iter) { if (ctrl_str2q.find(*iter) == ctrl_str2q.end()) { fprintf(stderr, "unknown control '%s'\n", iter->c_str()); - exit(1); + std::exit(EXIT_FAILURE); } } for (ctrl_set_map::iterator iter = set_ctrls.begin(); iter != set_ctrls.end(); ++iter) { if (ctrl_str2q.find(iter->first) == ctrl_str2q.end()) { fprintf(stderr, "unknown control '%s'\n", iter->first.c_str()); - exit(1); + std::exit(EXIT_FAILURE); } } }
@@ -806,11 +806,11 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) while (*subs != '\0') { if (parse_next_subopt(&subs, &value)) { common_usage(); - exit(1); + std::exit(EXIT_FAILURE); } if (strchr(value, '=')) { common_usage(); - exit(1); + std::exit(EXIT_FAILURE); } else { get_ctrls.push_back(value);
@@ -822,21 +822,21 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) while (*subs != '\0') { if (parse_next_subopt(&subs, &value)) { common_usage(); - exit(1); + std::exit(EXIT_FAILURE); } if (const char *equal = strchr(value, '=')) { set_ctrls[std::string(value, (equal - value))] = equal + 1; } else { fprintf(stderr, "control '%s' without '='\n", value); - exit(1); + std::exit(EXIT_FAILURE); } } break; case OptSubset: if (parse_subset(optarg)) { common_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptSetPriority:
utils/v4l2-ctl/v4l2-ctl-edid.cpp +14 -14
@@ -233,7 +233,7 @@ static void edid_add_block(struct v4l2_edid *e) fprintf(stderr, "edid file error: too long\n"); free(e->edid); e->edid = NULL; - exit(1); + std::exit(EXIT_FAILURE); } e->edid = static_cast<unsigned char *>(realloc(e->edid, e->blocks * 128)); }
@@ -986,13 +986,13 @@ void edid_cmd(int ch, char *optarg) if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); edid_usage(); - exit(1); + std::exit(EXIT_FAILURE); } if (value == NULL && opt <= 8) { fprintf(stderr, "No value given to suboption <%s>\n", subopts[opt]); edid_usage(); - exit(1); + std::exit(EXIT_FAILURE); } switch (opt) { case 0:
@@ -1020,11 +1020,11 @@ void edid_cmd(int ch, char *optarg) sedid.blocks = sizeof(hdmi_edid) / 128; } else { edid_usage(); - exit(1); + std::exit(EXIT_FAILURE); } if (file_in) { fprintf(stderr, "The edid and file options can't be used together.\n"); - exit(1); + std::exit(EXIT_FAILURE); } break; case 3:
@@ -1032,7 +1032,7 @@ void edid_cmd(int ch, char *optarg) file_in = value; if (sedid.edid) { fprintf(stderr, "The edid and file options can't be used together.\n"); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -1043,7 +1043,7 @@ void edid_cmd(int ch, char *optarg) sformat = RAW; } else { edid_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case 5:
@@ -1109,7 +1109,7 @@ void edid_cmd(int ch, char *optarg) case 56: toggle_speaker3_flags |= SPEAKER3_TPLS_TPRS; break; default: edid_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -1145,7 +1145,7 @@ void edid_cmd(int ch, char *optarg) gedid.start_block = strtoul(value, 0, 0); if (gedid.start_block > 255) { fprintf(stderr, "startblock %d too large, max 255\n", gedid.start_block); - exit(1); + std::exit(EXIT_FAILURE); } break; case 2:
@@ -1160,7 +1160,7 @@ void edid_cmd(int ch, char *optarg) gformat = CARRAY; } else { edid_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case 4:
@@ -1169,7 +1169,7 @@ void edid_cmd(int ch, char *optarg) break; default: edid_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } if (gedid.start_block + gedid.blocks > 256)
@@ -1209,7 +1209,7 @@ void edid_set(cv4l_fd &_fd) if (!fin) { fprintf(stderr, "Failed to open %s: %s\n", file_in, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } } if (fin) {
@@ -1217,7 +1217,7 @@ void edid_set(cv4l_fd &_fd) if (sedid.blocks == 0) { fprintf(stderr, "%s contained an empty EDID, ignoring.\n", file_in ? file_in : "stdin"); - exit(1); + std::exit(EXIT_FAILURE); } } if (toggle_cta861_hdr_flags || phys_addr >= 0) {
@@ -1329,7 +1329,7 @@ void edid_get(cv4l_fd &_fd) if (!fout) { fprintf(stderr, "Failed to open %s: %s\n", file_out, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } } gedid.edid = static_cast<unsigned char *>(malloc(gedid.blocks * 128));
utils/v4l2-ctl/v4l2-ctl-meta.cpp +1 -1
@@ -49,7 +49,7 @@ void meta_cmd(int ch, char *optarg) case OptTryMetaOutFormat: if (strlen(optarg) == 0) { meta_usage(); - exit(1); + std::exit(EXIT_FAILURE); } else if (strlen(optarg) == 4) { vfmt.fmt.meta.dataformat = v4l2_fourcc(optarg[0], optarg[1], optarg[2], optarg[3]);
utils/v4l2-ctl/v4l2-ctl-misc.cpp +3 -3
@@ -230,7 +230,7 @@ void misc_cmd(int ch, char *optarg) default: if (opt < 0 || opt > 15) { misc_usage(); - exit(1); + std::exit(EXIT_FAILURE); } len = strlen(value); if (len > sizeof(jpegcomp.APP_data) - 1)
@@ -266,7 +266,7 @@ void misc_cmd(int ch, char *optarg) break; default: misc_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -304,7 +304,7 @@ void misc_cmd(int ch, char *optarg) break; default: misc_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
utils/v4l2-ctl/v4l2-ctl-sdr.cpp +1 -1
@@ -52,7 +52,7 @@ void sdr_cmd(int ch, char *optarg) case OptTrySdrOutFormat: if (strlen(optarg) == 0) { sdr_usage(); - exit(1); + std::exit(EXIT_FAILURE); } else if (strlen(optarg) == 4) { vfmt.fmt.sdr.pixelformat = v4l2_fourcc(optarg[0], optarg[1], optarg[2], optarg[3]);
utils/v4l2-ctl/v4l2-ctl-selection.cpp +4 -4
@@ -136,7 +136,7 @@ static void parse_crop(char *optarg, unsigned int &set_crop, v4l2_rect &vcrop) break; default: selection_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } }
@@ -184,7 +184,7 @@ static int parse_selection(char *optarg, unsigned int &set_sel, v4l2_selection & if (parse_selection_target(value, vsel.target)) { fprintf(stderr, "Unknown selection target\n"); selection_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case 1:
@@ -210,7 +210,7 @@ static int parse_selection(char *optarg, unsigned int &set_sel, v4l2_selection & default: fprintf(stderr, "Unknown option\n"); selection_usage(); - exit(1); + std::exit(EXIT_FAILURE); } }
@@ -262,7 +262,7 @@ void selection_cmd(int ch, char *optarg) if (parse_selection(optarg, get_sel, gsel)) { fprintf(stderr, "Unknown selection target\n"); selection_usage(); - exit(1); + std::exit(EXIT_FAILURE); } get_sel_target = gsel.target; break;
utils/v4l2-ctl/v4l2-ctl-stds.cpp +8 -8
@@ -102,7 +102,7 @@ static v4l2_std_id parse_pal(const char *pal) } fprintf(stderr, "pal specifier not recognised\n"); stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } static v4l2_std_id parse_secam(const char *secam)
@@ -124,7 +124,7 @@ static v4l2_std_id parse_secam(const char *secam) } fprintf(stderr, "secam specifier not recognised\n"); stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } static v4l2_std_id parse_ntsc(const char *ntsc)
@@ -141,7 +141,7 @@ static v4l2_std_id parse_ntsc(const char *ntsc) } fprintf(stderr, "ntsc specifier not recognised\n"); stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } enum timing_opts {
@@ -204,13 +204,13 @@ static int parse_timing_subopt(char **subopt_str, int *value) if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } if (opt_str == NULL && opt != CVT && opt != GTF && opt != CLEAR) { fprintf(stderr, "No value given to suboption <%s>\n", subopt_list[opt]); stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } if (opt_str)
@@ -269,7 +269,7 @@ static void get_cvt_gtf_timings(char *subopt, int standard, if (!timings_valid) { stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } }
@@ -356,7 +356,7 @@ static void parse_dv_bt_timings(char *optarg, struct v4l2_dv_timings *dv_timings break; default: stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } set_dv_timing_opts |= 1 << opt; }
@@ -464,7 +464,7 @@ void stds_cmd(int ch, char *optarg) } else { fprintf(stderr, "Unknown standard '%s'\n", optarg); stds_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptSetDvBtTimings:
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +13 -13
@@ -1677,12 +1677,12 @@ static FILE *open_output_file(cv4l_fd &fd) host_fd_to = socket(AF_INET, SOCK_STREAM, 0); if (host_fd_to < 0) { fprintf(stderr, "cannot open socket"); - exit(0); + std::exit(EXIT_SUCCESS); } server = gethostbyname(host_to); if (server == NULL) { fprintf(stderr, "no such host %s\n", host_to); - exit(0); + std::exit(EXIT_SUCCESS); } memset(reinterpret_cast<char *>(&serv_addr), 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET;
@@ -1692,7 +1692,7 @@ static FILE *open_output_file(cv4l_fd &fd) serv_addr.sin_port = htons(host_port_to); if (connect(host_fd_to, reinterpret_cast<struct sockaddr *>(&serv_addr), sizeof(serv_addr)) < 0) { fprintf(stderr, "could not connect\n"); - exit(0); + std::exit(EXIT_SUCCESS); } fout = fdopen(host_fd_to, "a"); write_u32(fout, V4L_STREAM_ID);
@@ -1937,30 +1937,30 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) listen_fd = socket(AF_INET, SOCK_STREAM, 0); if (listen_fd < 0) { fprintf(stderr, "could not opening socket\n"); - exit(1); + std::exit(EXIT_FAILURE); } serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = INADDR_ANY; serv_addr.sin_port = htons(host_port_from); if (bind(listen_fd, reinterpret_cast<struct sockaddr *>(&serv_addr), sizeof(serv_addr)) < 0) { fprintf(stderr, "could not bind\n"); - exit(1); + std::exit(EXIT_FAILURE); } listen(listen_fd, 1); clilen = sizeof(cli_addr); host_fd_from = accept(listen_fd, reinterpret_cast<struct sockaddr *>(&cli_addr), &clilen); if (host_fd_from < 0) { fprintf(stderr, "could not accept\n"); - exit(1); + std::exit(EXIT_FAILURE); } fin = fdopen(host_fd_from, "r"); if (read_u32(fin) != V4L_STREAM_ID) { fprintf(stderr, "unknown protocol ID\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (read_u32(fin) != V4L_STREAM_VERSION) { fprintf(stderr, "unknown protocol version\n"); - exit(1); + std::exit(EXIT_FAILURE); } for (;;) { __u32 packet = read_u32(fin);
@@ -1968,7 +1968,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) if (packet == V4L_STREAM_PACKET_END) { fprintf(stderr, "END packet read\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (packet == V4L_STREAM_PACKET_FMT_VIDEO)
@@ -1982,7 +1982,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) n = fread(buf, 1, rdsize, fin); if (n < 0) { fprintf(stderr, "error reading %d bytes\n", sz); - exit(1); + std::exit(EXIT_FAILURE); } sz -= n; }
@@ -1995,7 +1995,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) if (sz != V4L_STREAM_PACKET_FMT_VIDEO_SIZE_FMT) { fprintf(stderr, "unsupported FMT_VIDEO size\n"); - exit(1); + std::exit(EXIT_FAILURE); } cfmt.s_num_planes(read_u32(fin)); cfmt.s_pixelformat(read_u32(fin));
@@ -2023,7 +2023,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) if (sz != V4L_STREAM_PACKET_FMT_VIDEO_SIZE_FMT_PLANE) { fprintf(stderr, "unsupported FMT_VIDEO plane size\n"); - exit(1); + std::exit(EXIT_FAILURE); } cfmt.s_sizeimage(read_u32(fin), i); cfmt.s_bytesperline(read_u32(fin), i);
@@ -2031,7 +2031,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) } if (fd.s_fmt(cfmt)) { fprintf(stderr, "failed to set new format\n"); - exit(1); + std::exit(EXIT_FAILURE); } return fin; }
utils/v4l2-ctl/v4l2-ctl-subdev.cpp +9 -9
@@ -128,7 +128,7 @@ void subdev_cmd(int ch, char *optarg) break; default: subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -158,7 +158,7 @@ void subdev_cmd(int ch, char *optarg) break; default: subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -184,13 +184,13 @@ void subdev_cmd(int ch, char *optarg) if (parse_selection_target(value, target)) { fprintf(stderr, "Unknown selection target\n"); subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } get_sel_target = target; break; default: subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -263,7 +263,7 @@ void subdev_cmd(int ch, char *optarg) default: fprintf(stderr, "Unknown option\n"); subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -288,7 +288,7 @@ void subdev_cmd(int ch, char *optarg) if (parse_selection_target(value, vsel.target)) { fprintf(stderr, "Unknown selection target\n"); subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case 1:
@@ -317,7 +317,7 @@ void subdev_cmd(int ch, char *optarg) default: fprintf(stderr, "Unknown option\n"); subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -341,7 +341,7 @@ void subdev_cmd(int ch, char *optarg) default: fprintf(stderr, "Unknown option\n"); subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -484,7 +484,7 @@ void subdev_set(cv4l_fd &_fd) if (set_fps <= 0) { fprintf(stderr, "invalid fps %f\n", set_fps); subdev_usage(); - exit(1); + std::exit(EXIT_FAILURE); } fival.interval.numerator = 1000; fival.interval.denominator = static_cast<uint32_t>(set_fps * fival.interval.numerator);
utils/v4l2-ctl/v4l2-ctl-tuner.cpp +3 -3
@@ -198,7 +198,7 @@ static void parse_freq_seek(char *optarg, struct v4l2_hw_freq_seek &seek) break; default: tuner_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } }
@@ -223,7 +223,7 @@ void tuner_cmd(int ch, char *optarg) else { fprintf(stderr, "Unknown audio mode\n"); tuner_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptSetModulator:
@@ -245,7 +245,7 @@ void tuner_cmd(int ch, char *optarg) else { fprintf(stderr, "Unknown txsubchans value\n"); tuner_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptFreqSeek:
utils/v4l2-ctl/v4l2-ctl-vbi.cpp +2 -2
@@ -95,7 +95,7 @@ void vbi_cmd(int ch, char *optarg) if (optarg[0] == 0) { fprintf(stderr, "empty string\n"); vbi_usage(); - exit(1); + std::exit(EXIT_FAILURE); } while (*optarg) { subs = strchr(optarg, ',');
@@ -125,7 +125,7 @@ void vbi_cmd(int ch, char *optarg) if (found_off && sliced->fmt.sliced.service_set) { fprintf(stderr, "Sliced VBI mode 'off' cannot be combined with other modes\n"); vbi_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptSetVbiOutFormat:
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +8 -8
@@ -113,7 +113,7 @@ void vidcap_cmd(int ch, char *optarg) if (!set_fmts || (set_fmts & (FmtColorspace | FmtYCbCr | FmtQuantization | FmtXferFunc))) { vidcap_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptListFrameSizes:
@@ -127,7 +127,7 @@ void vidcap_cmd(int ch, char *optarg) frmsize.pixel_format = strtol(optarg, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg); - exit(1); + std::exit(EXIT_FAILURE); } break; case OptListFrameIntervals:
@@ -159,12 +159,12 @@ void vidcap_cmd(int ch, char *optarg) frmival.pixel_format = strtol(value, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg); - exit(1); + std::exit(EXIT_FAILURE); } break; default: vidcap_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } break;
@@ -317,14 +317,14 @@ void vidcap_list(cv4l_fd &fd) false, is_multiplanar); if (!frmsize.pixel_format) { fprintf(stderr, "The pixelformat index was invalid\n"); - exit(1); + std::exit(EXIT_FAILURE); } } if (!valid_pixel_format(fd.g_fd(), frmsize.pixel_format, false, is_multiplanar) && !valid_pixel_format(fd.g_fd(), frmsize.pixel_format, true, is_multiplanar)) { fprintf(stderr, "The pixelformat '%s' is invalid\n", fcc2s(frmsize.pixel_format).c_str()); - exit(1); + std::exit(EXIT_FAILURE); } printf("ioctl: VIDIOC_ENUM_FRAMESIZES\n");
@@ -342,13 +342,13 @@ void vidcap_list(cv4l_fd &fd) false, is_multiplanar); if (!frmival.pixel_format) { fprintf(stderr, "The pixelformat index was invalid\n"); - exit(1); + std::exit(EXIT_FAILURE); } } if (!valid_pixel_format(fd.g_fd(), frmival.pixel_format, false, is_multiplanar)) { fprintf(stderr, "The pixelformat '%s' is invalid\n", fcc2s(frmival.pixel_format).c_str()); - exit(1); + std::exit(EXIT_FAILURE); } printf("ioctl: VIDIOC_ENUM_FRAMEINTERVALS\n");
utils/v4l2-ctl/v4l2-ctl-vidout.cpp +2 -2
@@ -99,7 +99,7 @@ void vidout_cmd(int ch, char *optarg) sizeimage); if (!set_fmts_out) { vidcap_usage(); - exit(1); + std::exit(EXIT_FAILURE); } break; }
@@ -202,7 +202,7 @@ void vidout_set(cv4l_fd &_fd) fcc2s(pixfmt).c_str()); else fprintf(stderr, "The pixelformat index was invalid\n"); - exit(1); + std::exit(EXIT_FAILURE); } if (options[OptSetVideoOutFormat])
utils/v4l2-ctl/v4l2-ctl.cpp +15 -15
@@ -795,7 +795,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat, pixelformat = strtol(value, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", value); - exit(1); + std::exit(EXIT_FAILURE); } fmts |= FmtPixelFormat; break;
@@ -931,7 +931,7 @@ static __u32 parse_event(const char *e, const char **name) if (event == V4L2_EVENT_CTRL) { fprintf(stderr, "Missing control name for ctrl event, use ctrl=<name>\n"); misc_usage(); - exit(1); + std::exit(EXIT_FAILURE); } } else if (!strcmp(e, "eos")) { event = V4L2_EVENT_EOS;
@@ -954,7 +954,7 @@ static __u32 parse_event(const char *e, const char **name) if (event == 0) { fprintf(stderr, "Unknown event\n"); misc_usage(); - exit(1); + std::exit(EXIT_FAILURE); } return event; }
@@ -1288,7 +1288,7 @@ int main(int argc, char **argv) if (type == MEDIA_TYPE_CANT_STAT) { fprintf(stderr, "Cannot open device %s, exiting.\n", device); - exit(1); + std::exit(EXIT_FAILURE); } switch (type) {
@@ -1308,7 +1308,7 @@ int main(int argc, char **argv) if (type == MEDIA_TYPE_UNKNOWN) { fprintf(stderr, "Unable to detect what device %s is, exiting.\n", device); - exit(1); + std::exit(EXIT_FAILURE); } is_subdev = type == MEDIA_TYPE_SUBDEV; if (is_subdev)
@@ -1325,14 +1325,14 @@ int main(int argc, char **argv) if (fd < 0) { fprintf(stderr, "Failed to open %s: %s\n", device, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } verbose = options[OptVerbose]; c_fd.s_trace(options[OptSilent] ? 0 : (verbose ? 2 : 1)); if (!is_subdev && doioctl(fd, VIDIOC_QUERYCAP, &vcap)) { fprintf(stderr, "%s: not a v4l2 node\n", device); - exit(1); + std::exit(EXIT_FAILURE); } capabilities = vcap.capabilities; if (capabilities & V4L2_CAP_DEVICE_CAPS)
@@ -1356,12 +1356,12 @@ int main(int argc, char **argv) if (out_fd < 0) { fprintf(stderr, "Failed to open %s: %s\n", out_device, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } c_out_fd.s_trace(options[OptSilent] ? 0 : (verbose ? 2 : 1)); if (doioctl(out_fd, VIDIOC_QUERYCAP, &vcap)) { fprintf(stderr, "%s: not a v4l2 node\n", out_device); - exit(1); + std::exit(EXIT_FAILURE); } out_capabilities = vcap.capabilities; if (out_capabilities & V4L2_CAP_DEVICE_CAPS)
@@ -1375,12 +1375,12 @@ int main(int argc, char **argv) if (exp_fd < 0) { fprintf(stderr, "Failed to open %s: %s\n", export_device, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } c_exp_fd.s_trace(options[OptSilent] ? 0 : (verbose ? 2 : 1)); if (doioctl(exp_fd, VIDIOC_QUERYCAP, &vcap)) { fprintf(stderr, "%s: not a v4l2 node\n", export_device); - exit(1); + std::exit(EXIT_FAILURE); } }
@@ -1389,17 +1389,17 @@ int main(int argc, char **argv) if (wait_for_event == V4L2_EVENT_CTRL && wait_event_id) if (!common_find_ctrl_id(wait_event_id)) { fprintf(stderr, "unknown control '%s'\n", wait_event_id); - exit(1); + std::exit(EXIT_FAILURE); } if (poll_for_event == V4L2_EVENT_CTRL && poll_event_id) if (!common_find_ctrl_id(poll_event_id)) { fprintf(stderr, "unknown control '%s'\n", poll_event_id); - exit(1); + std::exit(EXIT_FAILURE); } if (epoll_for_event == V4L2_EVENT_CTRL && epoll_event_id) if (!common_find_ctrl_id(epoll_event_id)) { fprintf(stderr, "unknown control '%s'\n", epoll_event_id); - exit(1); + std::exit(EXIT_FAILURE); } if (options[OptAll]) {
@@ -1610,5 +1610,5 @@ int main(int argc, char **argv) // --all sets --silent to avoid ioctl errors to be shown when an ioctl // is not implemented by the driver. Which is fine, but we shouldn't // return an application error in that specific case. - exit(options[OptAll] ? 0 : app_result); + std::exit(options[OptAll] ? 0 : app_result); }
utils/v4l2-dbg/v4l2-dbg.cpp +6 -6
@@ -386,13 +386,13 @@ static int parse_subopt(char **subs, const char * const *subopts, char **value) if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); usage(); - exit(1); + std::exit(EXIT_FAILURE); } if (*value == NULL) { fprintf(stderr, "No value given to suboption <%s>\n", subopts[opt]); usage(); - exit(1); + std::exit(EXIT_FAILURE); } return opt; }
@@ -428,7 +428,7 @@ int main(int argc, char **argv) if (argc == 1) { usage(); - exit(0); + std::exit(EXIT_SUCCESS); } for (i = 0; long_options[i].name; i++) { if (!isalpha(long_options[i].val))
@@ -466,7 +466,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - exit(0); + std::exit(EXIT_SUCCESS); case OptSetDevice: device = optarg;
@@ -550,7 +550,7 @@ int main(int argc, char **argv) if ((fd = open(device, O_RDWR)) < 0) { fprintf(stderr, "Failed to open %s: %s\n", device, strerror(errno)); - exit(1); + std::exit(EXIT_FAILURE); } doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP");
@@ -814,5 +814,5 @@ list_done: } close(fd); - exit(0); + std::exit(EXIT_SUCCESS); }
Signature · 1 line
2.25.3