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
279e4903
Commit
279e4903
authored
Feb 10, 2009
by
Christian Costa
Committed by
Alexandre Julliard
Feb 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dxof: Cleanup IDirectXFileImpl_CreateEnumObject a bit.
parent
db30aa14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
d3dxof.c
dlls/d3dxof/d3dxof.c
+18
-20
No files found.
dlls/d3dxof/d3dxof.c
View file @
279e4903
...
...
@@ -127,11 +127,12 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
IDirectXFileImpl
*
This
=
(
IDirectXFileImpl
*
)
iface
;
IDirectXFileEnumObjectImpl
*
object
;
HRESULT
hr
;
DWORD
header
[
4
]
;
DWORD
*
header
;
HANDLE
hFile
=
INVALID_HANDLE_VALUE
;
HANDLE
file_mapping
=
0
;
LPBYTE
buffer
=
NULL
;
DWORD
file_size
=
0
;
LPBYTE
file_buffer
;
DWORD
file_size
;
LPDXFILELOADMEMORY
lpdxflm
=
NULL
;
...
...
@@ -152,11 +153,6 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
}
file_size
=
GetFileSize
(
hFile
,
NULL
);
if
(
file_size
<
16
)
{
hr
=
DXFILEERR_BADFILETYPE
;
goto
error
;
}
file_mapping
=
CreateFileMappingA
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
);
if
(
!
file_mapping
)
...
...
@@ -171,7 +167,7 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
hr
=
DXFILEERR_BADFILETYPE
;
goto
error
;
}
memcpy
(
header
,
buffer
,
16
)
;
file_buffer
=
buffer
;
}
else
if
(
dwLoadOptions
==
DXFILELOAD_FROMMEMORY
)
{
...
...
@@ -179,7 +175,8 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
TRACE
(
"Source in memory at %p with size %d
\n
"
,
lpdxflm
->
lpMemory
,
lpdxflm
->
dSize
);
memcpy
(
header
,
lpdxflm
->
lpMemory
,
16
);
file_buffer
=
lpdxflm
->
lpMemory
;
file_size
=
lpdxflm
->
dSize
;
}
else
{
...
...
@@ -188,6 +185,8 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
goto
error
;
}
header
=
(
DWORD
*
)
file_buffer
;
if
(
TRACE_ON
(
d3dxof
))
{
char
string
[
17
];
...
...
@@ -196,6 +195,12 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
TRACE
(
"header = '%s'
\n
"
,
string
);
}
if
(
file_size
<
16
)
{
hr
=
DXFILEERR_BADFILETYPE
;
goto
error
;
}
if
(
header
[
0
]
!=
XOFFILE_FORMAT_MAGIC
)
{
hr
=
DXFILEERR_BADFILETYPE
;
...
...
@@ -243,18 +248,11 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
object
->
buf
.
token_present
=
FALSE
;
object
->
buf
.
cur_subobject
=
0
;
if
(
dwLoadOptions
==
DXFILELOAD_FROMFILE
)
{
object
->
buf
.
buffer
=
buffer
+
16
;
object
->
buf
.
rem_bytes
=
file_size
-
16
;
}
else
{
object
->
buf
.
buffer
=
((
LPBYTE
)
lpdxflm
->
lpMemory
)
+
16
;
object
->
buf
.
rem_bytes
=
lpdxflm
->
dSize
;
}
TRACE
(
"File size is %d bytes
\n
"
,
file_size
);
TRACE
(
"Object size is %d bytes
\n
"
,
object
->
buf
.
rem_bytes
+
16
);
/* Go to data after header */
object
->
buf
.
buffer
=
file_buffer
+
16
;
object
->
buf
.
rem_bytes
=
file_size
-
16
;
*
ppEnumObj
=
(
LPDIRECTXFILEENUMOBJECT
)
object
;
...
...
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