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
6afcd71a
Commit
6afcd71a
authored
Apr 28, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Move Unicode conversion out of string_from_unicode_text.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
56f1ed6a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
26 deletions
+30
-26
clipboard.c
dlls/winex11.drv/clipboard.c
+30
-26
No files found.
dlls/winex11.drv/clipboard.c
View file @
6afcd71a
...
...
@@ -729,9 +729,11 @@ static void *import_utf8_string( Atom type, const void *data, size_t size, size_
DWORD
str_size
;
WCHAR
*
ret
;
if
(
!
(
ret
=
malloc
(
(
size
*
2
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
RtlUTF8ToUnicodeN
(
ret
+
size
,
size
*
sizeof
(
WCHAR
),
&
str_size
,
data
,
size
);
return
unicode_text_from_string
(
ret
,
ret
+
size
,
str_size
/
sizeof
(
WCHAR
),
ret_size
);
RtlUTF8ToUnicodeN
(
NULL
,
0
,
&
str_size
,
data
,
size
);
if
(
!
(
ret
=
malloc
(
str_size
*
2
+
sizeof
(
WCHAR
)
)))
return
NULL
;
RtlUTF8ToUnicodeN
(
ret
+
str_size
/
sizeof
(
WCHAR
),
str_size
,
&
str_size
,
data
,
size
);
return
unicode_text_from_string
(
ret
,
ret
+
str_size
/
sizeof
(
WCHAR
),
str_size
/
sizeof
(
WCHAR
),
ret_size
);
}
...
...
@@ -1198,19 +1200,9 @@ static BOOL export_data( Display *display, Window win, Atom prop, Atom target, v
*
* Convert CF_UNICODETEXT data to a string in the specified codepage.
*/
static
char
*
string_from_unicode_text
(
UINT
codepage
,
const
WCHAR
*
string
,
size_t
string_size
,
size_t
*
size
)
static
void
string_from_unicode_text
(
char
*
str
,
size_t
len
,
DWORD
*
size
)
{
UINT
i
,
j
;
char
*
str
;
UINT
lenW
=
string_size
/
sizeof
(
WCHAR
);
DWORD
len
;
if
(
!
string_size
)
return
NULL
;
len
=
WideCharToMultiByte
(
codepage
,
0
,
string
,
lenW
,
NULL
,
0
,
NULL
,
NULL
);
if
((
str
=
malloc
(
len
)))
{
WideCharToMultiByte
(
codepage
,
0
,
string
,
lenW
,
str
,
len
,
NULL
,
NULL
);
DWORD
i
,
j
;
/* remove carriage returns */
for
(
i
=
j
=
0
;
i
<
len
;
i
++
)
...
...
@@ -1219,10 +1211,8 @@ static char *string_from_unicode_text( UINT codepage, const WCHAR *string, size_
str
[
j
++
]
=
str
[
i
];
}
while
(
j
&&
!
str
[
j
-
1
])
j
--
;
/* remove trailing nulls */
*
size
=
j
;
TRACE
(
"returning %s
\n
"
,
debugstr_an
(
str
,
j
));
}
return
str
;
*
size
=
j
;
}
...
...
@@ -1233,10 +1223,14 @@ static char *string_from_unicode_text( UINT codepage, const WCHAR *string, size_
*/
static
BOOL
export_string
(
Display
*
display
,
Window
win
,
Atom
prop
,
Atom
target
,
void
*
data
,
size_t
size
)
{
char
*
text
=
string_from_unicode_text
(
28591
,
data
,
size
,
&
size
);
DWORD
len
;
char
*
text
;
if
(
!
text
)
return
FALSE
;
put_property
(
display
,
win
,
prop
,
target
,
8
,
text
,
size
);
if
(
!
(
text
=
malloc
(
size
)))
return
FALSE
;
len
=
WideCharToMultiByte
(
28591
,
0
,
data
,
size
/
sizeof
(
WCHAR
),
text
,
size
,
NULL
,
NULL
);
string_from_unicode_text
(
text
,
len
,
&
len
);
put_property
(
display
,
win
,
prop
,
target
,
8
,
text
,
len
);
free
(
text
);
return
TRUE
;
}
...
...
@@ -1250,10 +1244,14 @@ static BOOL export_string( Display *display, Window win, Atom prop, Atom target,
static
BOOL
export_utf8_string
(
Display
*
display
,
Window
win
,
Atom
prop
,
Atom
target
,
void
*
data
,
size_t
size
)
{
char
*
text
=
string_from_unicode_text
(
CP_UTF8
,
data
,
size
,
&
size
);
DWORD
len
;
char
*
text
;
if
(
!
text
)
return
FALSE
;
put_property
(
display
,
win
,
prop
,
target
,
8
,
text
,
size
);
if
(
!
(
text
=
malloc
(
size
/
sizeof
(
WCHAR
)
*
3
)))
return
FALSE
;
RtlUnicodeToUTF8N
(
text
,
size
/
sizeof
(
WCHAR
)
*
3
,
&
len
,
data
,
size
);
string_from_unicode_text
(
text
,
len
,
&
len
);
put_property
(
display
,
win
,
prop
,
target
,
8
,
text
,
len
);
free
(
text
);
return
TRUE
;
}
...
...
@@ -1280,9 +1278,15 @@ static BOOL export_compound_text( Display *display, Window win, Atom prop, Atom
{
XTextProperty
textprop
;
XICCEncodingStyle
style
;
char
*
text
=
string_from_unicode_text
(
CP_UNIXCP
,
data
,
size
,
&
size
);
DWORD
len
;
char
*
text
;
if
(
!
(
text
=
malloc
(
size
/
sizeof
(
WCHAR
)
*
3
)))
return
FALSE
;
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
data
,
size
/
sizeof
(
WCHAR
),
text
,
size
/
sizeof
(
WCHAR
)
*
3
,
NULL
,
NULL
);
string_from_unicode_text
(
text
,
len
,
&
len
);
if
(
!
text
)
return
FALSE
;
if
(
target
==
x11drv_atom
(
COMPOUND_TEXT
))
style
=
XCompoundTextStyle
;
else
...
...
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