- Timestamp:
- May 22, 2009 11:47:35 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 47630
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/path.h
r19927 r19928 349 349 * concatenating the two partial paths. 350 350 * 351 * @returns IPRT status code. 352 * @retval VERR_PATH 351 * @retval VINF_SUCCESS on success. 352 * @retval VERR_BUFFER_OVERFLOW if the result is too big to fit within 353 * cbPathDst bytes. No changes has been made. 354 * @retval VERR_INVALID_PARAMETER if the string pointed to by pszPath is longer 355 * than cbPathDst-1 bytes (failed to find terminator). Asserted. 353 356 * 354 357 * @param pszPath The path to append pszAppend to. This serves as both 355 358 * input and output. This can be empty, in which case 356 359 * pszAppend is just copied over. 357 * @param c chPathDst The size of the buffer pszPath points to. This358 * should NOT be strlen(pszPath).360 * @param cbPathDst The size of the buffer pszPath points to, terminator 361 * included. This should NOT be strlen(pszPath). 359 362 * @param pszAppend The partial path to append to pszPath. This can be 360 363 * NULL, in which case nothing is done. … … 371 374 * sizeof(szBuf), "bar") will result in "C:bar". 372 375 */ 373 RTDECL(int) RTPathAppend(char *pszPath, size_t c chPathDst, const char *pszAppend);376 RTDECL(int) RTPathAppend(char *pszPath, size_t cbPathDst, const char *pszAppend); 374 377 375 378 -
trunk/src/VBox/Runtime/r3/path.cpp
r19926 r19928 729 729 730 730 731 RTDECL(int) RTPathAppend(char *pszPath, size_t c chPath, const char *pszAppend)732 { 733 char *pszPathEnd = (char *)memchr(pszPath, '\0', c chPath);731 RTDECL(int) RTPathAppend(char *pszPath, size_t cbPathDst, const char *pszAppend) 732 { 733 char *pszPathEnd = (char *)memchr(pszPath, '\0', cbPathDst); 734 734 AssertReturn(pszPathEnd, VERR_INVALID_PARAMETER); 735 735 … … 744 744 if (pszPathEnd == pszPath) 745 745 { 746 if (cchAppend >= c chPath)746 if (cchAppend >= cbPathDst) 747 747 return VERR_BUFFER_OVERFLOW; 748 748 memcpy(pszPath, pszAppend, cchAppend + 1); … … 762 762 && RT_C_IS_ALPHA(pszPath[0])) 763 763 { 764 if ((size_t)(pszPathEnd - pszPath) + cchAppend >= c chPath)764 if ((size_t)(pszPathEnd - pszPath) + cchAppend >= cbPathDst) 765 765 return VERR_BUFFER_OVERFLOW; 766 766 } … … 768 768 #endif 769 769 { 770 if ((size_t)(pszPathEnd - pszPath) + 1 + cchAppend >= c chPath)770 if ((size_t)(pszPathEnd - pszPath) + 1 + cchAppend >= cbPathDst) 771 771 return VERR_BUFFER_OVERFLOW; 772 772 *pszPathEnd++ = '/'; … … 779 779 pszAppend++, cchAppend--; 780 780 781 if ((size_t)(pszPathEnd - pszPath) + cchAppend >= c chPath)781 if ((size_t)(pszPathEnd - pszPath) + cchAppend >= cbPathDst) 782 782 return VERR_BUFFER_OVERFLOW; 783 783 } … … 796 796 pszPathEnd--; 797 797 798 if ((size_t)(pszPathEnd - pszPath) + cchAppend >= c chPath)798 if ((size_t)(pszPathEnd - pszPath) + cchAppend >= cbPathDst) 799 799 return VERR_BUFFER_OVERFLOW; 800 800 }
Note:
See TracChangeset
for help on using the changeset viewer.