1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-29 10:32:15 +00:00

options: drop unnecessary casts

the reason for these casts are unknown but they were presumably to
silence warnings 9 years ago. but it doesn't seem to be necessary
nowadays, so just drop the casts and also drop the `const` from the
compound literal type.

some small technical notes:

1. while string literals aren't `const` in C, writing to them is
   undefined (do not ask me why). and so compilers will typically put
   string literals into read only section anyways, regardless of
   weather `const` was used in the source or not. so this shouldn't make
   any difference codegen wise.
2. making the array of pointers `const` on the other hand might affect
   codegen, eg: `(char *const []){...}`. however, that'd trigger a lot
   of discarded qualifier warnings.
This commit is contained in:
NRK 2023-06-30 04:10:00 +06:00 committed by sfan5
parent 39957c251c
commit 0bfafd2451

View File

@ -1033,7 +1033,7 @@ static const struct MPOpts mp_default_opts = {
[STREAM_VIDEO] = -2,
[STREAM_SUB] = -2, }, },
.stream_lang = {
[STREAM_SUB] = (char**)(const char*[]) {"auto", NULL},
[STREAM_SUB] = (char *[]){ "auto", NULL },
},
.stream_auto_sel = true,
.subs_with_matching_audio = false,
@ -1057,7 +1057,7 @@ static const struct MPOpts mp_default_opts = {
.mf_fps = 1.0,
.display_tags = (char **)(const char*[]){
.display_tags = (char *[]){
"Artist", "Album", "Album_Artist", "Comment", "Composer",
"Date", "Description", "Genre", "Performer", "Rating",
"Series", "Title", "Track", "icy-title", "service_name",
@ -1067,7 +1067,7 @@ static const struct MPOpts mp_default_opts = {
.cuda_device = -1,
.watch_later_options = (char **)(const char*[]){
.watch_later_options = (char *[]){
"start",
"osd-level",
"speed",