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
8881ada9
Commit
8881ada9
authored
Nov 26, 2022
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Nov 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmstyle: Simplify parsing of a style track list.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53941
parent
72597b17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
102 deletions
+22
-102
styletrack.c
dlls/dmstyle/styletrack.c
+22
-102
No files found.
dlls/dmstyle/styletrack.c
View file @
8881ada9
...
...
@@ -303,8 +303,7 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
style_track_Join
};
static
HRESULT
parse_style_ref
(
IDirectMusicStyleTrack
*
This
,
DMUS_PRIVATE_CHUNK
*
pChunk
,
IStream
*
pStm
)
static
HRESULT
parse_style_ref
(
IDirectMusicStyleTrack
*
This
,
DWORD
size
,
IStream
*
pStm
)
{
DMUS_PRIVATE_CHUNK
Chunk
;
DWORD
ListSize
[
3
],
ListCount
[
3
];
...
...
@@ -314,12 +313,7 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK
IDirectMusicObject
*
pObject
=
NULL
;
LPDMUS_PRIVATE_STYLE_ITEM
pNewItem
=
NULL
;
if
(
pChunk
->
fccID
!=
DMUS_FOURCC_STYLE_REF_LIST
)
{
ERR_
(
dmfile
)(
": %s chunk should be a STYLE list
\n
"
,
debugstr_fourcc
(
pChunk
->
fccID
));
return
E_FAIL
;
}
ListSize
[
0
]
=
pChunk
->
dwSize
-
sizeof
(
FOURCC
);
ListSize
[
0
]
=
size
-
sizeof
(
FOURCC
);
ListCount
[
0
]
=
0
;
do
{
...
...
@@ -387,107 +381,33 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK
return
S_OK
;
}
static
HRESULT
parse_styletrack_list
(
IDirectMusicStyleTrack
*
This
,
DMUS_PRIVATE_CHUNK
*
pChunk
,
IStream
*
pStm
)
{
DMUS_PRIVATE_CHUNK
Chunk
;
DWORD
ListSize
[
3
],
ListCount
[
3
];
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
HRESULT
hr
;
if
(
pChunk
->
fccID
!=
DMUS_FOURCC_STYLE_TRACK_LIST
)
{
ERR_
(
dmfile
)(
": %s chunk should be a STYLETRACK list
\n
"
,
debugstr_fourcc
(
pChunk
->
fccID
));
return
E_FAIL
;
}
ListSize
[
0
]
=
pChunk
->
dwSize
-
sizeof
(
FOURCC
);
ListCount
[
0
]
=
0
;
do
{
IStream_Read
(
pStm
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
ListCount
[
0
]
+=
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
)
+
Chunk
.
dwSize
;
TRACE_
(
dmfile
)(
": %s chunk (size = %ld)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
switch
(
Chunk
.
fccID
)
{
case
FOURCC_LIST
:
{
IStream_Read
(
pStm
,
&
Chunk
.
fccID
,
sizeof
(
FOURCC
),
NULL
);
TRACE_
(
dmfile
)(
": LIST chunk of type %s"
,
debugstr_fourcc
(
Chunk
.
fccID
));
ListSize
[
1
]
=
Chunk
.
dwSize
-
sizeof
(
FOURCC
);
ListCount
[
1
]
=
0
;
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_STYLE_REF_LIST
:
{
TRACE_
(
dmfile
)(
": STYLE_REF list
\n
"
);
hr
=
parse_style_ref
(
This
,
&
Chunk
,
pStm
);
if
(
FAILED
(
hr
))
return
hr
;
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown (skipping)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
-
sizeof
(
FOURCC
);
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] = %ld < ListSize[0] = %ld
\n
"
,
ListCount
[
0
],
ListSize
[
0
]);
}
while
(
ListCount
[
0
]
<
ListSize
[
0
]);
return
S_OK
;
}
static
inline
IDirectMusicStyleTrack
*
impl_from_IPersistStream
(
IPersistStream
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicStyleTrack
,
dmobj
.
IPersistStream_iface
);
}
static
HRESULT
WINAPI
IPersistStreamImpl_Load
(
IPersistStream
*
iface
,
IStream
*
pSt
m
)
static
HRESULT
WINAPI
IPersistStreamImpl_Load
(
IPersistStream
*
iface
,
IStream
*
strea
m
)
{
IDirectMusicStyleTrack
*
This
=
impl_from_IPersistStream
(
iface
);
DMUS_PRIVATE_CHUNK
Chunk
;
LARGE_INTEGER
liMove
;
HRESULT
hr
;
FIXME
(
"(%p, %p): Loading not fully implemented yet
\n
"
,
This
,
pStm
);
IStream_Read
(
pStm
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
TRACE_
(
dmfile
)(
": %s chunk (size = %ld)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
switch
(
Chunk
.
fccID
)
{
case
FOURCC_LIST
:
{
IStream_Read
(
pStm
,
&
Chunk
.
fccID
,
sizeof
(
FOURCC
),
NULL
);
TRACE_
(
dmfile
)(
": %s chunk (size = %ld)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_STYLE_TRACK_LIST
:
{
TRACE_
(
dmfile
)(
": Chord track list
\n
"
);
hr
=
parse_styletrack_list
(
This
,
&
Chunk
,
pStm
);
if
(
FAILED
(
hr
))
return
hr
;
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unexpected chunk; loading failed)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
return
E_FAIL
;
}
}
TRACE_
(
dmfile
)(
": reading finished
\n
"
);
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unexpected chunk; loading failed)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
/* skip the rest of the chunk */
return
E_FAIL
;
}
}
IDirectMusicStyleTrack
*
This
=
impl_from_IPersistStream
(
iface
);
struct
chunk_entry
track
=
{
0
};
struct
chunk_entry
chunk
=
{.
parent
=
&
track
};
HRESULT
hr
;
return
S_OK
;
TRACE
(
"(%p, %p): Loading
\n
"
,
This
,
stream
);
if
(
!
stream
)
return
E_POINTER
;
if
(
stream_get_chunk
(
stream
,
&
track
)
!=
S_OK
||
track
.
id
!=
FOURCC_LIST
||
track
.
type
!=
DMUS_FOURCC_STYLE_TRACK_LIST
)
return
DMUS_E_TRACK_NOT_FOUND
;
while
((
hr
=
stream_next_chunk
(
stream
,
&
chunk
))
==
S_OK
)
if
(
chunk
.
id
==
FOURCC_LIST
&&
chunk
.
type
==
DMUS_FOURCC_STYLE_REF_LIST
)
if
(
FAILED
(
hr
=
parse_style_ref
(
This
,
chunk
.
size
,
stream
)))
break
;
return
SUCCEEDED
(
hr
)
?
S_OK
:
hr
;
}
static
const
IPersistStreamVtbl
persiststream_vtbl
=
{
...
...
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