Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
78ef8cf4
Commit
78ef8cf4
authored
3 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
wrc: Use compare_name_id() for resource translations.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2c42d8b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/wrc/translation.c
+5
-21
5 additions, 21 deletions
tools/wrc/translation.c
tools/wrc/utils.c
+26
-22
26 additions, 22 deletions
tools/wrc/utils.c
with
31 additions
and
43 deletions
tools/wrc/translation.c
+
5
−
21
View file @
78ef8cf4
...
...
@@ -274,18 +274,12 @@ static int compare_cursor_group(cursor_group_t *cursor_group1, cursor_group_t *c
static
int
compare_control
(
control_t
*
control1
,
control_t
*
control2
)
{
int
different
=
0
;
char
*
nameid
=
NULL
;
int
ignore_style
;
if
(((
control1
&&
!
control2
)
||
(
!
control1
&&
control2
)))
different
=
1
;
if
(
different
||
!
control1
||
!
control2
)
return
different
;
nameid
=
strdup
(
get_nameid_str
(
control1
->
ctlclass
));
if
(
strcmp
(
nameid
,
get_nameid_str
(
control2
->
ctlclass
)))
different
=
1
;
free
(
nameid
);
if
(
different
)
return
different
;
if
(
compare_name_id
(
control1
->
ctlclass
,
control2
->
ctlclass
))
return
1
;
/* allow the translators to set some styles */
ignore_style
=
0
;
...
...
@@ -324,7 +318,6 @@ static int compare_control(control_t *control1, control_t *control2) {
static
int
compare_dialog
(
dialog_t
*
dialog1
,
dialog_t
*
dialog2
)
{
int
different
=
0
;
char
*
nameid
=
NULL
;
control_t
*
ctrl1
,
*
ctrl2
;
if
(((
dialog1
->
memopt
!=
dialog2
->
memopt
)
||
(
dialog1
->
lvc
.
version
!=
dialog2
->
lvc
.
version
)
||
...
...
@@ -355,14 +348,9 @@ static int compare_dialog(dialog_t *dialog1, dialog_t *dialog2) {
((
dialog1
->
gothelpid
&&
!
dialog2
->
gothelpid
)
||
(
!
dialog1
->
gothelpid
&&
dialog2
->
gothelpid
)))
different
=
1
;
nameid
=
strdup
(
get_nameid_str
(
dialog1
->
menu
));
if
(
!
different
&&
strcmp
(
nameid
,
get_nameid_str
(
dialog2
->
menu
)))
different
=
1
;
free
(
nameid
);
nameid
=
strdup
(
get_nameid_str
(
dialog1
->
dlgclass
));
if
(
!
different
&&
strcmp
(
nameid
,
get_nameid_str
(
dialog2
->
dlgclass
)))
different
=
1
;
free
(
nameid
);
if
(
!
different
&&
compare_name_id
(
dialog1
->
menu
,
dialog2
->
menu
))
return
1
;
if
(
!
different
&&
compare_name_id
(
dialog1
->
dlgclass
,
dialog2
->
dlgclass
))
return
1
;
ctrl1
=
dialog1
->
controls
;
ctrl2
=
dialog2
->
controls
;
...
...
@@ -570,15 +558,11 @@ static int compare_stringtable(stringtable_t *stringtable1, stringtable_t *strin
static
int
compare_user
(
user_t
*
user1
,
user_t
*
user2
)
{
int
different
=
0
;
char
*
nameid
=
NULL
;
if
(((
user1
->
memopt
!=
user2
->
memopt
)
||
(
user1
->
data
->
lvc
.
version
!=
user2
->
data
->
lvc
.
version
)
||
(
user1
->
data
->
lvc
.
characts
!=
user2
->
data
->
lvc
.
characts
)))
different
=
1
;
nameid
=
strdup
(
get_nameid_str
(
user1
->
type
));
if
(
!
different
&&
strcmp
(
nameid
,
get_nameid_str
(
user2
->
type
)))
different
=
1
;
free
(
nameid
);
if
(
!
different
)
different
=
compare_name_id
(
user1
->
type
,
user2
->
type
);
return
different
;
}
...
...
This diff is collapsed.
Click to expand it.
tools/wrc/utils.c
+
26
−
22
View file @
78ef8cf4
...
...
@@ -153,6 +153,19 @@ int compare_striW( const WCHAR *str1, const WCHAR *str2 )
}
}
int
compare_striAW
(
const
char
*
str1
,
const
WCHAR
*
str2
)
{
for
(;;)
{
/* only the A-Z range is case-insensitive */
WCHAR
ch1
=
(
*
str1
>=
'a'
&&
*
str1
<=
'z'
)
?
*
str1
+
'A'
-
'a'
:
(
unsigned
char
)
*
str1
;
WCHAR
ch2
=
(
*
str2
>=
'a'
&&
*
str2
<=
'z'
)
?
*
str2
+
'A'
-
'a'
:
*
str2
;
if
(
!
ch1
||
ch1
!=
ch2
)
return
ch1
-
ch2
;
str1
++
;
str2
++
;
}
}
/*
*****************************************************************************
* Function : compare_name_id
...
...
@@ -165,30 +178,21 @@ int compare_striW( const WCHAR *str1, const WCHAR *str2 )
*/
int
compare_name_id
(
const
name_id_t
*
n1
,
const
name_id_t
*
n2
)
{
switch
(
n1
->
type
)
{
case
name_ord
:
if
(
n2
->
type
==
name_ord
)
return
n1
->
name
.
i_name
-
n2
->
name
.
i_name
;
return
1
;
if
(
n1
->
type
!=
n2
->
type
)
return
n1
->
type
==
name_ord
?
1
:
-
1
;
if
(
n1
->
type
==
name_ord
)
return
n1
->
name
.
i_name
-
n2
->
name
.
i_name
;
case
name_str
:
if
(
n2
->
type
==
name_str
)
{
if
(
n1
->
name
.
s_name
->
type
==
str_char
&&
n2
->
name
.
s_name
->
type
==
str_char
)
{
return
compare_striA
(
n1
->
name
.
s_name
->
str
.
cstr
,
n2
->
name
.
s_name
->
str
.
cstr
);
}
else
{
assert
(
n1
->
name
.
s_name
->
type
==
str_unicode
);
assert
(
n2
->
name
.
s_name
->
type
==
str_unicode
);
return
compare_striW
(
n1
->
name
.
s_name
->
str
.
wstr
,
n2
->
name
.
s_name
->
str
.
wstr
);
}
}
return
-
1
;
if
(
n1
->
name
.
s_name
->
type
==
str_char
)
{
if
(
n2
->
name
.
s_name
->
type
==
str_char
)
return
compare_striA
(
n1
->
name
.
s_name
->
str
.
cstr
,
n2
->
name
.
s_name
->
str
.
cstr
);
return
compare_striAW
(
n1
->
name
.
s_name
->
str
.
cstr
,
n2
->
name
.
s_name
->
str
.
wstr
);
}
else
{
if
(
n2
->
name
.
s_name
->
type
==
str_char
)
return
-
compare_striAW
(
n2
->
name
.
s_name
->
str
.
cstr
,
n1
->
name
.
s_name
->
str
.
wstr
);
return
compare_striW
(
n1
->
name
.
s_name
->
str
.
wstr
,
n2
->
name
.
s_name
->
str
.
wstr
);
}
return
0
;
/* Keep the compiler happy */
}
#ifdef _WIN32
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment