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
b8341093
Commit
b8341093
authored
Mar 27, 2024
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 03, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Use generic 'struct sltg_data' for collecting data.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
parent
a1997507
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
28 deletions
+25
-28
write_sltg.c
tools/widl/write_sltg.c
+25
-28
No files found.
tools/widl/write_sltg.c
View file @
b8341093
...
@@ -39,16 +39,10 @@
...
@@ -39,16 +39,10 @@
static
const
GUID
sltg_library_guid
=
{
0x204ff
,
0
,
0
,{
0xc0
,
0
,
0
,
0
,
0
,
0
,
0
,
0x46
}
};
static
const
GUID
sltg_library_guid
=
{
0x204ff
,
0
,
0
,{
0xc0
,
0
,
0
,
0
,
0
,
0
,
0
,
0x46
}
};
struct
sltg_
index
struct
sltg_
data
{
{
int
size
,
allocated
;
int
size
,
allocated
;
char
*
names
;
char
*
data
;
};
struct
sltg_name_table
{
int
size
,
allocated
;
char
*
names
;
};
};
struct
sltg_library
struct
sltg_library
...
@@ -74,8 +68,8 @@ struct sltg_block
...
@@ -74,8 +68,8 @@ struct sltg_block
struct
sltg_typelib
struct
sltg_typelib
{
{
typelib_t
*
typelib
;
typelib_t
*
typelib
;
struct
sltg_
index
index
;
struct
sltg_
data
index
;
struct
sltg_
name_table
name_table
;
struct
sltg_
data
name_table
;
struct
sltg_library
library
;
struct
sltg_library
library
;
struct
sltg_block
*
blocks
;
struct
sltg_block
*
blocks
;
int
block_count
;
int
block_count
;
...
@@ -83,7 +77,14 @@ struct sltg_typelib
...
@@ -83,7 +77,14 @@ struct sltg_typelib
short
typeinfo_count
;
short
typeinfo_count
;
};
};
static
int
add_index
(
struct
sltg_index
*
index
,
const
char
*
name
)
static
void
init_sltg_data
(
struct
sltg_data
*
data
)
{
data
->
size
=
0
;
data
->
allocated
=
0
;
data
->
data
=
NULL
;
}
static
int
add_index
(
struct
sltg_data
*
index
,
const
char
*
name
)
{
{
int
name_offset
=
index
->
size
;
int
name_offset
=
index
->
size
;
int
new_size
=
index
->
size
+
strlen
(
name
)
+
1
;
int
new_size
=
index
->
size
+
strlen
(
name
)
+
1
;
...
@@ -91,27 +92,25 @@ static int add_index(struct sltg_index *index, const char *name)
...
@@ -91,27 +92,25 @@ static int add_index(struct sltg_index *index, const char *name)
if
(
new_size
>
index
->
allocated
)
if
(
new_size
>
index
->
allocated
)
{
{
index
->
allocated
=
index
->
allocated
?
max
(
index
->
allocated
*
2
,
new_size
)
:
new_size
;
index
->
allocated
=
index
->
allocated
?
max
(
index
->
allocated
*
2
,
new_size
)
:
new_size
;
index
->
names
=
xrealloc
(
index
->
names
,
index
->
allocated
);
index
->
data
=
xrealloc
(
index
->
data
,
index
->
allocated
);
}
}
strcpy
(
index
->
names
+
index
->
size
,
name
);
strcpy
(
index
->
data
+
index
->
size
,
name
);
index
->
size
=
new_size
;
index
->
size
=
new_size
;
return
name_offset
;
return
name_offset
;
}
}
static
void
init_index
(
struct
sltg_
index
*
index
)
static
void
init_index
(
struct
sltg_
data
*
index
)
{
{
static
const
char
compobj
[]
=
{
1
,
'C'
,
'o'
,
'm'
,
'p'
,
'O'
,
'b'
,
'j'
,
0
};
static
const
char
compobj
[]
=
{
1
,
'C'
,
'o'
,
'm'
,
'p'
,
'O'
,
'b'
,
'j'
,
0
};
index
->
size
=
0
;
init_sltg_data
(
index
);
index
->
allocated
=
0
;
index
->
names
=
NULL
;
add_index
(
index
,
compobj
);
add_index
(
index
,
compobj
);
}
}
static
int
add_name
(
struct
sltg_
name_table
*
name_table
,
const
char
*
name
)
static
int
add_name
(
struct
sltg_
data
*
name_table
,
const
char
*
name
)
{
{
int
name_offset
=
name_table
->
size
;
int
name_offset
=
name_table
->
size
;
int
new_size
=
name_table
->
size
+
strlen
(
name
)
+
1
+
8
;
int
new_size
=
name_table
->
size
+
strlen
(
name
)
+
1
+
8
;
...
@@ -121,22 +120,20 @@ static int add_name(struct sltg_name_table *name_table, const char *name)
...
@@ -121,22 +120,20 @@ static int add_name(struct sltg_name_table *name_table, const char *name)
if
(
new_size
>
name_table
->
allocated
)
if
(
new_size
>
name_table
->
allocated
)
{
{
name_table
->
allocated
=
name_table
->
allocated
?
max
(
name_table
->
allocated
*
2
,
new_size
)
:
new_size
;
name_table
->
allocated
=
name_table
->
allocated
?
max
(
name_table
->
allocated
*
2
,
new_size
)
:
new_size
;
name_table
->
names
=
xrealloc
(
name_table
->
names
,
name_table
->
allocated
);
name_table
->
data
=
xrealloc
(
name_table
->
data
,
name_table
->
allocated
);
}
}
memset
(
name_table
->
names
+
name_table
->
size
,
0xff
,
8
);
memset
(
name_table
->
data
+
name_table
->
size
,
0xff
,
8
);
strcpy
(
name_table
->
names
+
name_table
->
size
+
8
,
name
);
strcpy
(
name_table
->
data
+
name_table
->
size
+
8
,
name
);
name_table
->
size
=
new_size
;
name_table
->
size
=
new_size
;
name_table
->
names
[
name_table
->
size
-
1
]
=
0
;
/* clear alignment */
name_table
->
data
[
name_table
->
size
-
1
]
=
0
;
/* clear alignment */
return
name_offset
;
return
name_offset
;
}
}
static
void
init_name_table
(
struct
sltg_
name_table
*
name_table
)
static
void
init_name_table
(
struct
sltg_
data
*
name_table
)
{
{
name_table
->
size
=
0
;
init_sltg_data
(
name_table
);
name_table
->
allocated
=
0
;
name_table
->
names
=
NULL
;
}
}
static
void
init_library
(
struct
sltg_typelib
*
sltg
)
static
void
init_library
(
struct
sltg_typelib
*
sltg
)
...
@@ -418,7 +415,7 @@ static void sltg_write_header(struct sltg_typelib *sltg, int *library_block_star
...
@@ -418,7 +415,7 @@ static void sltg_write_header(struct sltg_typelib *sltg, int *library_block_star
entry
.
next
=
0
;
entry
.
next
=
0
;
put_data
(
&
entry
,
sizeof
(
entry
));
put_data
(
&
entry
,
sizeof
(
entry
));
put_data
(
sltg
->
index
.
names
,
sltg
->
index
.
size
);
put_data
(
sltg
->
index
.
data
,
sltg
->
index
.
size
);
memset
(
pad
,
0
,
9
);
memset
(
pad
,
0
,
9
);
put_data
(
pad
,
9
);
put_data
(
pad
,
9
);
...
@@ -458,7 +455,7 @@ static void sltg_write_nametable(struct sltg_typelib *typelib)
...
@@ -458,7 +455,7 @@ static void sltg_write_nametable(struct sltg_typelib *typelib)
memset
(
pad
,
0xff
,
0x200
);
memset
(
pad
,
0xff
,
0x200
);
put_data
(
pad
,
0x200
);
put_data
(
pad
,
0x200
);
put_data
(
&
typelib
->
name_table
.
size
,
sizeof
(
typelib
->
name_table
.
size
));
put_data
(
&
typelib
->
name_table
.
size
,
sizeof
(
typelib
->
name_table
.
size
));
put_data
(
typelib
->
name_table
.
names
,
typelib
->
name_table
.
size
);
put_data
(
typelib
->
name_table
.
data
,
typelib
->
name_table
.
size
);
}
}
static
void
sltg_write_remainder
(
void
)
static
void
sltg_write_remainder
(
void
)
...
...
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