View | Details | Raw Unified | Return to bug 202969 | Differences between
and this patch

Collapse All | Expand All

(-)src/xfeutils.cpp (-30 lines)
Lines 563-598 int lstatmt(const char* filename, struct Link Here
563
#endif
563
#endif
564
564
565
565
566
// Safe strcpy function (Public domain, by C.B. Falconer)
567
// The destination string is always null terminated
568
// Size sz must be equal to strlen(src)+1
569
size_t strlcpy(char* dst, const char* src, size_t sz)
570
{
571
	const char *start = src;
572
573
	if (src && sz--)
574
	{
575
		while ((*dst++ = *src))
576
			if (sz--)
577
				src++;
578
			else
579
		 	{
580
            	*(--dst) = '\0';
581
            	break;
582
         	}
583
   	}
584
   	if (src)
585
   	{
586
      	while (*src++)
587
			continue;
588
      	return src - start - 1;
589
   	}
590
   	else if (sz)
591
		*dst = '\0';
592
	return 0;
593
}
594
595
596
// Safe strcat function (Public domain, by C.B. Falconer)
566
// Safe strcat function (Public domain, by C.B. Falconer)
597
// The destination string is always null terminated
567
// The destination string is always null terminated
598
size_t strlcat(char* dst, const char* src, size_t sz)
568
size_t strlcat(char* dst, const char* src, size_t sz)

Return to bug 202969