Add strncpyW to unicode.h

James Hawkins truiken at gmail.com
Tue Apr 26 09:42:52 CDT 2005


On 4/26/05, Jeff Latimer <jeffl at defcen.gov.au> wrote:
> Thanks for that.  I suppose that wrappering memcpy as as strncpy is not
> a good idea.  To save confusion, would a comment in unicode.h to say
> "don't worry strncpyW is missing by design and that memcpy/lstrcpynA/W
> should be used instead" be a good precaution?
> 

ChangeSet ID:	17236
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at wine.codeweavers.com	2005/04/25 11:23:33

Modified files:
	include        : winbase.h 

Log message:
	Define strncpy to an error to make sure it doesn't creep back in.

Patch: http://cvs.winehq.org/patch.py?id=17236

Old revision  New revision  Changes     Path
 1.229         1.230         +4 -0       wine/include/winbase.h

Index: wine/include/winbase.h
diff -u -p wine/include/winbase.h:1.229 wine/include/winbase.h:1.230
--- wine/include/winbase.h:1.229	Tue Apr 26 14:41:32 2005
+++ wine/include/winbase.h	Tue Apr 26 14:41:32 2005
@@ -2065,6 +2065,10 @@ extern inline LPSTR WINAPI lstrcatA( LPS
     return strcat( dst, src );
 }
 
+/* strncpy doesn't do what you think, don't use it */
+#undef strncpy
+#define strncpy(d,s,n) error do_not_use_strncpy_use_lstrcpynA_or_memcpy_instead
+
 #endif /* !defined(WINE_NO_INLINE_STRING) && defined(__WINESRC__) */
 
 #define     lstrcat WINELIB_NAME_AW(lstrcat)


-- 
James Hawkins




More information about the wine-devel mailing list