1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-02 21:12:23 +00:00

demux_mkv: fix compiler warnings

Make TOOLS/matroska.pl output structs with fields sorted by name in
ebml_types.h to make the order of fields deterministic. Fix warnings in
demux_mkv.c caused by the first struct fields switching between scalar
and struct types due to non-deterministic ebml_types.h field order.
Since it's deterministic now, this shouldn't change anymore.

The warnings produced by the compilers are bogus, but we want to silence
them anyway, since this could make developers overlook legitimate
warnings.

What commits 7b52ba8, 6dd97cc, 4aae1ff were supposed to fix. An earlier
attempt sorted fields in the generated C source file, not the header
file. Hopefully this is the last commit concerning this issue...
This commit is contained in:
wm4 2013-11-04 23:49:22 +01:00
parent f330884b0a
commit b74edd4069
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ sub generate_c_header {
my $l = max(map { length $_->{valname} } values %{$el->{subelements}});
# Output each variable, with pointers for array (multiple) elements
for my $subel (values %{$el->{subelements}}) {
for my $subel (sort { $a->{definename} cmp $b->{definename} } values %{$el->{subelements}}) {
printf " %-${l}s %s%s;\n",
$subel->{valname}, $subel->{multiple}?'*':' ', $subel->{fieldname};
}

View File

@ -359,7 +359,7 @@ static int demux_mkv_read_info(demuxer_t *demuxer)
mkv_d->tc_scale = 1000000;
mkv_d->duration = 0;
struct ebml_info info = {{0}};
struct ebml_info info = {0};
struct ebml_parse_ctx parse_ctx = {0};
if (ebml_read_element(s, &parse_ctx, &info, &ebml_info_desc) < 0)
return -1;
@ -1730,7 +1730,7 @@ static int read_ebml_header(demuxer_t *demuxer)
if (ebml_read_id(s, NULL) != EBML_ID_EBML)
return 0;
struct ebml_ebml ebml_master = {0};
struct ebml_ebml ebml_master = {{0}};
struct ebml_parse_ctx parse_ctx = { .no_error_messages = true };
if (ebml_read_element(s, &parse_ctx, &ebml_master, &ebml_ebml_desc) < 0)
return 0;