-----------------------------------------------------------------------------
| 2469 | |
| 2470 | //----------------------------------------------------------------------------- |
| 2471 | bool stripRepeatSlashes(char* pDstPath, const char* pSrcPath, S32 dstSize) |
| 2472 | { |
| 2473 | // Note original destination. |
| 2474 | char* pOriginalDst = pDstPath; |
| 2475 | |
| 2476 | // Reset last source character. |
| 2477 | char lastSrcChar = 0; |
| 2478 | |
| 2479 | // Search source... |
| 2480 | while (dstSize > 0) |
| 2481 | { |
| 2482 | // Fetch characters. |
| 2483 | const char srcChar = *pSrcPath++; |
| 2484 | |
| 2485 | // Do we have a repeat slash? |
| 2486 | if (srcChar == '/' && lastSrcChar == '/') |
| 2487 | { |
| 2488 | // Yes, so skip it. |
| 2489 | continue; |
| 2490 | } |
| 2491 | |
| 2492 | // No, so copy character. |
| 2493 | *pDstPath++ = srcChar; |
| 2494 | |
| 2495 | // Finish if end of source. |
| 2496 | if (srcChar == 0) |
| 2497 | return true; |
| 2498 | |
| 2499 | // Reduce room left in destination. |
| 2500 | dstSize--; |
| 2501 | |
| 2502 | // Set last character. |
| 2503 | lastSrcChar = srcChar; |
| 2504 | } |
| 2505 | |
| 2506 | // Terminate the destination string as we ran out of room. |
| 2507 | *pOriginalDst = 0; |
| 2508 | |
| 2509 | // Fail! |
| 2510 | return false; |
| 2511 | } |
| 2512 | |
| 2513 | } // end of Console namespace |
| 2514 |
no outgoing calls
no test coverage detected