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
df48d6f5
Commit
df48d6f5
authored
Mar 12, 2009
by
Christian Costa
Committed by
Alexandre Julliard
Mar 12, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dxof: Use offsets to reference data instead of pointers so data buffer can be resized.
parent
fd77bc5f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
19 deletions
+23
-19
d3dxof.c
dlls/d3dxof/d3dxof.c
+3
-2
d3dxof_private.h
dlls/d3dxof/d3dxof_private.h
+4
-2
parsing.c
dlls/d3dxof/parsing.c
+16
-15
No files found.
dlls/d3dxof/d3dxof.c
View file @
df48d6f5
...
...
@@ -686,7 +686,7 @@ static HRESULT WINAPI IDirectXFileDataImpl_GetData(IDirectXFileData* iface, LPCS
}
*
pcbSize
=
This
->
pobj
->
size
;
*
ppvData
=
This
->
pobj
->
p
data
;
*
ppvData
=
This
->
pobj
->
root
->
pdata
+
This
->
pobj
->
pos_
data
;
return
DXFILE_OK
;
}
...
...
@@ -1063,7 +1063,8 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
hr
=
DXFILEERR_BADALLOC
;
goto
error
;
}
This
->
buf
.
cur_pdata
=
This
->
buf
.
pdata
=
object
->
pdata
=
pdata
;
This
->
buf
.
pxo
->
pdata
=
This
->
buf
.
pdata
=
object
->
pdata
=
pdata
;
This
->
buf
.
cur_pos_data
=
0
;
pstrings
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_STRINGS_BUFFER
);
if
(
!
pstrings
)
...
...
dlls/d3dxof/d3dxof_private.h
View file @
df48d6f5
...
...
@@ -66,7 +66,7 @@ typedef struct {
typedef
struct
{
char
*
name
;
LPBYTE
start
;
ULONG
start
;
ULONG
size
;
}
xobject_member
;
...
...
@@ -77,12 +77,14 @@ struct _xobject {
GUID
class_id
;
GUID
type
;
LPBYTE
pdata
;
ULONG
pos_data
;
DWORD
size
;
ULONG
nb_members
;
xobject_member
members
[
MAX_MEMBERS
];
ULONG
nb_childs
;
ULONG
nb_subobjects
;
struct
_xobject
*
childs
[
MAX_CHILDS
];
struct
_xobject
*
root
;
};
typedef
struct
_xobject
xobject
;
...
...
@@ -130,7 +132,7 @@ typedef struct {
BOOL
token_present
;
BOOL
txt
;
ULONG
cur_subobject
;
LPBYTE
cur_p
data
;
ULONG
cur_pos_
data
;
LPBYTE
cur_pstrings
;
BYTE
value
[
100
];
xobject
**
pxo_globals
;
...
...
dlls/d3dxof/parsing.c
View file @
df48d6f5
...
...
@@ -1009,14 +1009,14 @@ static BOOL parse_object_members_list(parse_buffer * buf)
int
nb_elems
=
1
;
buf
->
pxo
->
members
[
i
].
name
=
pt
->
members
[
i
].
name
;
buf
->
pxo
->
members
[
i
].
start
=
buf
->
cur_pdata
;
buf
->
pxo
->
members
[
i
].
start
=
buf
->
cur_p
os_
data
;
for
(
k
=
0
;
k
<
pt
->
members
[
i
].
nb_dims
;
k
++
)
{
if
(
pt
->
members
[
i
].
dim_fixed
[
k
])
nb_elems
*=
pt
->
members
[
i
].
dim_value
[
k
];
else
nb_elems
*=
*
(
DWORD
*
)
buf
->
pxo
->
members
[
pt
->
members
[
i
].
dim_value
[
k
]].
start
;
nb_elems
*=
*
(
DWORD
*
)
(
buf
->
pxo
->
root
->
pdata
+
buf
->
pxo
->
members
[
pt
->
members
[
i
].
dim_value
[
k
]].
start
)
;
}
TRACE
(
"Elements to consider: %d
\n
"
,
nb_elems
);
...
...
@@ -1076,20 +1076,20 @@ static BOOL parse_object_members_list(parse_buffer * buf)
last_dword
=
*
(
DWORD
*
)
buf
->
value
;
TRACE
(
"%s = %d
\n
"
,
pt
->
members
[
i
].
name
,
*
(
DWORD
*
)
buf
->
value
);
/* Assume larger size */
if
((
buf
->
cur_p
data
-
buf
->
p
data
+
4
)
>
MAX_DATA_SIZE
)
if
((
buf
->
cur_p
os_
data
+
4
)
>
MAX_DATA_SIZE
)
{
FIXME
(
"Buffer too small
\n
"
);
return
FALSE
;
}
if
(
pt
->
members
[
i
].
type
==
TOKEN_WORD
)
{
*
(((
WORD
*
)(
buf
->
cur_pdata
)))
=
(
WORD
)(
*
(
DWORD
*
)
buf
->
value
);
buf
->
cur_pdata
+=
2
;
*
(((
WORD
*
)(
buf
->
cur_p
os_data
+
buf
->
p
data
)))
=
(
WORD
)(
*
(
DWORD
*
)
buf
->
value
);
buf
->
cur_p
os_
data
+=
2
;
}
else
if
(
pt
->
members
[
i
].
type
==
TOKEN_DWORD
)
{
*
(((
DWORD
*
)(
buf
->
cur_pdata
)))
=
(
DWORD
)(
*
(
DWORD
*
)
buf
->
value
);
buf
->
cur_pdata
+=
4
;
*
(((
DWORD
*
)(
buf
->
cur_p
os_data
+
buf
->
p
data
)))
=
(
DWORD
)(
*
(
DWORD
*
)
buf
->
value
);
buf
->
cur_p
os_
data
+=
4
;
}
else
{
...
...
@@ -1102,15 +1102,15 @@ static BOOL parse_object_members_list(parse_buffer * buf)
get_TOKEN
(
buf
);
TRACE
(
"%s = %f
\n
"
,
pt
->
members
[
i
].
name
,
*
(
float
*
)
buf
->
value
);
/* Assume larger size */
if
((
buf
->
cur_p
data
-
buf
->
p
data
+
4
)
>
MAX_DATA_SIZE
)
if
((
buf
->
cur_p
os_
data
+
4
)
>
MAX_DATA_SIZE
)
{
FIXME
(
"Buffer too small
\n
"
);
return
FALSE
;
}
if
(
pt
->
members
[
i
].
type
==
TOKEN_FLOAT
)
{
*
(((
float
*
)(
buf
->
cur_pdata
)))
=
(
float
)(
*
(
float
*
)
buf
->
value
);
buf
->
cur_pdata
+=
4
;
*
(((
float
*
)(
buf
->
cur_p
os_data
+
buf
->
p
data
)))
=
(
float
)(
*
(
float
*
)
buf
->
value
);
buf
->
cur_p
os_
data
+=
4
;
}
else
{
...
...
@@ -1123,7 +1123,7 @@ static BOOL parse_object_members_list(parse_buffer * buf)
get_TOKEN
(
buf
);
TRACE
(
"%s = %s
\n
"
,
pt
->
members
[
i
].
name
,
(
char
*
)
buf
->
value
);
/* Assume larger size */
if
((
buf
->
cur_p
data
-
buf
->
p
data
+
4
)
>
MAX_DATA_SIZE
)
if
((
buf
->
cur_p
os_
data
+
4
)
>
MAX_DATA_SIZE
)
{
FIXME
(
"Buffer too small
\n
"
);
return
FALSE
;
...
...
@@ -1137,9 +1137,9 @@ static BOOL parse_object_members_list(parse_buffer * buf)
return
FALSE
;
}
strcpy
((
char
*
)
buf
->
cur_pstrings
,
(
char
*
)
buf
->
value
);
*
(((
LPCSTR
*
)(
buf
->
cur_pdata
)))
=
(
char
*
)
buf
->
cur_pstrings
;
*
(((
LPCSTR
*
)(
buf
->
cur_p
os_data
+
buf
->
p
data
)))
=
(
char
*
)
buf
->
cur_pstrings
;
buf
->
cur_pstrings
+=
len
;
buf
->
cur_pdata
+=
4
;
buf
->
cur_p
os_
data
+=
4
;
}
else
{
...
...
@@ -1173,7 +1173,7 @@ static BOOL parse_object_parts(parse_buffer * buf, BOOL allow_optional)
if
(
allow_optional
)
{
buf
->
pxo
->
size
=
buf
->
cur_p
data
-
buf
->
pxo
->
p
data
;
buf
->
pxo
->
size
=
buf
->
cur_p
os_data
-
buf
->
pxo
->
pos_
data
;
/* Skip trailing semicolon */
while
(
check_TOKEN
(
buf
)
==
TOKEN_SEMICOLON
)
...
...
@@ -1242,8 +1242,9 @@ BOOL parse_object(parse_buffer * buf)
{
int
i
;
buf
->
pxo
->
p
data
=
buf
->
cur_p
data
;
buf
->
pxo
->
p
os_data
=
buf
->
cur_pos_
data
;
buf
->
pxo
->
ptarget
=
NULL
;
buf
->
pxo
->
root
=
buf
->
pxo_tab
;
if
(
get_TOKEN
(
buf
)
!=
TOKEN_NAME
)
return
FALSE
;
...
...
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