Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
af79bf4f
Commit
af79bf4f
authored
Sep 10, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Rewrite collection ptbl chunk parsing.
parent
bb2a8312
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
8 deletions
+38
-8
collection.c
dlls/dmusic/collection.c
+38
-8
No files found.
dlls/dmusic/collection.c
View file @
af79bf4f
...
...
@@ -29,6 +29,14 @@ struct instrument_entry
IDirectMusicInstrument
*
instrument
;
};
struct
pool
{
POOLTABLE
table
;
POOLCUE
cues
[];
};
C_ASSERT
(
sizeof
(
struct
pool
)
==
offsetof
(
struct
pool
,
cues
[
0
]));
struct
collection
{
IDirectMusicCollection
IDirectMusicCollection_iface
;
...
...
@@ -38,10 +46,8 @@ struct collection
IStream
*
pStm
;
/* stream from which we load collection and later instruments */
CHAR
*
szCopyright
;
/* FIXME: should probably be placed somewhere else */
DLSHEADER
*
pHeader
;
/* pool table */
POOLTABLE
*
pPoolTable
;
POOLCUE
*
pPoolCues
;
struct
pool
*
pool
;
struct
list
instruments
;
};
...
...
@@ -204,6 +210,29 @@ static HRESULT parse_lins_list(struct collection *This, IStream *stream, struct
return
hr
;
}
static
HRESULT
parse_ptbl_chunk
(
struct
collection
*
This
,
IStream
*
stream
,
struct
chunk_entry
*
chunk
)
{
struct
pool
*
pool
;
POOLTABLE
table
;
HRESULT
hr
;
UINT
size
;
if
(
chunk
->
size
<
sizeof
(
table
))
return
E_INVALIDARG
;
if
(
FAILED
(
hr
=
stream_read
(
stream
,
&
table
,
sizeof
(
table
))))
return
hr
;
if
(
chunk
->
size
!=
table
.
cbSize
+
sizeof
(
POOLCUE
)
*
table
.
cCues
)
return
E_INVALIDARG
;
if
(
table
.
cbSize
!=
sizeof
(
table
))
return
E_INVALIDARG
;
size
=
offsetof
(
struct
pool
,
cues
[
table
.
cCues
]);
if
(
!
(
pool
=
malloc
(
size
)))
return
E_OUTOFMEMORY
;
pool
->
table
=
table
;
size
=
sizeof
(
POOLCUE
)
*
table
.
cCues
;
if
(
FAILED
(
hr
=
stream_read
(
stream
,
pool
->
cues
,
size
)))
free
(
pool
);
else
This
->
pool
=
pool
;
return
hr
;
}
static
HRESULT
WINAPI
collection_object_ParseDescriptor
(
IDirectMusicObject
*
iface
,
IStream
*
stream
,
DMUS_OBJECTDESC
*
desc
)
{
...
...
@@ -303,12 +332,13 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface,
break
;
}
case
FOURCC_PTBL
:
{
struct
chunk_entry
ptbl_chunk
=
{.
id
=
FOURCC_LIST
,
.
size
=
chunk
.
dwSize
,
.
type
=
chunk
.
fccID
};
TRACE_
(
dmfile
)(
": pool table chunk
\n
"
);
This
->
pPoolTable
=
calloc
(
1
,
sizeof
(
POOLTABLE
))
;
IStream_
Read
(
stream
,
This
->
pPoolTable
,
sizeof
(
POOLTABLE
),
NULL
);
chunk
.
dwSize
-=
sizeof
(
POOLTABLE
)
;
This
->
pPoolCues
=
calloc
(
This
->
pPoolTable
->
cCues
,
sizeof
(
POOLCUE
)
);
IStream_Read
(
stream
,
This
->
pPoolCues
,
chunk
.
dwSize
,
NULL
);
liMove
.
QuadPart
=
0
;
IStream_
Seek
(
stream
,
liMove
,
STREAM_SEEK_CUR
,
&
ptbl_chunk
.
offset
);
ptbl_chunk
.
offset
.
QuadPart
-=
12
;
parse_ptbl_chunk
(
This
,
stream
,
&
ptbl_chunk
);
stream_skip_chunk
(
stream
,
&
ptbl_chunk
);
break
;
}
case
FOURCC_LIST
:
{
...
...
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