Changeset 78153 in vbox for trunk/src/VBox
- Timestamp:
- Apr 17, 2019 12:30:08 PM (6 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/path/RTPathAbsDup.cpp
r78048 r78153 32 32 #include <iprt/path.h> 33 33 34 #include <iprt/err.h>35 #include <iprt/param.h>36 #include <iprt/string.h>37 38 34 39 35 /** … … 46 42 RTDECL(char *) RTPathAbsDup(const char *pszPath) 47 43 { 48 /* Try with a static buffer first. */ 49 char szPath[RTPATH_MAX]; 50 int rc = RTPathAbs(pszPath, szPath, sizeof(szPath)); 51 if (RT_SUCCESS(rc)) 52 return RTStrDup(szPath); 53 54 /* If it looks like we ran out of buffer space, double the size until 55 we reach 64 KB. */ 56 if (rc == VERR_FILENAME_TOO_LONG || rc == VERR_BUFFER_OVERFLOW) 57 { 58 size_t cbBuf = RTPATH_MAX; 59 do 60 { 61 cbBuf *= 2; 62 char *pszBuf = RTStrAlloc(cbBuf); 63 if (!pszBuf) 64 break; 65 rc = RTPathAbs(pszPath, pszBuf, cbBuf); 66 if (RT_SUCCESS(rc)) 67 return pszBuf; 68 RTStrFree(pszBuf); 69 } while (cbBuf <= _32K); 70 } 71 return NULL; 44 return RTPathAbsExDup(NULL, pszPath, RTPATH_STR_F_STYLE_HOST); 72 45 } 73 46 -
trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
r78098 r78153 185 185 { 186 186 Assert(pBaseParsed->cComps > 1); 187 if (iLast >= 0 || (pParsed->fProps & RTPATH_PROP_DIR_SLASH)) 187 if ( iLast >= 0 188 || (pParsed->fProps & RTPATH_PROP_DIR_SLASH) 189 || (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH) ) 188 190 pBaseParsed->fProps |= RTPATH_PROP_DIR_SLASH; 189 191 else … … 191 193 } 192 194 195 /* Apply the trailing flash flag to the input path: */ 196 if ( iLast >= 0 197 && (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH)) 198 pParsed->fProps |= RTPATH_PROP_DIR_SLASH; 199 193 200 /* 194 201 * Combine the two. RTPathParsedReassemble can handle in place stuff, as … … 207 214 rc = RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, 208 215 &pszAbsPath[cchBaseInPlace], *pcbAbsPath - cchBaseInPlace); 209 *pcbAbsPath = cchBaseInPlace + pParsed->cchPath;210 216 if (RT_SUCCESS(rc)) 217 { 218 *pcbAbsPath = cchBaseInPlace + pParsed->cchPath; 211 219 Assert(*pcbAbsPath == strlen(pszAbsPath)); 220 } 221 else 222 *pcbAbsPath = cchBaseInPlace + pParsed->cchPath + 1; 212 223 } 213 224 else … … 219 230 { 220 231 RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, pszAbsPath, 0); 221 *pcbAbsPath = pBaseParsed->cchPath + pParsed->cchPath ;232 *pcbAbsPath = pBaseParsed->cchPath + pParsed->cchPath + 1; 222 233 } 223 234 else 224 *pcbAbsPath = pBaseParsed->cchPath ;235 *pcbAbsPath = pBaseParsed->cchPath + 1; 225 236 } 226 237 … … 448 459 i++; 449 460 } 461 462 /* 463 * Before we continue, ensure trailing slash if requested. 464 */ 465 if ( (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH) 466 && iLast > 0) 467 pParsed->fProps |= RTPATH_PROP_DIR_SLASH; 450 468 451 469 /* … … 527 545 { 528 546 int rc2 = RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, pszAbsPath, 0); 529 Assert(rc2 == VERR_BUFFER_OVERFLOW); RT_NOREF(rc2);547 Assert(rc2 == VERR_BUFFER_OVERFLOW); 530 548 531 549 char *pszTmp = (char *)RTMemTmpAlloc(RTPATH_BIG_MAX); 532 550 if (pszTmp) 533 551 { 534 rc = RTPathGetCurrentDrive(pszTmp, RTPATH_BIG_MAX);535 if (RT_SUCCESS(rc ))552 rc2 = RTPathGetCurrentDrive(pszTmp, RTPATH_BIG_MAX); 553 if (RT_SUCCESS(rc2)) 536 554 *pcbAbsPath = strlen(pszTmp) + pParsed->cchPath + 1; 537 555 else … … 570 588 pParsed->aComps[i].cch = 0; 571 589 } 590 591 if ( (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH) 592 && pParsed->cComps > 1) 593 pParsed->fProps |= RTPATH_PROP_DIR_SLASH; 594 572 595 int rc = RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, pszAbsPath, *pcbAbsPath); 573 596 *pcbAbsPath = pParsed->cchPath + (rc == VERR_BUFFER_OVERFLOW); … … 589 612 590 613 AssertCompile(RTPATH_STR_F_STYLE_HOST == 0); 591 AssertReturn( RTPATH_STR_F_IS_VALID(fFlags, RTPATHABS_F_STOP_AT_BASE | RTPATHABS_F_STOP_AT_CWD )614 AssertReturn( RTPATH_STR_F_IS_VALID(fFlags, RTPATHABS_F_STOP_AT_BASE | RTPATHABS_F_STOP_AT_CWD | RTPATHABS_F_ENSURE_TRAILING_SLASH) 592 615 && !(fFlags & RTPATH_STR_F_MIDDLE), VERR_INVALID_FLAGS); 593 616 if ((fFlags & RTPATH_STR_F_STYLE_MASK) == RTPATH_STR_F_STYLE_HOST) -
trunk/src/VBox/Runtime/common/path/RTPathAbsExDup.cpp
r78104 r78153 39 39 RTDECL(char *) RTPathAbsExDup(const char *pszBase, const char *pszPath, uint32_t fFlags) 40 40 { 41 char szPath[RTPATH_MAX]; 42 size_t cbPath = sizeof(szPath); 43 int rc = RTPathAbsEx(pszBase, pszPath, fFlags, szPath, &cbPath); 44 if (RT_SUCCESS(rc)) 45 return RTStrDup(szPath); 41 unsigned cTries = 16; 42 size_t cbAbsPath = RTPATH_MAX / 2; 43 for (;;) 44 { 45 char *pszAbsPath = RTStrAlloc(cbAbsPath); 46 if (pszAbsPath) 47 { 48 size_t cbActual = cbAbsPath; 49 int rc = RTPathAbsEx(pszBase, pszPath, fFlags, pszAbsPath, &cbActual); 50 if (RT_SUCCESS(rc)) 51 { 52 if (cbActual < cbAbsPath / 2) 53 RTStrRealloc(&pszAbsPath, cbActual + 1); 54 return pszAbsPath; 55 } 46 56 47 if (rc == VERR_BUFFER_OVERFLOW) 48 { 49 size_t cbPrevPath = sizeof(szPath); 50 uint32_t cTries = 8; 51 while (cTries-- > 0) 52 { 53 cbPath = RT_MAX(RT_ALIGN_Z(cbPath + 16, 64), cbPrevPath + 256); 54 cbPrevPath = cbPath; 55 char *pszAbsPath = (char *)RTStrAlloc(cbPath); 56 if (pszAbsPath) 57 { 58 rc = RTPathAbsEx(pszBase, pszPath, fFlags, pszAbsPath, &cbPath); 59 if (RT_SUCCESS(rc)) 60 return pszAbsPath; 61 RTStrFree(pszAbsPath); 62 } 63 else 57 RTStrFree(pszAbsPath); 58 59 if (rc != VERR_BUFFER_OVERFLOW) 64 60 break; 61 62 if (--cTries == 0) 63 break; 64 65 cbAbsPath = RT_MAX(RT_ALIGN_Z(cbActual + 16, 64), cbAbsPath + 256); 65 66 } 67 else 68 break; 66 69 } 67 70 return NULL; -
trunk/src/VBox/Runtime/r3/dir.cpp
r78050 r78153 543 543 544 544 cbFilter = cucFilter0 = 0; 545 pszAbsPath = RTPathAbs Dup(pszPath);545 pszAbsPath = RTPathAbsExDup(NULL, pszPath, RTPATHABS_F_ENSURE_TRAILING_SLASH); 546 546 } 547 547 else … … 557 557 return VERR_NO_MEMORY; 558 558 pszTmp[pszFilter - pszPath] = '\0'; 559 pszAbsPath = RTPathAbs Dup(pszTmp);559 pszAbsPath = RTPathAbsExDup(NULL, pszTmp, RTPATHABS_F_ENSURE_TRAILING_SLASH); 560 560 RTStrFree(pszTmp); 561 561 } 562 562 else 563 pszAbsPath = RTPathAbs Dup(".");563 pszAbsPath = RTPathAbsExDup(NULL, ".", RTPATHABS_F_ENSURE_TRAILING_SLASH); 564 564 fDirSlash = true; 565 565 } 566 566 if (!pszAbsPath) 567 567 return VERR_NO_MEMORY; 568 569 568 Assert(strchr(pszAbsPath, '\0')[-1] == RTPATH_SLASH); 570 569 571 570 /* … … 576 575 */ 577 576 size_t const cchAbsPath = strlen(pszAbsPath); 578 size_t const cchAbsPathExtra = !RTPATH_IS_SEP(pszAbsPath[cchAbsPath - 1]) ? 1 : 0; /* add trailing '/' if missing */579 577 size_t const cbDir = rtDirNativeGetStructSize(pszAbsPath); 580 578 size_t const cbAllocated = cbDir 581 579 + cucFilter0 * sizeof(RTUNICP) 582 580 + cbFilter 583 + cchAbsPath + cchAbsPathExtra +1 + 4;581 + cchAbsPath + 1 + 4; 584 582 PRTDIRINTERNAL pDir = (PRTDIRINTERNAL)RTMemAllocZ(cbAllocated); 585 583 if (!pDir) … … 627 625 break; 628 626 } 629 pDir->cchPath = cchAbsPath + cchAbsPathExtra;627 pDir->cchPath = cchAbsPath; 630 628 pDir->pszPath = (char *)memcpy(pb, pszAbsPath, cchAbsPath); 631 pb[cchAbsPath] = RTPATH_SLASH; 632 pb[cchAbsPath + cchAbsPathExtra] = '\0'; 633 Assert(pb - (uint8_t *)pDir + cchAbsPath + cchAbsPathExtra + 1 <= cbAllocated); 629 pb[cchAbsPath] = '\0'; 630 Assert(pb - (uint8_t *)pDir + cchAbsPath + 1 <= cbAllocated); 634 631 pDir->pszName = NULL; 635 632 pDir->cchName = 0; -
trunk/src/VBox/Runtime/r3/win/path-win.cpp
r76553 r78153 671 671 int rc; 672 672 673 /* 674 * GetCurrentDirectory may in some cases omit the drive letter, according 675 * to MSDN, thus the GetFullPathName call. 676 */ 677 RTUTF16 wszCurPath[RTPATH_MAX]; 678 if (GetCurrentDirectoryW(RTPATH_MAX, wszCurPath)) 679 { 680 RTUTF16 wszFullPath[RTPATH_MAX]; 681 if (GetFullPathNameW(wszCurPath, RTPATH_MAX, wszFullPath, NULL)) 682 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cchPath, NULL); 673 if (cchPath > 0) 674 { 675 /* 676 * GetCurrentDirectory may in some cases omit the drive letter, according 677 * to MSDN, thus the GetFullPathName call. 678 */ 679 RTUTF16 wszCurPath[RTPATH_MAX]; 680 if (GetCurrentDirectoryW(RTPATH_MAX, wszCurPath)) 681 { 682 RTUTF16 wszFullPath[RTPATH_MAX]; 683 if (GetFullPathNameW(wszCurPath, RTPATH_MAX, wszFullPath, NULL)) 684 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cchPath, NULL); 685 else 686 rc = RTErrConvertFromWin32(GetLastError()); 687 } 683 688 else 684 689 rc = RTErrConvertFromWin32(GetLastError()); 685 690 } 686 691 else 687 rc = RTErrConvertFromWin32(GetLastError());692 rc = VERR_BUFFER_OVERFLOW; 688 693 return rc; 689 694 } … … 724 729 RTDECL(int) RTPathGetCurrentOnDrive(char chDrive, char *pszPath, size_t cbPath) 725 730 { 726 WCHAR wszInput[4];727 wszInput[0] = chDrive;728 wszInput[1] = ':';729 wszInput[2] = '\0';730 731 731 int rc; 732 RTUTF16 wszFullPath[RTPATH_MAX]; 733 if (GetFullPathNameW(wszInput, RTPATH_MAX, wszFullPath, NULL)) 734 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cbPath, NULL); 732 if (cbPath > 0) 733 { 734 WCHAR wszInput[4]; 735 wszInput[0] = chDrive; 736 wszInput[1] = ':'; 737 wszInput[2] = '\0'; 738 RTUTF16 wszFullPath[RTPATH_MAX]; 739 if (GetFullPathNameW(wszInput, RTPATH_MAX, wszFullPath, NULL)) 740 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cbPath, NULL); 741 else 742 rc = RTErrConvertFromWin32(GetLastError()); 743 } 735 744 else 736 rc = RTErrConvertFromWin32(GetLastError());745 rc = VERR_BUFFER_OVERFLOW; 737 746 return rc; 738 747 } -
trunk/src/VBox/Runtime/testcase/tstRTPath.cpp
r78098 r78153 279 279 const char *pcszOutput; 280 280 } 281 s_aRTPathAbsEx ExTests[] =281 s_aRTPathAbsExTests[] = 282 282 { 283 283 { RTPATH_STR_F_STYLE_HOST, NULL, "", VERR_PATH_ZERO_LENGTH, NULL }, … … 337 337 { RTPATH_STR_F_STYLE_UNIX, "/temp", "..", VINF_SUCCESS, "/" }, 338 338 }; 339 for (unsigned i = 0; i < RT_ELEMENTS(s_aRTPathAbsExExTests); ++ i) 340 { 341 if (RT_FAILURE(s_aRTPathAbsExExTests[i].rc)) 339 340 char *pszGuardedBuf = NULL; 341 rc = RTTestGuardedAlloc(hTest, RTPATH_MAX, 0, false /*fHead*/, (void **)&pszGuardedBuf); 342 if (RT_FAILURE(rc)) 343 pszGuardedBuf = szPath; 344 345 for (unsigned i = 0; i < RT_ELEMENTS(s_aRTPathAbsExTests); ++ i) 346 { 347 if (RT_FAILURE(s_aRTPathAbsExTests[i].rc)) 342 348 RTTestDisableAssertions(hTest); 343 349 344 350 size_t cbAbsPath = sizeof(szPath); 345 rc = RTPathAbsEx(s_aRTPathAbsEx ExTests[i].pcszInputBase,346 s_aRTPathAbsEx ExTests[i].pcszInputPath,347 s_aRTPathAbsEx ExTests[i].fFlags,351 rc = RTPathAbsEx(s_aRTPathAbsExTests[i].pcszInputBase, 352 s_aRTPathAbsExTests[i].pcszInputPath, 353 s_aRTPathAbsExTests[i].fFlags, 348 354 szPath, &cbAbsPath); 349 355 350 if (RT_FAILURE(s_aRTPathAbsEx ExTests[i].rc))356 if (RT_FAILURE(s_aRTPathAbsExTests[i].rc)) 351 357 RTTestRestoreAssertions(hTest); 352 358 353 if (rc != s_aRTPathAbsEx ExTests[i].rc)359 if (rc != s_aRTPathAbsExTests[i].rc) 354 360 { 355 361 RTTestIFailed("#%u: unexpected result code!\n" … … 361 367 " expected rc: %Rrc", 362 368 i, 363 s_aRTPathAbsEx ExTests[i].fFlags,364 s_aRTPathAbsEx ExTests[i].pcszInputBase,365 s_aRTPathAbsEx ExTests[i].pcszInputPath,369 s_aRTPathAbsExTests[i].fFlags, 370 s_aRTPathAbsExTests[i].pcszInputBase, 371 s_aRTPathAbsExTests[i].pcszInputPath, 366 372 szPath, rc, 367 s_aRTPathAbsEx ExTests[i].rc);373 s_aRTPathAbsExTests[i].rc); 368 374 continue; 369 375 } … … 371 377 char szTmp[RTPATH_MAX]; 372 378 char *pszExpected = NULL; 373 if (s_aRTPathAbsEx ExTests[i].pcszOutput != NULL)374 { 375 if (s_aRTPathAbsEx ExTests[i].pcszOutput[0] == '%')379 if (s_aRTPathAbsExTests[i].pcszOutput != NULL) 380 { 381 if (s_aRTPathAbsExTests[i].pcszOutput[0] == '%') 376 382 { 377 383 RTTESTI_CHECK_RC(rc = RTPathGetCurrent(szTmp, sizeof(szTmp)), VINF_SUCCESS); … … 381 387 pszExpected = szTmp; 382 388 383 if (s_aRTPathAbsEx ExTests[i].pcszOutput[1] == 'p')389 if (s_aRTPathAbsExTests[i].pcszOutput[1] == 'p') 384 390 { 385 391 cch = strlen(szTmp); 386 if (cch + strlen(s_aRTPathAbsEx ExTests[i].pcszOutput) - 2 <= sizeof(szTmp))387 strcpy(szTmp + cch, s_aRTPathAbsEx ExTests[i].pcszOutput + 2);392 if (cch + strlen(s_aRTPathAbsExTests[i].pcszOutput) - 2 <= sizeof(szTmp)) 393 strcpy(szTmp + cch, s_aRTPathAbsExTests[i].pcszOutput + 2); 388 394 } 389 395 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 390 else if (s_aRTPathAbsEx ExTests[i].pcszOutput[1] == 'd')396 else if (s_aRTPathAbsExTests[i].pcszOutput[1] == 'd') 391 397 { 392 if (2 + strlen(s_aRTPathAbsEx ExTests[i].pcszOutput) - 2 <= sizeof(szTmp))393 strcpy(szTmp + 2, s_aRTPathAbsEx ExTests[i].pcszOutput + 2);398 if (2 + strlen(s_aRTPathAbsExTests[i].pcszOutput) - 2 <= sizeof(szTmp)) 399 strcpy(szTmp + 2, s_aRTPathAbsExTests[i].pcszOutput + 2); 394 400 } 395 401 #endif … … 397 403 else 398 404 { 399 strcpy(szTmp, s_aRTPathAbsEx ExTests[i].pcszOutput);405 strcpy(szTmp, s_aRTPathAbsExTests[i].pcszOutput); 400 406 pszExpected = szTmp; 401 407 } … … 412 418 " cchResult: %#x, actual %#x", 413 419 i, 414 s_aRTPathAbsEx ExTests[i].fFlags,415 s_aRTPathAbsEx ExTests[i].pcszInputBase,416 s_aRTPathAbsEx ExTests[i].pcszInputPath,420 s_aRTPathAbsExTests[i].fFlags, 421 s_aRTPathAbsExTests[i].pcszInputBase, 422 s_aRTPathAbsExTests[i].pcszInputPath, 417 423 szPath, 418 pszExpected, s_aRTPathAbsEx ExTests[i].pcszOutput,424 pszExpected, s_aRTPathAbsExTests[i].pcszOutput, 419 425 cbAbsPath, strlen(szPath)); 426 continue; 420 427 } 421 } 422 } 428 429 if (RT_SUCCESS(s_aRTPathAbsExTests[i].rc)) 430 { 431 /* Test the RTPATHABS_F_ENSURE_TRAILING_SLASH flag: */ 432 cbAbsPath = sizeof(szPath); 433 rc = RTPathAbsEx(s_aRTPathAbsExTests[i].pcszInputBase, 434 s_aRTPathAbsExTests[i].pcszInputPath, 435 s_aRTPathAbsExTests[i].fFlags | RTPATHABS_F_ENSURE_TRAILING_SLASH, 436 szPath, &cbAbsPath); 437 char chSlash = (s_aRTPathAbsExTests[i].fFlags & RTPATH_STR_F_STYLE_MASK) == RTPATH_STR_F_STYLE_DOS ? '\\' 438 : (s_aRTPathAbsExTests[i].fFlags & RTPATH_STR_F_STYLE_MASK) == RTPATH_STR_F_STYLE_UNIX ? '/' 439 : RTPATH_SLASH; 440 if ( RT_FAILURE(rc) 441 || strlen(szPath) != cbAbsPath 442 || szPath[cbAbsPath - 1] != chSlash) 443 RTTestIFailed("#%u: Unexpected RTPATHABS_F_ENSURE_TRAILING_SLASH result: %Rrc\n" 444 " flags: %#x | RTPATHABS_F_ENSURE_TRAILING_SLASH\n" 445 " input base: '%s'\n" 446 " input path: '%s'\n" 447 " output: '%s' ('%c' vs '%c')\n" 448 " cchResult: %#x, actual %#x", 449 i, rc, 450 s_aRTPathAbsExTests[i].fFlags, 451 s_aRTPathAbsExTests[i].pcszInputBase, 452 s_aRTPathAbsExTests[i].pcszInputPath, 453 szPath, szPath[cbAbsPath - 1], chSlash, 454 cbAbsPath, strlen(szPath)); 455 456 /* Do overflow testing: */ 457 size_t const cbNeeded = strlen(pszExpected) + 1; 458 for (size_t cbBuf = 0; cbBuf < cbNeeded + 64; cbBuf++) 459 { 460 char *pszBuf = &pszGuardedBuf[RTPATH_MAX - cbBuf]; 461 memset(pszBuf, 0x33, cbBuf); 462 cbAbsPath = cbBuf; 463 rc = RTPathAbsEx(s_aRTPathAbsExTests[i].pcszInputBase, s_aRTPathAbsExTests[i].pcszInputPath, 464 s_aRTPathAbsExTests[i].fFlags, pszBuf, &cbAbsPath); 465 if ( cbBuf < cbNeeded 466 && ( rc != VERR_BUFFER_OVERFLOW 467 || cbAbsPath < cbNeeded)) 468 RTTestIFailed("#%u: Unexpected overflow result: %Rrc%s\n" 469 " flags: %#x\n" 470 " input base: '%s'\n" 471 " input path: '%s'\n" 472 " cbBuf[in]: %#x\n" 473 " cbBuf[out]: %#x\n" 474 " cbNeeded: %#x\n", 475 i, rc, rc != VERR_BUFFER_OVERFLOW ? " - expected VERR_BUFFER_OVERFLOW" : "", 476 s_aRTPathAbsExTests[i].fFlags, 477 s_aRTPathAbsExTests[i].pcszInputBase, 478 s_aRTPathAbsExTests[i].pcszInputPath, 479 cbBuf, 480 cbAbsPath, 481 cbNeeded); 482 else if ( cbBuf >= cbNeeded 483 && ( rc != s_aRTPathAbsExTests[i].rc 484 || cbAbsPath != cbNeeded - 1 485 || strcmp(pszBuf, pszExpected) 486 || strlen(pszBuf) != cbAbsPath)) 487 RTTestIFailed("#%u: Unexpected result: %Rrc (expected %Rrc)\n" 488 " flags: %#x\n" 489 " input base: '%s'\n" 490 " input path: '%s'\n" 491 " cbBuf[in]: %#x\n" 492 " cbBuf[out]: %#x\n" 493 " cbNeeded: %#x\n", 494 i, rc, s_aRTPathAbsExTests[i].rc, 495 s_aRTPathAbsExTests[i].fFlags, 496 s_aRTPathAbsExTests[i].pcszInputBase, 497 s_aRTPathAbsExTests[i].pcszInputPath, 498 cbBuf, 499 cbAbsPath, 500 cbNeeded); 501 502 } 503 } 504 505 /* RTPathAbsExDup */ 506 char *pszDup = RTPathAbsExDup(s_aRTPathAbsExTests[i].pcszInputBase, 507 s_aRTPathAbsExTests[i].pcszInputPath, 508 s_aRTPathAbsExTests[i].fFlags); 509 if ( (RT_SUCCESS(s_aRTPathAbsExTests[i].rc) ? pszDup == NULL : pszDup != NULL) 510 || RTStrCmp(pszDup, pszExpected)) 511 RTTestIFailed("#%u: Unexpected RTPathAbsExDup result: %p%s\n" 512 " flags: %#x\n" 513 " input base: '%s'\n" 514 " input path: '%s'\n" 515 " output: '%s'\n" 516 " expected: '%s' ('%s')\n", 517 i, pszDup, 518 (RT_SUCCESS(s_aRTPathAbsExTests[i].rc) ? pszDup == NULL : pszDup != NULL) ? pszDup ? "NULL" : "!NULL" : "", 519 s_aRTPathAbsExTests[i].fFlags, 520 s_aRTPathAbsExTests[i].pcszInputBase, 521 s_aRTPathAbsExTests[i].pcszInputPath, 522 pszDup, 523 pszExpected, s_aRTPathAbsExTests[i].pcszOutput); 524 RTStrFree(pszDup); 525 } 526 } 527 528 if (pszGuardedBuf != szPath) 529 RTTestGuardedFree(hTest, pszGuardedBuf); 423 530 424 531
Note:
See TracChangeset
for help on using the changeset viewer.