Re: [Qemu-devel] [PATCH for-3.1 v3 1/2] usb-mtp: fix utf16_to_str

2018-12-03 Thread Markus Armbruster
Gerd Hoffmann writes: > Make utf16_to_str return an allocated string. Remove the assumtion that > the number of string bytes equals the number of utf16 chars (which is > only true for ascii chars). Instead call wcstombs twice, once to figure > the storage size and once for the actual conversion

Re: [Qemu-devel] [PATCH for-3.1 v3 1/2] usb-mtp: fix utf16_to_str

2018-12-03 Thread Philippe Mathieu-Daudé
On 3/12/18 11:10, Gerd Hoffmann wrote: > Make utf16_to_str return an allocated string. Remove the assumtion that > the number of string bytes equals the number of utf16 chars (which is > only true for ascii chars). Instead call wcstombs twice, once to figure > the storage size and once for the ac

Re: [Qemu-devel] [PATCH for-3.1 v3 1/2] usb-mtp: fix utf16_to_str

2018-12-03 Thread Peter Maydell
On Mon, 3 Dec 2018 at 10:15, Gerd Hoffmann wrote: > > Make utf16_to_str return an allocated string. Remove the assumtion that > the number of string bytes equals the number of utf16 chars (which is > only true for ascii chars). Instead call wcstombs twice, once to figure > the storage size and o

[Qemu-devel] [PATCH for-3.1 v3 1/2] usb-mtp: fix utf16_to_str

2018-12-03 Thread Gerd Hoffmann
Make utf16_to_str return an allocated string. Remove the assumtion that the number of string bytes equals the number of utf16 chars (which is only true for ascii chars). Instead call wcstombs twice, once to figure the storage size and once for the actual conversion (as suggested by the wcstombs m