----------------------------------------------------------------------------- Purpose: If COPY_ALL_CHARACTERS == max_chars_to_copy then we try to add the whole pSrc to the end of pDest, otherwise we copy only as many characters as are specified in max_chars_to_copy (or the # of characters in pSrc if thats's less). Input : *pDest - destination buffer *pSrc - string to append destBufferSize - sizeo
| 335 | // Output : char * the copied buffer |
| 336 | //----------------------------------------------------------------------------- |
| 337 | char *V_strncat(char *pDest, const char *pSrc, size_t destBufferSize, int max_chars_to_copy ) |
| 338 | { |
| 339 | size_t charstocopy = (size_t)0; |
| 340 | |
| 341 | Assert( pDest != NULL ); |
| 342 | Assert( pSrc != NULL ); |
| 343 | |
| 344 | size_t len = strlen(pDest); |
| 345 | size_t srclen = strlen( pSrc ); |
| 346 | if ( max_chars_to_copy <= COPY_ALL_CHARACTERS ) |
| 347 | { |
| 348 | charstocopy = srclen; |
| 349 | } |
| 350 | else |
| 351 | { |
| 352 | charstocopy = (size_t)Min( max_chars_to_copy, (int)srclen ); |
| 353 | } |
| 354 | |
| 355 | if ( len + charstocopy >= destBufferSize ) |
| 356 | { |
| 357 | charstocopy = destBufferSize - len - 1; |
| 358 | } |
| 359 | |
| 360 | if ( (ptrdiff_t)charstocopy <= 0 ) |
| 361 | { |
| 362 | return pDest; |
| 363 | } |
| 364 | |
| 365 | char *pOut = strncat( pDest, pSrc, charstocopy ); |
| 366 | return pOut; |
| 367 | } |
| 368 | |
| 369 | void V_SplitString2( const char *pString, const char * const *pSeparators, int nSeparators, CUtlVector<char*> &outStrings, bool bIncludeEmptyStrings ) |
| 370 | { |
no outgoing calls
no test coverage detected