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
f6d2b491
Commit
f6d2b491
authored
Jul 03, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Take into account structure field alignment when computing offsets.
parent
064775c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
typegen.c
tools/widl/typegen.c
+15
-7
No files found.
tools/widl/typegen.c
View file @
f6d2b491
...
...
@@ -59,6 +59,7 @@ struct expr_eval_routine
const
expr_t
*
expr
;
};
static
unsigned
int
field_memsize
(
const
type_t
*
type
,
unsigned
int
*
offset
);
static
unsigned
int
fields_memsize
(
const
var_list_t
*
fields
,
unsigned
int
*
align
);
static
unsigned
int
write_struct_tfs
(
FILE
*
file
,
type_t
*
type
,
const
char
*
name
,
unsigned
int
*
tfsoff
);
static
int
write_embedded_types
(
FILE
*
file
,
const
attr_list_t
*
attrs
,
type_t
*
type
,
...
...
@@ -978,14 +979,13 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure,
if
(
fields
)
LIST_FOR_EACH_ENTRY
(
var
,
fields
,
const
var_t
,
entry
)
{
unsigned
int
align
=
0
;
/* FIXME: take alignment into account */
unsigned
int
size
=
field_memsize
(
var
->
type
,
&
offset
);
if
(
var
->
name
&&
!
strcmp
(
var
->
name
,
subexpr
->
u
.
sval
))
{
correlation_variable
=
var
->
type
;
break
;
}
offset
+=
type_memsize
(
var
->
type
,
&
align
)
;
offset
+=
size
;
}
if
(
!
correlation_variable
)
error
(
"write_conf_or_var_desc: couldn't find variable %s in structure
\n
"
,
...
...
@@ -1081,6 +1081,16 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure,
return
4
;
}
/* return size and start offset of a data field based on current offset */
static
unsigned
int
field_memsize
(
const
type_t
*
type
,
unsigned
int
*
offset
)
{
unsigned
int
align
=
0
;
unsigned
int
size
=
type_memsize
(
type
,
&
align
);
*
offset
=
ROUND_SIZE
(
*
offset
,
align
);
return
size
;
}
static
unsigned
int
fields_memsize
(
const
var_list_t
*
fields
,
unsigned
int
*
align
)
{
unsigned
int
size
=
0
;
...
...
@@ -1511,8 +1521,8 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
if
(
fs
)
LIST_FOR_EACH_ENTRY
(
f
,
fs
,
var_t
,
entry
)
{
unsigned
int
align
=
0
;
type_t
*
ft
=
f
->
type
;
unsigned
int
size
=
field_memsize
(
ft
,
&
offset
);
if
(
type_get_type
(
ft
)
==
TYPE_UNION
&&
is_attr
(
f
->
attrs
,
ATTR_SWITCHIS
))
{
short
reloff
;
...
...
@@ -1529,9 +1539,7 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
reloff
,
reloff
,
absoff
);
*
tfsoff
+=
8
;
}
/* FIXME: take alignment into account */
offset
+=
type_memsize
(
ft
,
&
align
);
offset
+=
size
;
}
}
...
...
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