[PATCH v3 2/3] msvcrt: Don't set error in wcstombs_s_l if no characters to convert.

Piotr Caban piotr.caban at gmail.com
Tue Feb 4 05:00:23 CST 2020


Hi Daniel,

On 2/3/20 11:45 PM, Daniel Lehman wrote:
          tmp = WideCharToMultiByte(locinfo->lc_codepage, 
WC_NO_BEST_FIT_CHARS,
                  *wcstr, -1, NULL, 0, NULL, &used_default)-1;
+        if(!tmp && !count)
+            return 0;
          if(!tmp || used_default) {
We're currently incorrectly checking for WideCharToMultiByte failure. 
tmp equals to WideCharToMultiByte()-1, so we should check if tmp==-1 
instead of !tmp (or preferably store WideCharToMultiByte return value in 
tmp).

Thanks,
Piotr



More information about the wine-devel mailing list