Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a407da47
Commit
a407da47
authored
Sep 01, 2006
by
Dan Hipschman
Committed by
Alexandre Julliard
Sep 07, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Sanity check string and pointer attrs. Don't assign string as type.
parent
180ede5b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
35 deletions
+47
-35
parser.y
tools/widl/parser.y
+28
-26
proxy.c
tools/widl/proxy.c
+18
-6
typelib.c
tools/widl/typelib.c
+1
-3
No files found.
tools/widl/parser.y
View file @
a407da47
...
@@ -1285,29 +1285,26 @@ static type_t *reg_type(type_t *type, const char *name, int t)
...
@@ -1285,29 +1285,26 @@ static type_t *reg_type(type_t *type, const char *name, int t)
return type;
return type;
}
}
/* determine pointer type from attrs */
static unsigned char get_pointer_type( type_t *type )
{
int t;
if (is_attr( type->attrs, ATTR_STRING ))
{
switch( type->ref->type )
{
case RPC_FC_CHAR:
return RPC_FC_C_CSTRING;
case RPC_FC_WCHAR:
return RPC_FC_C_WSTRING;
}
}
t = get_attrv( type->attrs, ATTR_POINTERTYPE );
if (t) return t;
return RPC_FC_FP;
}
static type_t *reg_typedefs(type_t *type, var_t *names, attr_t *attrs)
static type_t *reg_typedefs(type_t *type, var_t *names, attr_t *attrs)
{
{
type_t *ptr = type;
type_t *ptr = type;
int ptrc = 0;
int ptrc = 0;
int is_str = is_attr(attrs, ATTR_STRING);
unsigned char ptr_type = get_attrv(attrs, ATTR_POINTERTYPE);
if (is_str)
{
type_t *t = type;
unsigned char c;
while (is_ptr(t))
t = t->ref;
c = t->type;
if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR)
yyerror("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays",
names->name);
}
/* We must generate names for tagless enum, struct or union.
/* We must generate names for tagless enum, struct or union.
Typedef-ing a tagless enum, struct or union means we want the typedef
Typedef-ing a tagless enum, struct or union means we want the typedef
...
@@ -1343,8 +1340,18 @@ static type_t *reg_typedefs(type_t *type, var_t *names, attr_t *attrs)
...
@@ -1343,8 +1340,18 @@ static type_t *reg_typedefs(type_t *type, var_t *names, attr_t *attrs)
}
}
cur = alias(cur, names->name);
cur = alias(cur, names->name);
cur->attrs = attrs;
cur->attrs = attrs;
if (is_ptr(cur))
if (ptr_type)
cur->type = get_pointer_type(cur);
{
if (is_ptr(cur))
cur->type = ptr_type;
else
yyerror("'%s': pointer attribute applied to non-pointer type",
cur->name);
}
else if (is_str && ! is_ptr(cur))
yyerror("'%s': [string] attribute applied to non-pointer type",
cur->name);
reg_type(cur, cur->name, 0);
reg_type(cur, cur->name, 0);
}
}
names = next;
names = next;
...
@@ -1485,11 +1492,6 @@ static int get_struct_type(var_t *field)
...
@@ -1485,11 +1492,6 @@ static int get_struct_type(var_t *field)
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
field->name);
field->name);
break;
break;
case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING:
has_conformance = 1;
has_variance = 1;
break;
/*
/*
* Propagate member attributes
* Propagate member attributes
...
...
tools/widl/proxy.c
View file @
a407da47
...
@@ -224,6 +224,12 @@ static void marshall_size_arg( var_t *arg )
...
@@ -224,6 +224,12 @@ static void marshall_size_arg( var_t *arg )
return
;
return
;
}
}
if
(
is_string_type
(
arg
->
attrs
,
arg
->
ptr_level
,
arg
->
array
))
{
print_proxy
(
"NdrConformantStringBufferSize( &_StubMsg, (unsigned char*)s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
}
switch
(
type
->
type
)
switch
(
type
->
type
)
{
{
case
RPC_FC_BYTE
:
case
RPC_FC_BYTE
:
...
@@ -249,8 +255,6 @@ static void marshall_size_arg( var_t *arg )
...
@@ -249,8 +255,6 @@ static void marshall_size_arg( var_t *arg )
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
break
;
break
;
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_CARRAY
:
case
RPC_FC_CARRAY
:
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
...
@@ -323,6 +327,12 @@ static void marshall_copy_arg( var_t *arg )
...
@@ -323,6 +327,12 @@ static void marshall_copy_arg( var_t *arg )
return
;
return
;
}
}
if
(
is_string_type
(
arg
->
attrs
,
arg
->
ptr_level
,
arg
->
array
))
{
print_proxy
(
"NdrConformantStringMarshall( &_StubMsg, (unsigned char*)s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
}
switch
(
type
->
type
)
switch
(
type
->
type
)
{
{
case
RPC_FC_BYTE
:
case
RPC_FC_BYTE
:
...
@@ -348,8 +358,6 @@ static void marshall_copy_arg( var_t *arg )
...
@@ -348,8 +358,6 @@ static void marshall_copy_arg( var_t *arg )
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
break
;
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_CARRAY
:
case
RPC_FC_CARRAY
:
break
;
break
;
...
@@ -429,6 +437,12 @@ static void unmarshall_copy_arg( var_t *arg )
...
@@ -429,6 +437,12 @@ static void unmarshall_copy_arg( var_t *arg )
return
;
return
;
}
}
if
(
is_string_type
(
arg
->
attrs
,
arg
->
ptr_level
,
arg
->
array
))
{
print_proxy
(
"NdrConformantStringUnmarshall( &_StubMsg, (unsigned char**)&s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0 );
\n
"
,
index
);
}
switch
(
type
->
type
)
switch
(
type
->
type
)
{
{
case
RPC_FC_BYTE
:
case
RPC_FC_BYTE
:
...
@@ -453,8 +467,6 @@ static void unmarshall_copy_arg( var_t *arg )
...
@@ -453,8 +467,6 @@ static void unmarshall_copy_arg( var_t *arg )
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
break
;
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_CARRAY
:
case
RPC_FC_CARRAY
:
print_proxy
(
"NdrConformantArrayUnmarshall( &_StubMsg, (unsigned char**)&%s, "
,
arg
->
name
);
print_proxy
(
"NdrConformantArrayUnmarshall( &_StubMsg, (unsigned char**)&%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
...
...
tools/widl/typelib.c
View file @
a407da47
...
@@ -79,9 +79,7 @@ int is_ptr(type_t *t)
...
@@ -79,9 +79,7 @@ int is_ptr(type_t *t)
return
c
==
RPC_FC_RP
return
c
==
RPC_FC_RP
||
c
==
RPC_FC_UP
||
c
==
RPC_FC_UP
||
c
==
RPC_FC_FP
||
c
==
RPC_FC_FP
||
c
==
RPC_FC_OP
||
c
==
RPC_FC_OP
;
||
c
==
RPC_FC_C_CSTRING
||
c
==
RPC_FC_C_WSTRING
;
}
}
/* List of oleauto types that should be recognized by name.
/* List of oleauto types that should be recognized by name.
...
...
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