Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
23629d06
Commit
23629d06
authored
Jul 11, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jul 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmime: Simplify the track list parser.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
acb879c9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
51 deletions
+12
-51
segment.c
dlls/dmime/segment.c
+12
-51
No files found.
dlls/dmime/segment.c
View file @
23629d06
...
...
@@ -659,8 +659,7 @@ static HRESULT load_track(IDirectMusicSegment8Impl *This, IStream *pClonedStream
return
S_OK
;
}
static
HRESULT
parse_track_form
(
IDirectMusicSegment8Impl
*
This
,
DMUS_PRIVATE_CHUNK
*
pChunk
,
IStream
*
pStm
)
static
HRESULT
parse_track_form
(
IDirectMusicSegment8Impl
*
This
,
DWORD
size
,
IStream
*
pStm
)
{
HRESULT
hr
=
E_FAIL
;
DMUS_PRIVATE_CHUNK
Chunk
;
...
...
@@ -671,12 +670,7 @@ static HRESULT parse_track_form(IDirectMusicSegment8Impl *This, DMUS_PRIVATE_CHU
DMUS_IO_TRACK_EXTRAS_HEADER
track_xhdr
;
IDirectMusicTrack
*
pTrack
=
NULL
;
if
(
pChunk
->
fccID
!=
DMUS_FOURCC_TRACK_FORM
)
{
ERR_
(
dmfile
)(
": %s chunk should be a TRACK form
\n
"
,
debugstr_fourcc
(
pChunk
->
fccID
));
return
E_FAIL
;
}
StreamSize
=
pChunk
->
dwSize
-
sizeof
(
FOURCC
);
StreamSize
=
size
-
sizeof
(
FOURCC
);
StreamCount
=
0
;
do
{
...
...
@@ -819,52 +813,19 @@ static HRESULT parse_track_form(IDirectMusicSegment8Impl *This, DMUS_PRIVATE_CHU
return
S_OK
;
}
static
HRESULT
parse_track_list
(
IDirectMusicSegment8Impl
*
This
,
DWORD
StreamSize
,
IStream
*
pStm
)
static
HRESULT
parse_track_list
(
IDirectMusicSegment8Impl
*
This
,
IStream
*
stream
,
const
struct
chunk_entry
*
trkl
)
{
HRESULT
hr
=
E_FAIL
;
DMUS_PRIVATE_CHUNK
Chunk
;
DWORD
ListSize
[
3
],
ListCount
[
3
];
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
struct
chunk_entry
chunk
=
{.
parent
=
trkl
};
HRESULT
hr
;
ListSize
[
0
]
=
StreamSize
-
sizeof
(
FOURCC
);
ListCount
[
0
]
=
0
;
TRACE
(
"Parsing track list in %p: %s
\n
"
,
stream
,
debugstr_chunk
(
trkl
));
do
{
IStream_Read
(
pStm
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
ListCount
[
0
]
+=
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
)
+
Chunk
.
dwSize
;
TRACE_
(
dmfile
)(
": %s chunk (size = %d)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
switch
(
Chunk
.
fccID
)
{
case
FOURCC_RIFF
:
{
IStream_Read
(
pStm
,
&
Chunk
.
fccID
,
sizeof
(
FOURCC
),
NULL
);
TRACE_
(
dmfile
)(
": RIFF chunk of type %s"
,
debugstr_fourcc
(
Chunk
.
fccID
));
StreamSize
=
Chunk
.
dwSize
-
sizeof
(
FOURCC
);
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_TRACK_FORM
:
{
TRACE_
(
dmfile
)(
": TRACK form
\n
"
);
hr
=
parse_track_form
(
This
,
&
Chunk
,
pStm
);
if
(
FAILED
(
hr
))
return
hr
;
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown chunk (irrelevant & skipping)
\n
"
);
liMove
.
QuadPart
=
StreamSize
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
}
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown chunk (irrelevant & skipping)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
}
TRACE_
(
dmfile
)(
": ListCount[0] = %d < ListSize[0] = %d
\n
"
,
ListCount
[
0
],
ListSize
[
0
]);
}
while
(
ListCount
[
0
]
<
ListSize
[
0
]);
while
((
hr
=
stream_next_chunk
(
stream
,
&
chunk
))
==
S_OK
)
if
(
chunk
.
id
==
FOURCC_RIFF
&&
chunk
.
type
==
DMUS_FOURCC_TRACK_FORM
)
hr
=
parse_track_form
(
This
,
chunk
.
size
,
stream
);
return
S_OK
;
return
SUCCEEDED
(
hr
)
?
S_OK
:
hr
;
}
static
inline
void
dump_segment_header
(
DMUS_IO_SEGMENT_HEADER
*
h
,
DWORD
size
)
...
...
@@ -920,7 +881,7 @@ static HRESULT parse_segment_form(IDirectMusicSegment8Impl *This, IStream *strea
break
;
case
FOURCC_LIST
:
if
(
chunk
.
type
==
DMUS_FOURCC_TRACK_LIST
)
if
(
FAILED
(
hr
=
parse_track_list
(
This
,
chunk
.
size
,
stream
)))
if
(
FAILED
(
hr
=
parse_track_list
(
This
,
stream
,
&
chunk
)))
return
hr
;
break
;
case
FOURCC_RIFF
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment