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
865f23b5
Commit
865f23b5
authored
Feb 20, 2016
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Avoid locale- or Unicode-dependent case conversions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e8076eec
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
31 deletions
+46
-31
genres.c
tools/wrc/genres.c
+4
-2
parser.l
tools/wrc/parser.l
+1
-1
parser.y
tools/wrc/parser.y
+12
-26
utils.c
tools/wrc/utils.c
+27
-2
utils.h
tools/wrc/utils.h
+2
-0
No files found.
tools/wrc/genres.c
View file @
865f23b5
...
...
@@ -263,11 +263,13 @@ static void string_to_upper(string_t *str)
if
(
str
->
type
==
str_char
)
{
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
str
->
str
.
cstr
[
i
]
=
toupper
((
unsigned
char
)
str
->
str
.
cstr
[
i
]);
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
if
(
str
->
str
.
cstr
[
i
]
>=
'a'
&&
str
->
str
.
cstr
[
i
]
<=
'z'
)
str
->
str
.
cstr
[
i
]
-=
32
;
}
else
if
(
str
->
type
==
str_unicode
)
{
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
str
->
str
.
wstr
[
i
]
=
toupperW
(
str
->
str
.
wstr
[
i
]);
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
if
(
str
->
str
.
wstr
[
i
]
>=
'a'
&&
str
->
str
.
wstr
[
i
]
<=
'z'
)
str
->
str
.
wstr
[
i
]
-=
32
;
}
else
{
...
...
tools/wrc/parser.l
View file @
865f23b5
...
...
@@ -250,7 +250,7 @@ static struct keyword keywords[] = {
static int kw_cmp_func(const void *s1, const void *s2)
{
int ret;
ret =
strcasecmp
(KWP(s1)->keyword, KWP(s2)->keyword);
ret =
compare_striA
(KWP(s1)->keyword, KWP(s2)->keyword);
if(!ret && (KWP(s1)->needcase || KWP(s2)->needcase))
return strcmp(KWP(s1)->keyword, KWP(s2)->keyword);
else
...
...
tools/wrc/parser.y
View file @
865f23b5
...
...
@@ -2072,37 +2072,23 @@ static int get_class_idW(const WCHAR *cc)
static
const
WCHAR
szSTATIC
[]
=
{
'S','T','A','T','I','C',0
}
;
static
const
WCHAR
szSCROLLBAR
[]
=
{
'S','C','R','O','L','L','B','A','R',0
}
;
if
(!
strcmpiW
(
szBUTTON
,
cc
))
return
CT_BUTTON
;
if
(!
strcmpiW
(
szCOMBOBOX
,
cc
))
return
CT_COMBOBOX
;
if
(!
strcmpiW
(
szLISTBOX
,
cc
))
return
CT_LISTBOX
;
if
(!
strcmpiW
(
szEDIT
,
cc
))
return
CT_EDIT
;
if
(!
strcmpiW
(
szSTATIC
,
cc
))
return
CT_STATIC
;
if
(!
strcmpiW
(
szSCROLLBAR
,
cc
))
return
CT_SCROLLBAR
;
if
(!
compare_striW
(
szBUTTON
,
cc
))
return
CT_BUTTON
;
if
(!
compare_striW
(
szCOMBOBOX
,
cc
))
return
CT_COMBOBOX
;
if
(!
compare_striW
(
szLISTBOX
,
cc
))
return
CT_LISTBOX
;
if
(!
compare_striW
(
szEDIT
,
cc
))
return
CT_EDIT
;
if
(!
compare_striW
(
szSTATIC
,
cc
))
return
CT_STATIC
;
if
(!
compare_striW
(
szSCROLLBAR
,
cc
))
return
CT_SCROLLBAR
;
return
-1
;
}
static
int
get_class_idA
(
const
char
*
cc
)
{
if(!strcasecmp("BUTTON",
cc))
return
CT_BUTTON;
if(!strcasecmp("COMBOBOX",
cc))
return
CT_COMBOBOX;
if(!strcasecmp("LISTBOX",
cc))
return
CT_LISTBOX;
if(!strcasecmp("EDIT",
cc))
return
CT_EDIT;
if(!strcasecmp("STATIC",
cc))
return
CT_STATIC;
if(!strcasecmp("SCROLLBAR",
cc))
return
CT_SCROLLBAR;
if(!compare_striA("BUTTON",
cc))
return
CT_BUTTON;
if(!compare_striA("COMBOBOX",
cc))
return
CT_COMBOBOX;
if(!compare_striA("LISTBOX",
cc))
return
CT_LISTBOX;
if(!compare_striA("EDIT",
cc))
return
CT_EDIT;
if(!compare_striA("STATIC",
cc))
return
CT_STATIC;
if(!compare_striA("SCROLLBAR",
cc))
return
CT_SCROLLBAR;
return
-1;
}
...
...
tools/wrc/utils.c
View file @
865f23b5
...
...
@@ -219,6 +219,31 @@ char *xstrdup(const char *str)
return
strcpy
(
s
,
str
);
}
int
compare_striA
(
const
char
*
str1
,
const
char
*
str2
)
{
for
(;;)
{
/* only the A-Z range is case-insensitive */
char
ch1
=
(
*
str1
>=
'a'
&&
*
str1
<=
'z'
)
?
*
str1
+
'A'
-
'a'
:
*
str1
;
char
ch2
=
(
*
str2
>=
'a'
&&
*
str2
<=
'z'
)
?
*
str2
+
'A'
-
'a'
:
*
str2
;
if
(
!
ch1
||
ch1
!=
ch2
)
return
ch1
-
ch2
;
str1
++
;
str2
++
;
}
}
int
compare_striW
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
for
(;;)
{
/* only the A-Z range is case-insensitive */
WCHAR
ch1
=
(
*
str1
>=
'a'
&&
*
str1
<=
'z'
)
?
*
str1
+
'A'
-
'a'
:
*
str1
;
WCHAR
ch2
=
(
*
str2
>=
'a'
&&
*
str2
<=
'z'
)
?
*
str2
+
'A'
-
'a'
:
*
str2
;
if
(
!
ch1
||
ch1
!=
ch2
)
return
ch1
-
ch2
;
str1
++
;
str2
++
;
}
}
/*
*****************************************************************************
...
...
@@ -241,12 +266,12 @@ int compare_name_id(const name_id_t *n1, const name_id_t *n2)
if
(
n1
->
name
.
s_name
->
type
==
str_char
&&
n2
->
name
.
s_name
->
type
==
str_char
)
{
return
strcasecmp
(
n1
->
name
.
s_name
->
str
.
cstr
,
n2
->
name
.
s_name
->
str
.
cstr
);
return
compare_striA
(
n1
->
name
.
s_name
->
str
.
cstr
,
n2
->
name
.
s_name
->
str
.
cstr
);
}
else
if
(
n1
->
name
.
s_name
->
type
==
str_unicode
&&
n2
->
name
.
s_name
->
type
==
str_unicode
)
{
return
strcmp
iW
(
n1
->
name
.
s_name
->
str
.
wstr
,
n2
->
name
.
s_name
->
str
.
wstr
);
return
compare_str
iW
(
n1
->
name
.
s_name
->
str
.
wstr
,
n2
->
name
.
s_name
->
str
.
wstr
);
}
else
{
...
...
tools/wrc/utils.h
View file @
865f23b5
...
...
@@ -33,6 +33,8 @@ char *xstrdup(const char *str);
#define __attribute__(X)
#endif
int
compare_striA
(
const
char
*
str1
,
const
char
*
str2
);
int
compare_striW
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
);
char
*
strmake
(
const
char
*
fmt
,
...)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
int
parser_error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
...
...
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