Changeset 89054 in vbox for trunk/src/VBox/Devices
- Timestamp:
- May 15, 2021 2:14:57 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144394
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89053 r89054 242 242 243 243 /** 244 * Generates a tag. 245 * 246 * @returns VBox status code. 247 * @param pszTag The output buffer. 248 * @param cbTag The size of the output buffer. 249 * AUDIOTEST_TAG_MAX is a good size. 250 */ 251 int AudioTestGenTag(char *pszTag, size_t cbTag) 252 { 253 RTUUID UUID; 254 int rc = RTUuidCreate(&UUID); 255 AssertRCReturn(rc, rc); 256 rc = RTUuidToStr(&UUID, pszTag, cbTag); 257 AssertRCReturn(rc, rc); 258 return rc; 259 } 260 261 262 /** 263 * Return the tag to use in the given buffer, generating one if needed. 264 * 265 * @returns VBox status code. 266 * @param pszTag The output buffer. 267 * @param cbTag The size of the output buffer. 268 * AUDIOTEST_TAG_MAX is a good size. 269 * @param pszTagUser User specified tag, optional. 270 */ 271 int AudioTestCopyOrGenTag(char *pszTag, size_t cbTag, const char *pszTagUser) 272 { 273 if (pszTagUser && *pszTagUser) 274 return RTStrCopy(pszTag, cbTag, pszTagUser); 275 return AudioTestGenTag(pszTag, cbTag); 276 } 277 278 279 /** 244 280 * Creates a new path (directory) for a specific audio test set tag. 245 281 * … … 255 291 int AudioTestPathCreate(char *pszPath, size_t cbPath, const char *pszTag) 256 292 { 257 AssertReturn(strlen(pszTag) <= AUDIOTEST_TAG_MAX, VERR_INVALID_PARAMETER); 258 259 int rc; 260 261 char szTag[RTUUID_STR_LENGTH + 1]; 262 if (pszTag) 263 { 264 rc = RTStrCopy(szTag, sizeof(szTag), pszTag); 265 AssertRCReturn(rc, rc); 266 } 267 else /* Create an UUID if no tag is specified. */ 268 { 269 RTUUID UUID; 270 rc = RTUuidCreate(&UUID); 271 AssertRCReturn(rc, rc); 272 rc = RTUuidToStr(&UUID, szTag, sizeof(szTag)); 273 AssertRCReturn(rc, rc); 274 } 293 char szTag[AUDIOTEST_TAG_MAX]; 294 int rc = AudioTestCopyOrGenTag(szTag, sizeof(szTag), pszTag); 295 AssertRCReturn(rc, rc); 275 296 276 297 char szName[RT_ELEMENTS(AUDIOTEST_PATH_PREFIX_STR) + AUDIOTEST_TAG_MAX + 4]; … … 523 544 int AudioTestPathCreateTemp(char *pszPath, size_t cbPath, const char *pszTag) 524 545 { 525 AssertReturn( strlen(pszTag) <= AUDIOTEST_TAG_MAX, VERR_INVALID_PARAMETER);546 AssertReturn(pszTag && strlen(pszTag) <= AUDIOTEST_TAG_MAX, VERR_INVALID_PARAMETER); 526 547 527 548 char szPath[RTPATH_MAX]; … … 546 567 int AudioTestSetCreate(PAUDIOTESTSET pSet, const char *pszPath, const char *pszTag) 547 568 { 548 AssertReturn(strlen(pszTag) <= AUDIOTEST_TAG_MAX, VERR_INVALID_PARAMETER);549 550 int rc;551 552 569 audioTestSetInitInternal(pSet); 570 571 int rc = AudioTestCopyOrGenTag(pSet->szTag, sizeof(pSet->szTag), pszTag); 572 AssertRCReturn(rc, rc); 553 573 554 574 if (pszPath) … … 557 577 AssertRCReturn(rc, rc); 558 578 559 rc = AudioTestPathCreate(pSet->szPathAbs, sizeof(pSet->szPathAbs), p szTag);579 rc = AudioTestPathCreate(pSet->szPathAbs, sizeof(pSet->szPathAbs), pSet->szTag); 560 580 } 561 581 else 562 rc = AudioTestPathCreateTemp(pSet->szPathAbs, sizeof(pSet->szPathAbs), p szTag);582 rc = AudioTestPathCreateTemp(pSet->szPathAbs, sizeof(pSet->szPathAbs), pSet->szTag); 563 583 AssertRCReturn(rc, rc); 564 584 … … 583 603 rc = audioTestManifestWriteLn(pSet, "ver=%d", AUDIOTEST_MANIFEST_VER); 584 604 AssertRCReturn(rc, rc); 585 rc = audioTestManifestWriteLn(pSet, "tag=%s", p szTag);605 rc = audioTestManifestWriteLn(pSet, "tag=%s", pSet->szTag); 586 606 AssertRCReturn(rc, rc); 587 607 … … 613 633 614 634 pSet->enmMode = AUDIOTESTSETMODE_TEST; 615 616 rc = RTStrCopy(pSet->szTag, sizeof(pSet->szTag), pszTag);617 AssertRCReturn(rc, rc);618 635 } 619 636 … … 676 693 677 694 char szManifest[RTPATH_MAX]; 678 int rc = RTStrCopy(szManifest, sizeof(szManifest), pszPath); 679 AssertRCReturn(rc, rc); 680 681 rc = RTPathAppend(szManifest, sizeof(szManifest), AUDIOTEST_MANIFEST_FILE_STR); 695 int rc = RTPathJoin(szManifest, sizeof(szManifest), pszPath, AUDIOTEST_MANIFEST_FILE_STR); 682 696 AssertRCReturn(rc, rc); 683 697
Note:
See TracChangeset
for help on using the changeset viewer.