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
ce578075
Commit
ce578075
authored
Dec 23, 2008
by
Christian Costa
Committed by
Alexandre Julliard
Dec 23, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dxof: Make FileEnumObject keep references to top level objects. Add corresponding test.
parent
29d4ab13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
5 deletions
+54
-5
d3dxof.c
dlls/d3dxof/d3dxof.c
+7
-0
d3dxof_private.h
dlls/d3dxof/d3dxof_private.h
+1
-0
d3dxof.c
dlls/d3dxof/tests/d3dxof.c
+46
-5
No files found.
dlls/d3dxof/d3dxof.c
View file @
ce578075
...
...
@@ -1909,6 +1909,9 @@ static ULONG WINAPI IDirectXFileEnumObjectImpl_Release(IDirectXFileEnumObject* i
if
(
!
ref
)
{
int
i
;
for
(
i
=
0
;
i
<
This
->
nb_xobjects
;
i
++
)
IDirectXFileData_Release
(
This
->
pRefObjects
[
i
]);
if
(
This
->
source
==
DXFILELOAD_FROMFILE
)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
buf
.
buffer
);
if
(
This
->
hFile
!=
INVALID_HANDLE_VALUE
)
...
...
@@ -2302,6 +2305,10 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
*
ppDataObj
=
(
LPDIRECTXFILEDATA
)
object
;
/* Get a reference to created object */
This
->
pRefObjects
[
This
->
nb_xobjects
]
=
(
LPDIRECTXFILEDATA
)
object
;
IDirectXFileData_AddRef
(
This
->
pRefObjects
[
This
->
nb_xobjects
]);
This
->
nb_xobjects
++
;
return
DXFILE_OK
;
...
...
dlls/d3dxof/d3dxof_private.h
View file @
ce578075
...
...
@@ -151,6 +151,7 @@ typedef struct {
IDirectXFileImpl
*
pDirectXFile
;
ULONG
nb_xobjects
;
xobject
*
xobjects
[
MAX_OBJECTS
];
IDirectXFileData
*
pRefObjects
[
MAX_OBJECTS
];
}
IDirectXFileEnumObjectImpl
;
typedef
struct
{
...
...
dlls/d3dxof/tests/d3dxof.c
View file @
ce578075
...
...
@@ -46,6 +46,13 @@ char template[] =
"DWORD flags;
\n
"
"}
\n
"
;
char
object
[]
=
"xof 0302txt 0064
\n
"
"Header Object
\n
"
"{
\n
"
"1; 2; 3;
\n
"
"}
\n
"
;
static
void
init_function_pointers
(
void
)
{
/* We have to use LoadLibrary as no d3dxof functions are referenced directly */
...
...
@@ -60,11 +67,14 @@ static unsigned long getRefcount(IUnknown *iface)
return
IUnknown_Release
(
iface
);
}
static
void
test_
d3dxof
(
void
)
static
void
test_
refcount
(
void
)
{
HRESULT
hr
;
unsigned
long
ref
;
LPDIRECTXFILE
lpDirectXFile
=
NULL
;
LPDIRECTXFILEENUMOBJECT
lpdxfeo
;
LPDIRECTXFILEDATA
lpdxfd
;
DXFILELOADMEMORY
dxflm
;
if
(
!
pDirectXFileCreate
)
{
...
...
@@ -82,18 +92,49 @@ static void test_d3dxof(void)
ref
=
getRefcount
(
(
IUnknown
*
)
lpDirectXFile
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ref
=
IDirectXFile_AddRef
(
lpDirectXFile
);
ok
(
ref
==
2
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ref
=
IDirectXFile_Release
(
lpDirectXFile
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
hr
=
IDirectXFile_RegisterTemplates
(
lpDirectXFile
,
template
,
strlen
(
template
));
ok
(
hr
==
DXFILE_OK
,
"IDirectXFileImpl_RegisterTemplates: %x
\n
"
,
hr
);
dxflm
.
lpMemory
=
&
object
;
dxflm
.
dSize
=
strlen
(
object
);
hr
=
IDirectXFile_CreateEnumObject
(
lpDirectXFile
,
&
dxflm
,
DXFILELOAD_FROMMEMORY
,
&
lpdxfeo
);
ok
(
hr
==
DXFILE_OK
,
"IDirectXFile_CreateEnumObject: %x
\n
"
,
hr
);
ref
=
getRefcount
(
(
IUnknown
*
)
lpDirectXFile
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ref
=
getRefcount
(
(
IUnknown
*
)
lpdxfeo
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
hr
=
IDirectXFileEnumObject_GetNextDataObject
(
lpdxfeo
,
&
lpdxfd
);
ok
(
hr
==
DXFILE_OK
,
"IDirectXFileEnumObject_GetNextDataObject: %x
\n
"
,
hr
);
ref
=
getRefcount
(
(
IUnknown
*
)
lpDirectXFile
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ref
=
getRefcount
(
(
IUnknown
*
)
lpdxfeo
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
/* Enum object gets references to all top level objects */
ref
=
getRefcount
(
(
IUnknown
*
)
lpdxfd
);
ok
(
ref
==
2
,
"Got refcount %ld, expected 2
\n
"
,
ref
);
ref
=
IDirectXFile_Release
(
lpDirectXFile
);
ok
(
ref
==
0
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ok
(
ref
==
0
,
"Got refcount %ld, expected 0
\n
"
,
ref
);
/* Nothing changes for all other objects */
ref
=
getRefcount
(
(
IUnknown
*
)
lpdxfeo
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ref
=
getRefcount
(
(
IUnknown
*
)
lpdxfd
);
ok
(
ref
==
2
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ref
=
IDirectXFileEnumObject_Release
(
lpdxfeo
);
ok
(
ref
==
0
,
"Got refcount %ld, expected 0
\n
"
,
ref
);
/* Enum object releases references to all top level objects */
ref
=
getRefcount
(
(
IUnknown
*
)
lpdxfd
);
ok
(
ref
==
1
,
"Got refcount %ld, expected 1
\n
"
,
ref
);
ref
=
IDirectXFileData_Release
(
lpdxfd
);
ok
(
ref
==
0
,
"Got refcount %ld, expected 0
\n
"
,
ref
);
}
/* Set it to 1 to expand the string when dumping the object. This is usefull when there is
...
...
@@ -268,7 +309,7 @@ START_TEST(d3dxof)
{
init_function_pointers
();
test_
d3dxof
();
test_
refcount
();
test_dump
();
FreeLibrary
(
hd3dxof
);
...
...
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