From 5d6bcc59662e520b48362163d65e4dabaaada965 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 21 Feb 2023 19:47:27 +0100 Subject: [PATCH] Use enum for long options constants This avoids to manually assign values. --- app/src/cli.c | 84 ++++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/app/src/cli.c b/app/src/cli.c index 12c4b701..1851bad6 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -17,47 +17,49 @@ #define STR_IMPL_(x) #x #define STR(x) STR_IMPL_(x) -#define OPT_RENDER_EXPIRED_FRAMES 1000 -#define OPT_WINDOW_TITLE 1001 -#define OPT_PUSH_TARGET 1002 -#define OPT_ALWAYS_ON_TOP 1003 -#define OPT_CROP 1004 -#define OPT_RECORD_FORMAT 1005 -#define OPT_PREFER_TEXT 1006 -#define OPT_WINDOW_X 1007 -#define OPT_WINDOW_Y 1008 -#define OPT_WINDOW_WIDTH 1009 -#define OPT_WINDOW_HEIGHT 1010 -#define OPT_WINDOW_BORDERLESS 1011 -#define OPT_MAX_FPS 1012 -#define OPT_LOCK_VIDEO_ORIENTATION 1013 -#define OPT_DISPLAY_ID 1014 -#define OPT_ROTATION 1015 -#define OPT_RENDER_DRIVER 1016 -#define OPT_NO_MIPMAPS 1017 -#define OPT_CODEC_OPTIONS 1018 -#define OPT_FORCE_ADB_FORWARD 1019 -#define OPT_DISABLE_SCREENSAVER 1020 -#define OPT_SHORTCUT_MOD 1021 -#define OPT_NO_KEY_REPEAT 1022 -#define OPT_FORWARD_ALL_CLICKS 1023 -#define OPT_LEGACY_PASTE 1024 -#define OPT_ENCODER_NAME 1025 -#define OPT_POWER_OFF_ON_CLOSE 1026 -#define OPT_V4L2_SINK 1027 -#define OPT_DISPLAY_BUFFER 1028 -#define OPT_V4L2_BUFFER 1029 -#define OPT_TUNNEL_HOST 1030 -#define OPT_TUNNEL_PORT 1031 -#define OPT_NO_CLIPBOARD_AUTOSYNC 1032 -#define OPT_TCPIP 1033 -#define OPT_RAW_KEY_EVENTS 1034 -#define OPT_NO_DOWNSIZE_ON_ERROR 1035 -#define OPT_OTG 1036 -#define OPT_NO_CLEANUP 1037 -#define OPT_PRINT_FPS 1038 -#define OPT_NO_POWER_ON 1039 -#define OPT_CODEC 1040 +enum { + OPT_RENDER_EXPIRED_FRAMES = 1000, + OPT_WINDOW_TITLE, + OPT_PUSH_TARGET, + OPT_ALWAYS_ON_TOP, + OPT_CROP, + OPT_RECORD_FORMAT, + OPT_PREFER_TEXT, + OPT_WINDOW_X, + OPT_WINDOW_Y, + OPT_WINDOW_WIDTH, + OPT_WINDOW_HEIGHT, + OPT_WINDOW_BORDERLESS, + OPT_MAX_FPS, + OPT_LOCK_VIDEO_ORIENTATION, + OPT_DISPLAY_ID, + OPT_ROTATION, + OPT_RENDER_DRIVER, + OPT_NO_MIPMAPS, + OPT_CODEC_OPTIONS, + OPT_FORCE_ADB_FORWARD, + OPT_DISABLE_SCREENSAVER, + OPT_SHORTCUT_MOD, + OPT_NO_KEY_REPEAT, + OPT_FORWARD_ALL_CLICKS, + OPT_LEGACY_PASTE, + OPT_ENCODER_NAME, + OPT_POWER_OFF_ON_CLOSE, + OPT_V4L2_SINK, + OPT_DISPLAY_BUFFER, + OPT_V4L2_BUFFER, + OPT_TUNNEL_HOST, + OPT_TUNNEL_PORT, + OPT_NO_CLIPBOARD_AUTOSYNC, + OPT_TCPIP, + OPT_RAW_KEY_EVENTS, + OPT_NO_DOWNSIZE_ON_ERROR, + OPT_OTG, + OPT_NO_CLEANUP, + OPT_PRINT_FPS, + OPT_NO_POWER_ON, + OPT_CODEC, +}; struct sc_option { char shortopt;