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
f49b5ca8
Commit
f49b5ca8
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
dmscript: Use CRT allocation functions.
parent
b02b32f9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
26 deletions
+17
-26
dmobject.c
dlls/dmscript/dmobject.c
+3
-4
script.c
dlls/dmscript/script.c
+12
-15
scripttrack.c
dlls/dmscript/scripttrack.c
+2
-7
No files found.
dlls/dmscript/dmobject.c
View file @
f49b5ca8
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#include "dmusics.h"
#include "dmusics.h"
#include "dmobject.h"
#include "dmobject.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dmobj
);
WINE_DEFAULT_DEBUG_CHANNEL
(
dmobj
);
WINE_DECLARE_DEBUG_CHANNEL
(
dmfile
);
WINE_DECLARE_DEBUG_CHANNEL
(
dmfile
);
...
@@ -375,7 +374,7 @@ HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk)
...
@@ -375,7 +374,7 @@ HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk)
/* Reads chunk data of the form:
/* Reads chunk data of the form:
DWORD - size of array element
DWORD - size of array element
element[] - Array of elements
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
,
HRESULT
stream_chunk_get_array
(
IStream
*
stream
,
const
struct
chunk_entry
*
chunk
,
void
**
array
,
unsigned
int
*
count
,
DWORD
elem_size
)
unsigned
int
*
count
,
DWORD
elem_size
)
...
@@ -400,10 +399,10 @@ HRESULT stream_chunk_get_array(IStream *stream, const struct chunk_entry *chunk,
...
@@ -400,10 +399,10 @@ HRESULT stream_chunk_get_array(IStream *stream, const struct chunk_entry *chunk,
*
count
=
(
chunk
->
size
-
sizeof
(
DWORD
))
/
elem_size
;
*
count
=
(
chunk
->
size
-
sizeof
(
DWORD
))
/
elem_size
;
size
=
*
count
*
elem_size
;
size
=
*
count
*
elem_size
;
if
(
!
(
*
array
=
heap_
alloc
(
size
)))
if
(
!
(
*
array
=
m
alloc
(
size
)))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
stream_read
(
stream
,
*
array
,
size
)))
{
if
(
FAILED
(
hr
=
stream_read
(
stream
,
*
array
,
size
)))
{
heap_
free
(
*
array
);
free
(
*
array
);
*
array
=
NULL
;
*
array
=
NULL
;
return
hr
;
return
hr
;
}
}
...
...
dlls/dmscript/script.c
View file @
f49b5ca8
...
@@ -89,11 +89,11 @@ static ULONG WINAPI IDirectMusicScriptImpl_Release(IDirectMusicScript *iface)
...
@@ -89,11 +89,11 @@ static ULONG WINAPI IDirectMusicScriptImpl_Release(IDirectMusicScript *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
!
ref
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pHeader
);
free
(
This
->
pHeader
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pVersion
);
free
(
This
->
pVersion
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pwzLanguage
);
free
(
This
->
pwzLanguage
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pwzSource
);
free
(
This
->
pwzSource
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -275,36 +275,36 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pS
...
@@ -275,36 +275,36 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pS
switch
(
Chunk
.
fccID
)
{
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_SCRIPT_CHUNK
:
{
case
DMUS_FOURCC_SCRIPT_CHUNK
:
{
TRACE_
(
dmfile
)(
": script header chunk
\n
"
);
TRACE_
(
dmfile
)(
": script header chunk
\n
"
);
This
->
pHeader
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
Chunk
.
dwSize
);
This
->
pHeader
=
calloc
(
1
,
Chunk
.
dwSize
);
IStream_Read
(
pStm
,
This
->
pHeader
,
Chunk
.
dwSize
,
NULL
);
IStream_Read
(
pStm
,
This
->
pHeader
,
Chunk
.
dwSize
,
NULL
);
break
;
break
;
}
}
case
DMUS_FOURCC_SCRIPTVERSION_CHUNK
:
{
case
DMUS_FOURCC_SCRIPTVERSION_CHUNK
:
{
TRACE_
(
dmfile
)(
": script version chunk
\n
"
);
TRACE_
(
dmfile
)(
": script version chunk
\n
"
);
This
->
pVersion
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
Chunk
.
dwSize
);
This
->
pVersion
=
calloc
(
1
,
Chunk
.
dwSize
);
IStream_Read
(
pStm
,
This
->
pVersion
,
Chunk
.
dwSize
,
NULL
);
IStream_Read
(
pStm
,
This
->
pVersion
,
Chunk
.
dwSize
,
NULL
);
TRACE_
(
dmfile
)(
"version: 0x%08lx.0x%08lx
\n
"
,
This
->
pVersion
->
dwVersionMS
,
This
->
pVersion
->
dwVersionLS
);
TRACE_
(
dmfile
)(
"version: 0x%08lx.0x%08lx
\n
"
,
This
->
pVersion
->
dwVersionMS
,
This
->
pVersion
->
dwVersionLS
);
break
;
break
;
}
}
case
DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK
:
{
case
DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK
:
{
TRACE_
(
dmfile
)(
": script language chunk
\n
"
);
TRACE_
(
dmfile
)(
": script language chunk
\n
"
);
This
->
pwzLanguage
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
Chunk
.
dwSize
);
This
->
pwzLanguage
=
calloc
(
1
,
Chunk
.
dwSize
);
IStream_Read
(
pStm
,
This
->
pwzLanguage
,
Chunk
.
dwSize
,
NULL
);
IStream_Read
(
pStm
,
This
->
pwzLanguage
,
Chunk
.
dwSize
,
NULL
);
TRACE_
(
dmfile
)(
"using language: %s
\n
"
,
debugstr_w
(
This
->
pwzLanguage
));
TRACE_
(
dmfile
)(
"using language: %s
\n
"
,
debugstr_w
(
This
->
pwzLanguage
));
break
;
break
;
}
}
case
DMUS_FOURCC_SCRIPTSOURCE_CHUNK
:
{
case
DMUS_FOURCC_SCRIPTSOURCE_CHUNK
:
{
TRACE_
(
dmfile
)(
": script source chunk
\n
"
);
TRACE_
(
dmfile
)(
": script source chunk
\n
"
);
This
->
pwzSource
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
Chunk
.
dwSize
);
This
->
pwzSource
=
calloc
(
1
,
Chunk
.
dwSize
);
IStream_Read
(
pStm
,
This
->
pwzSource
,
Chunk
.
dwSize
,
NULL
);
IStream_Read
(
pStm
,
This
->
pwzSource
,
Chunk
.
dwSize
,
NULL
);
if
(
TRACE_ON
(
dmscript
))
{
if
(
TRACE_ON
(
dmscript
))
{
int
count
=
WideCharToMultiByte
(
CP_ACP
,
0
,
This
->
pwzSource
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
int
count
=
WideCharToMultiByte
(
CP_ACP
,
0
,
This
->
pwzSource
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
LPSTR
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
);
LPSTR
str
=
malloc
(
count
);
WideCharToMultiByte
(
CP_ACP
,
0
,
This
->
pwzSource
,
-
1
,
str
,
count
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
This
->
pwzSource
,
-
1
,
str
,
count
,
NULL
,
NULL
);
str
[
count
-
1
]
=
'\n'
;
str
[
count
-
1
]
=
'\n'
;
TRACE
(
"source:
\n
"
);
TRACE
(
"source:
\n
"
);
fwrite
(
str
,
1
,
count
,
stderr
);
fwrite
(
str
,
1
,
count
,
stderr
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
free
(
str
);
}
}
break
;
break
;
}
}
...
@@ -497,10 +497,7 @@ HRESULT DMUSIC_CreateDirectMusicScriptImpl(REFIID lpcGUID, void **ppobj, IUnknow
...
@@ -497,10 +497,7 @@ HRESULT DMUSIC_CreateDirectMusicScriptImpl(REFIID lpcGUID, void **ppobj, IUnknow
if
(
pUnkOuter
)
if
(
pUnkOuter
)
return
CLASS_E_NOAGGREGATION
;
return
CLASS_E_NOAGGREGATION
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicScriptImpl
));
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
if
(
!
obj
)
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicScript_iface
.
lpVtbl
=
&
dmscript_vtbl
;
obj
->
IDirectMusicScript_iface
.
lpVtbl
=
&
dmscript_vtbl
;
obj
->
ref
=
1
;
obj
->
ref
=
1
;
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicScript
,
(
IUnknown
*
)
&
obj
->
IDirectMusicScript_iface
);
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicScript
,
(
IUnknown
*
)
&
obj
->
IDirectMusicScript_iface
);
...
...
dlls/dmscript/scripttrack.c
View file @
f49b5ca8
...
@@ -84,9 +84,7 @@ static ULONG WINAPI script_track_Release(IDirectMusicTrack8 *iface)
...
@@ -84,9 +84,7 @@ static ULONG WINAPI script_track_Release(IDirectMusicTrack8 *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
!
ref
)
free
(
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
return
ref
;
}
}
...
@@ -326,10 +324,7 @@ HRESULT DMUSIC_CreateDirectMusicScriptTrack(REFIID riid, void **ret_iface, IUnkn
...
@@ -326,10 +324,7 @@ HRESULT DMUSIC_CreateDirectMusicScriptTrack(REFIID riid, void **ret_iface, IUnkn
if
(
pUnkOuter
)
if
(
pUnkOuter
)
return
CLASS_E_NOAGGREGATION
;
return
CLASS_E_NOAGGREGATION
;
track
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
track
));
if
(
!
(
track
=
calloc
(
1
,
sizeof
(
*
track
))))
return
E_OUTOFMEMORY
;
if
(
!
track
)
return
E_OUTOFMEMORY
;
track
->
IDirectMusicTrack8_iface
.
lpVtbl
=
&
dmtrack8_vtbl
;
track
->
IDirectMusicTrack8_iface
.
lpVtbl
=
&
dmtrack8_vtbl
;
track
->
IPersistStream_iface
.
lpVtbl
=
&
persist_vtbl
;
track
->
IPersistStream_iface
.
lpVtbl
=
&
persist_vtbl
;
track
->
desc
.
dwSize
=
sizeof
(
track
->
desc
);
track
->
desc
.
dwSize
=
sizeof
(
track
->
desc
);
...
...
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