зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
d44c8e2932
Коммит
9297504571
|
@ -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;
|
||||
|
||||
return strncpy(dest, src, (size_t)max);
|
||||
if( (char *)0 == dest ) return (char *)0;
|
||||
if( (const char *)0 == src ) return (char *)0;
|
||||
|
||||
for( rv = dest; max && ((*dest = *src) != 0); dest++, src++, max-- )
|
||||
;
|
||||
|
||||
#ifdef JLRU
|
||||
while( --max )
|
||||
*++dest = '\0';
|
||||
#endif /* JLRU */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(char *)
|
||||
|
|
Загрузка…
Ссылка в новой задаче