Commit cfa54572 authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Allow quoted UUIDs.

parent e31d8d8f
......@@ -78,7 +78,7 @@ int import_stack_ptr = 0;
static void pop_import(void);
static UUID* parse_uuid(const char*u)
UUID *parse_uuid(const char *u)
{
UUID* uuid = xmalloc(sizeof(UUID));
char b[3];
......
......@@ -265,6 +265,7 @@ static void check_all_user_types(ifref_list_t *ifaces);
%type <type> coclass coclasshdr coclassdef
%type <num> pointer_type version
%type <str> libraryhdr
%type <uuid> uuid_string
%left ','
%right '?' ':'
......@@ -498,7 +499,7 @@ attribute: { $$ = NULL; }
| tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); }
| tSWITCHTYPE '(' type ')' { $$ = make_attrp(ATTR_SWITCHTYPE, $3); }
| tTRANSMITAS '(' type ')' { $$ = make_attrp(ATTR_TRANSMITAS, $3); }
| tUUID '(' aUUID ')' { $$ = make_attrp(ATTR_UUID, $3); }
| tUUID '(' uuid_string ')' { $$ = make_attrp(ATTR_UUID, $3); }
| tV1ENUM { $$ = make_attr(ATTR_V1ENUM); }
| tVARARG { $$ = make_attr(ATTR_VARARG); }
| tVERSION '(' version ')' { $$ = make_attrv(ATTR_VERSION, $3); }
......@@ -506,6 +507,12 @@ attribute: { $$ = NULL; }
| pointer_type { $$ = make_attrv(ATTR_POINTERTYPE, $1); }
;
uuid_string:
aUUID
| aSTRING { if (!is_valid_uuid($1))
yyerror("invalid UUID: %s", $1);
$$ = parse_uuid($1); }
callconv:
| tSTDCALL
;
......@@ -2037,3 +2044,20 @@ static void check_all_user_types(ifref_list_t *ifrefs)
check_for_user_types_and_context_handles(f->args);
}
}
int is_valid_uuid(const char *s)
{
int i;
for (i = 0; i < 36; ++i)
if (i == 8 || i == 13 || i == 18 || i == 23)
{
if (s[i] != '-')
return FALSE;
}
else
if (!isxdigit(s[i]))
return FALSE;
return s[i] == '\0';
}
......@@ -42,4 +42,7 @@ void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
char *dup_basename(const char *name, const char *ext);
UUID *parse_uuid(const char *u);
int is_valid_uuid(const char *s);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment