Bugzilla bug 209499: backed out the change to strncpy in the previous

checkin because I noticed a subtle difference between PL_strncpy and
strncpy (the code marked with JLRU).
This commit is contained in:
wchang0222%aol.com 2004-04-24 17:59:16 +00:00
Родитель d44c8e2932
Коммит 9297504571
1 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -46,9 +46,20 @@ PL_strcpy(char *dest, const char *src)
PR_IMPLEMENT(char *)
PL_strncpy(char *dest, const char *src, PRUint32 max)
{
if( ((char *)0 == dest) || ((const char *)0 == src) ) return (char *)0;
char *rv;
if( (char *)0 == dest ) return (char *)0;
if( (const char *)0 == src ) return (char *)0;
return strncpy(dest, src, (size_t)max);
for( rv = dest; max && ((*dest = *src) != 0); dest++, src++, max-- )
;
#ifdef JLRU
while( --max )
*++dest = '\0';
#endif /* JLRU */
return rv;
}
PR_IMPLEMENT(char *)