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
78ef8cf4
Commit
78ef8cf4
authored
Feb 08, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Use compare_name_id() for resource translations.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2c42d8b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
43 deletions
+31
-43
translation.c
tools/wrc/translation.c
+5
-21
utils.c
tools/wrc/utils.c
+26
-22
No files found.
tools/wrc/translation.c
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
;
}
...
...
tools/wrc/utils.c
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
...
...
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