3rd patch to fix locale behavior
Mehmet YASAR
myasar at free.fr
Fri May 24 08:34:03 CDT 2002
Hi,
Here is my third attempt to fix some locale functions, I hope this is
the last ;-).
Alexandre, I have fixed strncpy() I'm doing now exactly as Windows (see
locale test)
Mehmet
-------------- next part --------------
diff -u /home/mehmet/CVS/wine/ole/ole2nls.c ole/ole2nls.c
--- /home/mehmet/CVS/wine/ole/ole2nls.c Sun Apr 28 15:42:21 2002
+++ ole/ole2nls.c Fri May 24 13:35:39 2002
@@ -574,8 +574,9 @@
}
/* if len=0 return only the length, don't touch the buffer*/
if (len) {
- lstrcpynA(buf,retString,len);
- return strlen(buf) + 1;
+ /* Like Windows we copy len bytes to buffer and we check len after */
+ strncpy(buf, retString, min(len, strlen(retString)+1));
+ return (len < strlen(retString) + 1)? 0 : strlen(retString)+1;
}
return strlen(retString)+1;
}
@@ -3275,9 +3276,8 @@
retVal = strlen(sDestination) + 1;
else
{
- strncpy (lpNumberStr, sDestination, cchNumber-1);
- *(lpNumberStr+cchNumber-1) = '\0'; /* ensure we got a NULL at the end */
- retVal = strlen(lpNumberStr);
+ strncpy (lpNumberStr, sDestination, min(cchNumber, strlen(sDestination)+1));
+ retVal = cchNumber < (strlen(sDestination)+1) ? 0: strlen(sDestination)+1;
}
return retVal;
@@ -3531,9 +3531,8 @@
else
{
- strncpy (lpCurrencyStr, pDestination, cchCurrency-1);
- *(lpCurrencyStr+cchCurrency-1) = '\0'; /* ensure we got a NULL at the end */
- return strlen(lpCurrencyStr);
+ strncpy (lpCurrencyStr, pDestination, min(cchCurrency, strlen(pDestination)+1));
+ return (cchCurrency < (strlen(pDestination)+1) ? 0: strlen(pDestination)+1);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locale.zip
Type: application/octet-stream
Size: 2537 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20020524/4ad48eb4/locale.obj
More information about the wine-patches
mailing list