Changeset 100427 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- Jul 7, 2023 10:01:38 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-provider-local.cpp
r100396 r100427 563 563 } 564 564 565 /** 566 * Initializes a local list entry. 567 * 568 * @returns VBox status code. 569 * @param pEntry List entry to init. 570 * @param pszName File name to use. 571 * @param pObjInfo Object information to use. 572 */ 573 static DECLCALLBACK(int) shclTransferIfaceLocalListEntryInit(PSHCLLISTENTRY pEntry, const char *pszName, PRTFSOBJINFO pObjInfo) 574 { 575 PSHCLFSOBJINFO pFsObjInfo = (PSHCLFSOBJINFO)RTMemAllocZ(sizeof(SHCLFSOBJINFO)); 576 AssertPtrReturn(pFsObjInfo, VERR_NO_MEMORY); 577 578 int rc = ShClFsObjInfoFromIPRT(pFsObjInfo, pObjInfo); 579 if (RT_SUCCESS(rc)) 580 { 581 rc = ShClTransferListEntryInitEx(pEntry, VBOX_SHCL_INFO_F_FSOBJINFO, pszName, pFsObjInfo, sizeof(SHCLFSOBJINFO)); 582 /* pEntry has taken ownership of pFsObjInfo on success. */ 583 } 584 585 if (RT_FAILURE(rc)) 586 { 587 RTMemFree(pFsObjInfo); 588 pFsObjInfo = NULL; 589 } 590 591 if (RT_FAILURE(rc)) 592 LogRel(("Shared Clipboard: Initializing list entry '%s' failed: %Rrc\n", pszName, rc)); 593 594 return rc; 595 } 596 565 597 /** @copydoc SHCLTXPROVIDERIFACE::pfnListEntryRead */ 566 598 static DECLCALLBACK(int) shclTransferIfaceLocalListEntryRead(PSHCLTXPROVIDERCTX pCtx, … … 625 657 if ( RT_SUCCESS(rc) 626 658 && !fSkipEntry) 627 { 628 rc = RTStrCopy(pEntry->pszName, pEntry->cbName, pDirEntry->szName); 629 if (RT_SUCCESS(rc)) 630 { 631 pEntry->cbName = (uint32_t)strlen(pEntry->pszName) + 1; /* Include termination. */ 632 633 AssertPtr(pEntry->pvInfo); 634 Assert (pEntry->cbInfo == sizeof(SHCLFSOBJINFO)); 635 636 ShClFsObjInfoFromIPRT(PSHCLFSOBJINFO(pEntry->pvInfo), &pDirEntry->Info); 637 638 LogFlowFunc(("Entry pszName=%s, pvInfo=%p, cbInfo=%RU32\n", 639 pEntry->pszName, pEntry->pvInfo, pEntry->cbInfo)); 640 } 641 } 659 rc = shclTransferIfaceLocalListEntryInit(pEntry, pDirEntry->szName, &pDirEntry->Info); 642 660 643 661 RTDirReadExAFree(&pDirEntry, &cbDirEntry); … … 661 679 rc = RTFileQueryInfo(pInfo->u.Local.hFile, &objInfo, RTFSOBJATTRADD_NOTHING); 662 680 if (RT_SUCCESS(rc)) 663 { 664 pEntry->pvInfo = (PSHCLFSOBJINFO)RTMemAlloc(sizeof(SHCLFSOBJINFO)); 665 if (pEntry->pvInfo) 666 { 667 rc = RTStrCopy(pEntry->pszName, pEntry->cbName, pInfo->pszPathLocalAbs); 668 if (RT_SUCCESS(rc)) 669 { 670 ShClFsObjInfoFromIPRT(PSHCLFSOBJINFO(pEntry->pvInfo), &objInfo); 671 672 pEntry->cbInfo = sizeof(SHCLFSOBJINFO); 673 pEntry->fInfo = VBOX_SHCL_INFO_F_FSOBJINFO; 674 } 675 } 676 else 677 rc = VERR_NO_MEMORY; 678 } 681 rc = shclTransferIfaceLocalListEntryInit(pEntry, pInfo->pszPathLocalAbs, &objInfo); 679 682 680 683 break;
Note:
See TracChangeset
for help on using the changeset viewer.