I have just been reading the lists and realise that strncpyW/strncpy is bad news for some reason. Please consider this patch withdrawn. Wouldn't it be better to implement strncpyW as a wrapper for memcpy? Given that all the other string functions are implemeted with the (W) version, having strncpyW missing is a bit confusing. Jeff Latimer Jeff Latimer wrote:
An implementation of strncpyW.
Jeff Latimer
------------------------------------------------------------------------
Index: unicode.h =================================================================== RCS file: /home/wine/wine/include/wine/unicode.h,v retrieving revision 1.31 diff -u -r1.31 unicode.h --- unicode.h 21 Apr 2005 17:18:50 -0000 1.31 +++ unicode.h 25 Apr 2005 10:48:05 -0000 @@ -191,6 +191,18 @@ return dst; }
+static inline WCHAR *strncpyW( WCHAR *dst, const WCHAR *src, int maxlen ) +{ + WCHAR *p = dst; + if (maxlen > 0 ) + { + maxlen--; + while (((*p++ = *src++) && maxlen--)); + } + if (*p) *p++ = (WCHAR) "\0"; + return dst; +} + static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 ) { while (*str1 && (*str1 == *str2)) { str1++; str2++; }