Re: msvcp140: implement _To_byte
July 9, 2017
10:42 a.m.
Hi, I was about to implement this function too, but it seems you've beaten me by two days :-) . Am 2017-07-08 um 17:55 schrieb Mikhail Paulyshka: > + WCHAR longstr[MAX_PATH + 3]; > + memset(longstr, 'A', sizeof(longstr)); This memset doesn't do what you probably expect. It doesn't fill the string with 'A's, but instead with U+4141 characters (䅁, http://www.fileformat.info/info/unicode/char/4141/index.htm). > + if (!src || !dst) > + return 0; This is redundant. WideCharToMultiByte checks this for you and returns 0. I noticed this after sending the _To_wide patch and will send a patch removing the redundant check from _To_wide.
July 2017
11 a.m.
New subject: msvcp140: implement _To_byte
On 09.07.2017 13:42, Stefan Dösinger wrote: > >> + if (!src || !dst) >> + return 0; > This is redundant. WideCharToMultiByte checks this for you and returns > 0. I noticed this after sending the _To_wide patch and will send a patch > removing the redundant check from _To_wide. > > Checking 'dst' is not redundant though.
11:02 a.m.
New subject: msvcp140: implement _To_byte
On 09.07.2017 14:00, Nikolay Sivov wrote: > On 09.07.2017 13:42, Stefan Dösinger wrote: >> >>> + if (!src || !dst) >>> + return 0; >> This is redundant. WideCharToMultiByte checks this for you and returns >> 0. I noticed this after sending the _To_wide patch and will send a patch >> removing the redundant check from _To_wide. >> >> > > Checking 'dst' is not redundant though. > Ah, maybe it is, because destination buffer length is never zero.
4:52 p.m.
New subject: msvcp140: implement _To_byte
Am 2017-07-09 um 13:02 schrieb Nikolay Sivov:
Checking 'dst' is not redundant though.
Ah, maybe it is, because destination buffer length is never zero. Yeah, those functions want a non-NULL dst buffer if they have a dst length.
if (!src || !srclen || (!dst && dstlen) || dstlen < 0)
3186
Age (days ago)
3186
Last active (days ago)
3 comments
2 participants
participants (2)
-
Nikolay Sivov -
Stefan Dösinger