CString CString::operator+(const CString & tString) const { CString sResult((T_CHAR *)NULL); sResult.m_Length = m_Length + tString.m_Length; if (sResult.m_Length != 0) { sResult.m_String = (T_CHAR *)malloc((sResult.m_Length + 1) * sizeof(T_CHAR)); __strcpy(sResult.m_String, m_String, m_Length); __strcpy(sResult.m_String + m_Length, tString.m_String, tString.m_Length); sResult.m_String[sResult.m_Length] = '\0'; } return (sResult); } // operator+
/* * * strcpy - copies the string pointed by @src into the array pointed by @dst, * including the terminating null character. * @dst: pointer to the destination array where the content is to be copied * @src: string to be copied * * The return value is @dst. * * To avoid overflows, the size of array pointed by @dst should be long enough to * contain the same string as @src (including the terminating null character), and * should not overlap in memory with @src. * */ char *strcpy(char *dst, const char *src) { #ifdef __HAVE_ARCH_STRCPY return __strcpy(dst, src); #else char *p = dst; while ((*p++ = *src++) != '\0') /* nothing */ ; return dst; #endif /* __HAVE_ARCH_STRCPY */ }
void CString::__construct(const T_CHAR * pString, T_ULONG uLength) { if (pString != NULL) { m_Length = uLength; m_String = (T_CHAR *)malloc((m_Length + 1) * sizeof(T_CHAR)); __strcpy(m_String, pString, m_Length); m_String[m_Length] = 0; } else { m_Length = 0; m_String = NULL; } } // __construct
_WCRTLINK CHAR_TYPE *__F_NAME(strcpy,wcscpy)( CHAR_TYPE *s, const CHAR_TYPE *t ) #endif { #if !defined(__WIDECHAR__) && defined(_M_IX86) return( __strcpy( s, t ) ); #else CHAR_TYPE *dst; dst = s; while( *dst++ = *t++ ) ; return( s ); #endif }