| 326 | |
| 327 | |
| 328 | void tfd_replaceSubStr( char const * aSource, char const * aOldSubStr, |
| 329 | char const * aNewSubStr, char * aoDestination ) |
| 330 | { |
| 331 | char const * pOccurence ; |
| 332 | char const * p ; |
| 333 | char const * lNewSubStr = "" ; |
| 334 | size_t lOldSubLen = strlen( aOldSubStr ) ; |
| 335 | |
| 336 | if ( ! aSource ) |
| 337 | { |
| 338 | * aoDestination = '\0' ; |
| 339 | return ; |
| 340 | } |
| 341 | if ( ! aOldSubStr ) |
| 342 | { |
| 343 | strcpy( aoDestination , aSource ) ; |
| 344 | return ; |
| 345 | } |
| 346 | if ( aNewSubStr ) |
| 347 | { |
| 348 | lNewSubStr = aNewSubStr ; |
| 349 | } |
| 350 | p = aSource ; |
| 351 | * aoDestination = '\0' ; |
| 352 | while ( ( pOccurence = strstr( p , aOldSubStr ) ) != NULL ) |
| 353 | { |
| 354 | strncat( aoDestination , p , pOccurence - p ) ; |
| 355 | strcat( aoDestination , lNewSubStr ) ; |
| 356 | p = pOccurence + lOldSubLen ; |
| 357 | } |
| 358 | strcat( aoDestination , p ) ; |
| 359 | } |
| 360 | |
| 361 | |
| 362 | static int filenameValid( char const * aFileNameWithoutPath ) |
no outgoing calls
no test coverage detected