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
cdf69470
Commit
cdf69470
authored
Jun 16, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Avoid use of toupper/isupper on signed chars.
parent
02674b2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
parser.l
tools/wrc/parser.l
+6
-3
parser.y
tools/wrc/parser.y
+7
-3
No files found.
tools/wrc/parser.l
View file @
cdf69470
...
@@ -397,9 +397,12 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base)
...
@@ -397,9 +397,12 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base)
\{ return tBEGIN;
\{ return tBEGIN;
\} return tEND;
\} return tEND;
[0-9]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
[0-9]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 10);
0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; }
0[oO][0-7]+[lL]? { parser_lval.num = xstrtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 16);
return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; }
0[oO][0-7]+[lL]? { parser_lval.num = xstrtoul(yytext+2, 0, 8);
return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; }
/*
/*
* The next two rules scan identifiers and filenames.
* The next two rules scan identifiers and filenames.
...
...
tools/wrc/parser.y
View file @
cdf69470
...
@@ -2172,7 +2172,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
...
@@ -2172,7 +2172,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
if(key->type
==
str_char)
if(key->type
==
str_char)
{
{
if((flags
&
WRC_AF_VIRTKEY)
&&
(!isupper(key->str.cstr[0]
&
0xff)
&&
!isdigit(key->str.cstr[0]
&
0xff)))
if((flags
&
WRC_AF_VIRTKEY)
&&
!((key->str.cstr[0]
>=
'A'
&&
key->str.cstr[0]
<=
'Z')
||
(key->str.cstr[0]
>=
'0'
&&
key->str.cstr[0]
<=
'9')))
yyerror("VIRTKEY
code
is
not
equal
to
ascii
value");
yyerror("VIRTKEY
code
is
not
equal
to
ascii
value");
if(key->str.cstr[0]
==
'^'
&&
(flags
&
WRC_AF_CONTROL)
!=
0)
if(key->str.cstr[0]
==
'^'
&&
(flags
&
WRC_AF_CONTROL)
!=
0)
...
@@ -2181,7 +2183,7 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
...
@@ -2181,7 +2183,7 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
}
}
else
if
(
key-
>
str
.cstr
[
0
]
==
'^'
)
else
if
(
key-
>
str
.cstr
[
0
]
==
'^'
)
{
{
keycode
=
toupper(key->str.cstr[1])
-
'@';
keycode
=
toupper(
(unsigned
char)
key->str.cstr[1])
-
'@';
if(keycode
>=
'
')
if(keycode
>=
'
')
yyerror("Control-code
out
of
range");
yyerror("Control-code
out
of
range");
}
}
...
@@ -2190,7 +2192,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
...
@@ -2190,7 +2192,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
}
}
else
else
{
{
if((flags
&
WRC_AF_VIRTKEY)
&&
!isupperW(key->str.wstr[0])
&&
!isdigitW(key->str.wstr[0]))
if((flags
&
WRC_AF_VIRTKEY)
&&
!((key->str.wstr[0]
>=
'A'
&&
key->str.wstr[0]
<=
'Z')
||
(key->str.wstr[0]
>=
'0'
&&
key->str.wstr[0]
<=
'9')))
yyerror("VIRTKEY
code
is
not
equal
to
ascii
value");
yyerror("VIRTKEY
code
is
not
equal
to
ascii
value");
if(key->str.wstr[0]
==
'^'
&&
(flags
&
WRC_AF_CONTROL)
!=
0)
if(key->str.wstr[0]
==
'^'
&&
(flags
&
WRC_AF_CONTROL)
!=
0)
...
...
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