[dlls/msi/*] Strncpy elimination.

Peter Berg Larsen pebl at math.ku.dk
Mon Mar 28 12:30:33 CST 2005

On 28 Mar 2005, Alexandre Julliard wrote:

> > This memcpyies one element more than needed.. but seemed much nicer than
> > memcpy( ret, p, (len - 1)*sizeof(WHCAR);
> >
> > I probably should have subtracted one from len, making it obvious
> > that this is a strdupW, like:
> >   ret = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) );
> >   memcpy( ret, p, len*sizeof(WCHAR) );
> >   ret[len] = 0;
> If it's really a strdup it's cleaner to copy one more char and get rid
> of the ret[len] = 0.

Yes, and I would have done that, but in this case p is not \0 terminated.
I probably left it like that because I didnt understand why it copied one
byte to much in the strncpy case.

That is exactly the reason for sending the patches one dll at the time:
For authers/maintainers have a quick look at the replaces code. As I said
in the in the beginning; if there was a bug, then it still there (but
more obvious).


More information about the wine-devel mailing list