summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/out/ao_openal.c2
-rw-r--r--options/m_config.c14
-rw-r--r--options/m_option.c14
-rw-r--r--options/m_option.h5
-rw-r--r--options/parse_commandline.c5
-rw-r--r--player/main.c2
-rw-r--r--video/out/opengl/context.c2
-rw-r--r--video/out/opengl/video.c4
8 files changed, 22 insertions, 26 deletions
diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c
index 2c29b8923b..237226e4a5 100644
--- a/audio/out/ao_openal.c
+++ b/audio/out/ao_openal.c
@@ -96,7 +96,7 @@ static int validate_device_opt(struct mp_log *log, const m_option_t *opt,
mp_info(log, " '%s'\n", list);
list = list + strlen(list) + 1;
}
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
return 0;
}
diff --git a/options/m_config.c b/options/m_config.c
index 2bc187b444..50fa9248a1 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -116,13 +116,13 @@ static int parse_profile(struct m_config *config, const struct m_option *opt,
struct m_profile *p;
if (!config->profiles) {
MP_INFO(config, "No profiles have been defined.\n");
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
MP_INFO(config, "Available profiles:\n");
for (p = config->profiles; p; p = p->next)
MP_INFO(config, "\t%s\t%s\n", p->name, p->desc ? p->desc : "");
MP_INFO(config, "\n");
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
char **list = NULL;
@@ -148,7 +148,7 @@ static int show_profile(struct m_config *config, bstr param)
return M_OPT_MISSING_PARAM;
if (!(p = m_config_get_profile(config, param))) {
MP_ERR(config, "Unknown profile '%.*s'.\n", BSTR_P(param));
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
if (!config->profile_depth)
MP_INFO(config, "Profile %s: %s\n", p->name,
@@ -175,7 +175,7 @@ static int show_profile(struct m_config *config, bstr param)
config->profile_depth--;
if (!config->profile_depth)
MP_INFO(config, "\n");
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
static int list_options(struct m_config *config, bstr val, bool show_help)
@@ -814,7 +814,7 @@ static int parse_subopts(struct m_config *config, char *name, char *prefix,
abort();
r = m_config_parse_option(config,bstr0(n), bstr0(lst[2 * i + 1]), flags);
if (r < 0) {
- if (r > M_OPT_EXIT) {
+ if (r != M_OPT_EXIT) {
MP_ERR(config, "Error parsing suboption %s/%s (%s)\n",
name, lst[2 * i], m_option_strerror(r));
r = M_OPT_INVALID;
@@ -832,7 +832,7 @@ int m_config_parse_suboptions(struct m_config *config, char *name,
if (!subopts || !*subopts)
return 0;
int r = parse_subopts(config, name, "", bstr0(subopts), 0);
- if (r < 0 && r > M_OPT_EXIT) {
+ if (r < 0 && r != M_OPT_EXIT) {
MP_ERR(config, "Error parsing suboption %s (%s)\n",
name, m_option_strerror(r));
r = M_OPT_INVALID;
@@ -844,7 +844,7 @@ int m_config_set_option_ext(struct m_config *config, struct bstr name,
struct bstr param, int flags)
{
int r = m_config_parse_option(config, name, param, flags);
- if (r < 0 && r > M_OPT_EXIT) {
+ if (r < 0 && r != M_OPT_EXIT) {
MP_ERR(config, "Error parsing option %.*s (%s)\n",
BSTR_P(name), m_option_strerror(r));
r = M_OPT_INVALID;
diff --git a/options/m_option.c b/options/m_option.c
index fa9a9578ab..4ef5481ceb 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -2104,7 +2104,7 @@ static int parse_imgfmt(struct mp_log *log, const m_option_t *opt,
mp_info(log, " %s", list[i]);
mp_info(log, "\n");
talloc_free(list);
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
unsigned int fmt = mp_imgfmt_from_name(param, true);
@@ -2175,7 +2175,7 @@ static int parse_afmt(struct mp_log *log, const m_option_t *opt,
for (int i = 1; i < AF_FORMAT_COUNT; i++)
mp_info(log, " %s", af_fmt_to_str(i));
mp_info(log, "\n");
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
int fmt = 0;
@@ -2219,7 +2219,7 @@ static int parse_channels(struct mp_log *log, const m_option_t *opt,
mp_info(log, "\nOther values:\n"
" auto-safe\n");
}
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
bool auto_safe = bstr_equals0(param, "auto-safe");
@@ -2670,7 +2670,7 @@ static int get_obj_param(struct mp_log *log, bstr opt_name, bstr obj_name,
BSTR_P(opt_name), BSTR_P(obj_name), BSTR_P(name));
return M_OPT_UNKNOWN;
}
- if (r > M_OPT_EXIT)
+ if (r != M_OPT_EXIT)
mp_err(log, "Option %.*s: "
"Error while parsing %.*s parameter %.*s (%.*s)\n",
BSTR_P(opt_name), BSTR_P(obj_name), BSTR_P(name),
@@ -2696,7 +2696,7 @@ static int get_obj_param(struct mp_log *log, bstr opt_name, bstr obj_name,
}
r = m_config_set_option_ext(config, bstr0(opt), val, flags);
if (r < 0) {
- if (r > M_OPT_EXIT)
+ if (r != M_OPT_EXIT)
mp_err(log, "Option %.*s: "
"Error while parsing %.*s parameter %s (%.*s)\n",
BSTR_P(opt_name), BSTR_P(obj_name), opt, BSTR_P(val));
@@ -2776,7 +2776,7 @@ print_help: ;
mp_warn(log, "Option %.*s: item %.*s doesn't exist.\n",
BSTR_P(opt_name), BSTR_P(name));
}
- r = M_OPT_EXIT - 1;
+ r = M_OPT_EXIT;
exit:
free_str_list(&args);
@@ -2973,7 +2973,7 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt,
}
}
mp_info(log, "\n");
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
if (op == OP_CLR) {
diff --git a/options/m_option.h b/options/m_option.h
index a4019f411a..6435584716 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -417,8 +417,7 @@ struct m_option {
// On success parsers return a number >= 0.
//
// To indicate that MPlayer should exit without playing anything,
-// parsers return M_OPT_EXIT minus the number of parameters they
-// consumed: \ref M_OPT_EXIT or \ref M_OPT_EXIT-1.
+// parsers return M_OPT_EXIT.
//
// On error one of the following (negative) error codes is returned:
@@ -442,8 +441,6 @@ struct m_option {
#define M_OPT_PARSER_ERR -6
// Returned when MPlayer should exit. Used by various help stuff.
-/** M_OPT_EXIT must be the lowest number on this list.
- */
#define M_OPT_EXIT -7
char *m_option_strerror(int code);
diff --git a/options/parse_commandline.c b/options/parse_commandline.c
index ab1f28f72b..b90912e786 100644
--- a/options/parse_commandline.c
+++ b/options/parse_commandline.c
@@ -151,11 +151,10 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
if (mode == LOCAL)
flags |= M_SETOPT_BACKUP | M_SETOPT_CHECK_ONLY;
int r = m_config_set_option_ext(config, p.arg, p.param, flags);
- if (r <= M_OPT_EXIT) {
+ if (r == M_OPT_EXIT) {
ret = r;
goto err_out;
- }
- if (r < 0) {
+ } else if (r < 0) {
MP_FATAL(config, "Setting command line option '--%.*s=%.*s' failed.\n",
BSTR_P(p.arg), BSTR_P(p.param));
goto err_out;
diff --git a/player/main.c b/player/main.c
index 76300162f3..d4c31a4726 100644
--- a/player/main.c
+++ b/player/main.c
@@ -392,7 +392,7 @@ int mp_initialize(struct MPContext *mpctx, char **options)
int r = m_config_parse_mp_command_line(mpctx->mconfig, mpctx->playlist,
mpctx->global, options);
if (r < 0)
- return r <= M_OPT_EXIT ? -2 : -1;
+ return r == M_OPT_EXIT ? -2 : -1;
update_logging(mpctx);
}
diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c
index a22227562a..32e7c4a3d6 100644
--- a/video/out/opengl/context.c
+++ b/video/out/opengl/context.c
@@ -114,7 +114,7 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt,
mp_info(log, " auto (autodetect)\n");
for (int n = 0; n < MP_ARRAY_SIZE(backends); n++)
mp_info(log, " %s\n", backends[n]->name);
- return M_OPT_EXIT - 1;
+ return M_OPT_EXIT;
}
char s[20];
snprintf(s, sizeof(s), "%.*s", BSTR_P(param));
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 4b17d1ce12..546d9cc9e5 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -3535,7 +3535,7 @@ static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt,
int r = 1;
bool tscale = bstr_equals0(name, "tscale");
if (bstr_equals0(param, "help")) {
- r = M_OPT_EXIT - 1;
+ r = M_OPT_EXIT;
} else {
snprintf(s, sizeof(s), "%.*s", BSTR_P(param));
if (!handle_scaler_opt(s, tscale))
@@ -3564,7 +3564,7 @@ static int validate_window_opt(struct mp_log *log, const m_option_t *opt,
char s[20] = {0};
int r = 1;
if (bstr_equals0(param, "help")) {
- r = M_OPT_EXIT - 1;
+ r = M_OPT_EXIT;
} else {
snprintf(s, sizeof(s), "%.*s", BSTR_P(param));
const struct filter_window *window = mp_find_filter_window(s);