Add strncpyW to unicode.h

Jeff Latimer jeffl at defcen.gov.au
Tue Apr 26 05:43:52 CDT 2005


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?

Jeff Latimer


James Hawkins wrote:

>On 4/25/05, Jeff Latimer <jeffl at defcen.gov.au> wrote:
>  
>
>>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.
>>
>>    
>>
>
>Quoted from winehq.org Janitorial Page:
>
>"strncpy(dst,src,n) has two subtle problems. The first is that it
>always fills the whole dst buffer (n characters). The second is that
>it doesn't always nul terminate the dst buffer that it's filling. 
>Wine code should avoid the use of strncpy for these reasons, and
>instead use lstrcpynA/W or memcpy."
>
>
>  
>




More information about the wine-devel mailing list