int iMaxLength
)
{
- return strncpy(lpString1,lpString2,iMaxLength);
+ /* Can't use strncpy, because strncpy will fill unused bytes in
+ lpString1 with NUL bytes while lstrcpynA doesn't */
+
+ if (0 != iMaxLength)
+ {
+ char *d = lpString1;
+ const char *s = lpString2;
+
+ do
+ {
+ if (0 == (*d++ = *s++))
+ {
+ break;
+ }
+ }
+ while(0 != --iMaxLength);
+ }
+
+ return lpString1;
}
int iMaxLength
)
{
- return wcsncpy(lpString1,lpString2,iMaxLength);
+ /* Can't use wcsncpy, because wcsncpy will fill unused bytes in
+ lpString1 with NUL bytes while lstrcpynW doesn't */
+
+ if (0 != iMaxLength)
+ {
+ WCHAR *d = lpString1;
+ const WCHAR *s = lpString2;
+
+ do
+ {
+ if (0 == (*d++ = *s++))
+ {
+ break;
+ }
+ }
+ while(0 != --iMaxLength);
+ }
+
+ return lpString1;
}
-/* $Id: tcsncpy.h,v 1.2 2004/01/27 21:43:47 gvg Exp $
+/* $Id: tcsncpy.h,v 1.3 2004/01/28 08:51:09 gvg Exp $
*/
#include "tchar.h"
_tstos
test %_treg(a), %_treg(a)
jnz .L1
+ rep _tstos
.L2:
mov 0x0C(%esp), %eax
-/* $Id: tcsncpy.h,v 1.2 2004/01/27 21:43:47 gvg Exp $
+/* $Id: tcsncpy.h,v 1.3 2004/01/28 08:51:09 gvg Exp $
*/
#include <stddef.h>
{
if((*d ++ = *s ++) == 0)
{
+ while (-- n != 0) *d ++ = 0;
break;
}
}