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
307b13bc
Commit
307b13bc
authored
Sep 09, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: Use CRT allocation functions.
parent
30e5892c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
50 deletions
+37
-50
container.c
dlls/dmloader/container.c
+15
-18
dmobject.c
dlls/dmloader/dmobject.c
+3
-4
loader.c
dlls/dmloader/loader.c
+8
-11
loaderstream.c
dlls/dmloader/loaderstream.c
+11
-17
No files found.
dlls/dmloader/container.c
View file @
307b13bc
...
...
@@ -136,7 +136,7 @@ static ULONG WINAPI IDirectMusicContainerImpl_Release(IDirectMusicContainer *ifa
if
(
!
ref
)
{
if
(
This
->
pStream
)
destroy_dmcontainer
(
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -388,7 +388,7 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pS
case
DMUS_FOURCC_CONTAINED_OBJECT_LIST
:
{
LPWINE_CONTAINER_ENTRY
pNewEntry
;
TRACE_
(
dmfile
)(
": contained object list
\n
"
);
pNewEntry
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WINE_CONTAINER_ENTRY
));
pNewEntry
=
calloc
(
1
,
sizeof
(
*
pNewEntry
));
DM_STRUCT_INIT
(
&
pNewEntry
->
Desc
);
do
{
IStream_Read
(
pStm
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
...
...
@@ -397,7 +397,7 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pS
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_CONTAINED_ALIAS_CHUNK
:
{
TRACE_
(
dmfile
)(
": alias chunk
\n
"
);
pNewEntry
->
wszAlias
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
Chunk
.
dwSize
);
pNewEntry
->
wszAlias
=
calloc
(
1
,
Chunk
.
dwSize
);
IStream_Read
(
pStm
,
pNewEntry
->
wszAlias
,
Chunk
.
dwSize
,
NULL
);
TRACE_
(
dmfile
)(
": alias: %s
\n
"
,
debugstr_w
(
pNewEntry
->
wszAlias
));
break
;
...
...
@@ -649,24 +649,21 @@ static const IPersistStreamVtbl persiststream_vtbl = {
HRESULT
create_dmcontainer
(
REFIID
lpcGUID
,
void
**
ppobj
)
{
IDirectMusicContainerImpl
*
obj
;
HRESULT
hr
;
HRESULT
hr
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicContainerImpl
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
obj
->
IDirectMusicContainer_iface
.
lpVtbl
=
&
dmcontainer_vtbl
;
obj
->
ref
=
1
;
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicContainer
,
(
IUnknown
*
)
&
obj
->
IDirectMusicContainer_iface
);
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
dmobject_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
persiststream_vtbl
;
*
ppobj
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicContainer_iface
.
lpVtbl
=
&
dmcontainer_vtbl
;
obj
->
ref
=
1
;
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicContainer
,
(
IUnknown
*
)
&
obj
->
IDirectMusicContainer_iface
);
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
dmobject_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
persiststream_vtbl
;
obj
->
pContainedObjects
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
list
));
list_init
(
obj
->
pContainedObjects
);
hr
=
IDirectMusicContainer_QueryInterface
(
&
obj
->
IDirectMusicContainer_iface
,
lpcGUID
,
ppobj
);
IDirectMusicContainer_Release
(
&
obj
->
IDirectMusicContainer_iface
);
hr
=
IDirectMusicContainer_QueryInterface
(
&
obj
->
IDirectMusicContainer_iface
,
lpcGUID
,
ppobj
);
IDirectMusicContainer_Release
(
&
obj
->
IDirectMusicContainer_iface
);
return
hr
;
return
hr
;
}
dlls/dmloader/dmobject.c
View file @
307b13bc
...
...
@@ -28,7 +28,6 @@
#include "dmusics.h"
#include "dmobject.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dmobj
);
WINE_DECLARE_DEBUG_CHANNEL
(
dmfile
);
...
...
@@ -375,7 +374,7 @@ HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk)
/* Reads chunk data of the form:
DWORD - size of array element
element[] - Array of elements
The caller needs to
heap_
free() the array.
The caller needs to free() the array.
*/
HRESULT
stream_chunk_get_array
(
IStream
*
stream
,
const
struct
chunk_entry
*
chunk
,
void
**
array
,
unsigned
int
*
count
,
DWORD
elem_size
)
...
...
@@ -400,10 +399,10 @@ HRESULT stream_chunk_get_array(IStream *stream, const struct chunk_entry *chunk,
*
count
=
(
chunk
->
size
-
sizeof
(
DWORD
))
/
elem_size
;
size
=
*
count
*
elem_size
;
if
(
!
(
*
array
=
heap_
alloc
(
size
)))
if
(
!
(
*
array
=
m
alloc
(
size
)))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
stream_read
(
stream
,
*
array
,
size
)))
{
heap_
free
(
*
array
);
free
(
*
array
);
*
array
=
NULL
;
return
hr
;
}
...
...
dlls/dmloader/loader.c
View file @
307b13bc
...
...
@@ -155,8 +155,8 @@ static ULONG WINAPI IDirectMusicLoaderImpl_Release(IDirectMusicLoader8 *iface)
IDirectMusicLoader8_ClearCache
(
iface
,
&
GUID_DirectMusicAllTypes
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
classes
);
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
search_paths
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
search_paths
[
i
]);
free
(
This
);
}
return
ref
;
...
...
@@ -427,7 +427,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_GetObject(IDirectMusicLoader8 *ifac
bCache
=
is_cache_enabled
(
This
,
&
pDesc
->
guidClass
);
if
(
bCache
)
{
if
(
!
pObjectEntry
)
{
pObjectEntry
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
pObjectEntry
));
pObjectEntry
=
calloc
(
1
,
sizeof
(
*
pObjectEntry
));
DM_STRUCT_INIT
(
&
pObjectEntry
->
Desc
);
DMUSIC_CopyDescriptor
(
&
pObjectEntry
->
Desc
,
&
GotDesc
);
pObjectEntry
->
pObject
=
pObject
;
...
...
@@ -566,7 +566,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_SetObject(IDirectMusicLoader8 *ifac
TRACE
(
": adding alias entry with following info:
\n
"
);
if
(
TRACE_ON
(
dmloader
))
dump_DMUS_OBJECTDESC
(
pDesc
);
pNewEntry
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
pNewEntry
));
pNewEntry
=
calloc
(
1
,
sizeof
(
*
pNewEntry
));
/* use this function instead of pure memcpy due to streams (memcpy just copies pointer),
which is basically used further by app that called SetDescriptor... better safety than exception */
DMUSIC_CopyDescriptor
(
&
pNewEntry
->
Desc
,
pDesc
);
...
...
@@ -601,7 +601,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_SetSearchDirectory(IDirectMusicLoad
return
S_OK
;
if
(
!
This
->
search_paths
[
index
])
This
->
search_paths
[
index
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
);
This
->
search_paths
[
index
]
=
malloc
(
MAX_PATH
);
else
if
(
!
wcsncmp
(
This
->
search_paths
[
index
],
path
,
MAX_PATH
))
return
S_FALSE
;
...
...
@@ -743,7 +743,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_ClearCache(IDirectMusicLoader8 *ifa
/* basically, wrap to ReleaseObject for each object found */
IDirectMusicLoader8_ReleaseObject
(
iface
,
obj
->
pObject
);
list_remove
(
&
obj
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
obj
);
free
(
obj
);
}
}
...
...
@@ -910,11 +910,8 @@ HRESULT create_dmloader(REFIID lpcGUID, void **ppobj)
struct
list
*
pEntry
;
TRACE
(
"(%s, %p)
\n
"
,
debugstr_dmguid
(
lpcGUID
),
ppobj
);
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicLoaderImpl
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
*
ppobj
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicLoader8_iface
.
lpVtbl
=
&
DirectMusicLoader_Loader_Vtbl
;
obj
->
ref
=
0
;
/* Will be inited with QueryInterface */
list_init
(
&
obj
->
cache
);
...
...
dlls/dmloader/loaderstream.c
View file @
307b13bc
...
...
@@ -120,7 +120,7 @@ static ULONG WINAPI IDirectMusicLoaderFileStream_IStream_Release (LPSTREAM iface
if
(
dwRef
==
0
)
{
if
(
This
->
hFile
)
IDirectMusicLoaderFileStream_Detach
(
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
dwRef
;
...
...
@@ -290,11 +290,9 @@ HRESULT DMUSIC_CreateDirectMusicLoaderFileStream (void** ppobj) {
IDirectMusicLoaderFileStream
*
obj
;
TRACE
(
"(%p)
\n
"
,
ppobj
);
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicLoaderFileStream
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
*
ppobj
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
StreamVtbl
=
&
DirectMusicLoaderFileStream_Stream_Vtbl
;
obj
->
GetLoaderVtbl
=
&
DirectMusicLoaderFileStream_GetLoader_Vtbl
;
obj
->
dwRef
=
0
;
/* will be inited with QueryInterface */
...
...
@@ -367,7 +365,7 @@ static ULONG WINAPI IDirectMusicLoaderResourceStream_IStream_Release (LPSTREAM i
TRACE
(
"(%p): ReleaseRef to %ld
\n
"
,
This
,
dwRef
);
if
(
dwRef
==
0
)
{
IDirectMusicLoaderResourceStream_Detach
(
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
dwRef
;
...
...
@@ -547,11 +545,9 @@ HRESULT DMUSIC_CreateDirectMusicLoaderResourceStream (void** ppobj) {
IDirectMusicLoaderResourceStream
*
obj
;
TRACE
(
"(%p)
\n
"
,
ppobj
);
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicLoaderResourceStream
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
*
ppobj
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
StreamVtbl
=
&
DirectMusicLoaderResourceStream_Stream_Vtbl
;
obj
->
GetLoaderVtbl
=
&
DirectMusicLoaderResourceStream_GetLoader_Vtbl
;
obj
->
dwRef
=
0
;
/* will be inited with QueryInterface */
...
...
@@ -799,11 +795,9 @@ HRESULT DMUSIC_CreateDirectMusicLoaderGenericStream (void** ppobj) {
IDirectMusicLoaderGenericStream
*
obj
;
TRACE
(
"(%p)
\n
"
,
ppobj
);
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicLoaderGenericStream
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
*
ppobj
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
StreamVtbl
=
&
DirectMusicLoaderGenericStream_Stream_Vtbl
;
obj
->
GetLoaderVtbl
=
&
DirectMusicLoaderGenericStream_GetLoader_Vtbl
;
obj
->
dwRef
=
0
;
/* will be inited with QueryInterface */
...
...
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