VirtualBox

Ignore:
Timestamp:
Jun 29, 2020 4:34:22 PM (4 years ago)
Author:
vboxsync
Message:

DnD: Greatly simplified usage / API of the DnDURIObject class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp

    r82968 r84998  
    882882    AssertPtr(pObj);
    883883
    884     RTCString strPath = pObj->GetDestPathAbs();
     884    RTCString strPath = pObj->GetPath();
    885885    if (strPath.isEmpty())
    886886        return VERR_INVALID_PARAMETER;
     
    909909    AssertPtr(pObj);
    910910
    911     RTCString strPathSrc = pObj->GetSourcePathAbs();
     911    RTCString strPathSrc = pObj->GetPath();
    912912    if (strPathSrc.isEmpty())
    913913        return VERR_INVALID_PARAMETER;
     
    922922    {
    923923        LogRel2(("DnD: Opening host file '%s' for transferring to guest\n", strPathSrc.c_str()));
    924         rc = pObj->OpenEx(strPathSrc, DnDURIObject::View_Source,
    925                           RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
     924        rc = pObj->Init(DnDURIObject::Type_File, strPathSrc);
     925        if (RT_SUCCESS(rc))
     926            rc = pObj->Open(RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
     927
    926928        if (RT_FAILURE(rc))
    927929            LogRel(("DnD: Opening host file '%s' failed, rc=%Rrc\n", strPathSrc.c_str(), rc));
     
    943945                pMsg->setType(HOST_DND_HG_SND_FILE_HDR);
    944946                pMsg->setNextUInt32(0); /** @todo ContextID not used yet. */
    945                 pMsg->setNextString(pObj->GetDestPathAbs().c_str());                  /* pvName */
    946                 pMsg->setNextUInt32((uint32_t)(pObj->GetDestPathAbs().length() + 1)); /* cbName */
    947                 pMsg->setNextUInt32(0);                                            /* uFlags */
    948                 pMsg->setNextUInt32(pObj->GetMode());                              /* fMode */
    949                 pMsg->setNextUInt64(pObj->GetSize());                              /* uSize */
     947                pMsg->setNextString(pObj->GetPath().c_str());                  /* pvName */
     948                pMsg->setNextUInt32((uint32_t)(pObj->GetPath().length() + 1)); /* cbName */
     949                pMsg->setNextUInt32(0);                                        /* uFlags */
     950                pMsg->setNextUInt32(pObj->GetMode());                          /* fMode */
     951                pMsg->setNextUInt64(pObj->GetSize());                          /* uSize */
    950952
    951953                LogFlowFunc(("Sending file header ...\n"));
    952                 LogRel2(("DnD: Transferring host file to guest: %s (%RU64 bytes, mode 0x%x)\n",
    953                          strPathSrc.c_str(), pObj->GetSize(), pObj->GetMode()));
     954                LogRel2(("DnD: Transferring host file '%s' to guest (%RU64 bytes, mode 0x%x)\n",
     955                         pObj->GetPath().c_str(), pObj->GetSize(), pObj->GetMode()));
    954956
    955957                /** @todo Set progress object title to current file being transferred? */
     
    10071009    if (mDataBase.m_uProtocolVersion <= 1)
    10081010    {
    1009         pMsg->setNextString(pObj->GetDestPathAbs().c_str());                  /* pvName */
    1010         pMsg->setNextUInt32((uint32_t)(pObj->GetDestPathAbs().length() + 1)); /* cbName */
     1011        pMsg->setNextString(pObj->GetPath().c_str());                  /* pvName */
     1012        pMsg->setNextUInt32((uint32_t)(pObj->GetPath().length() + 1)); /* cbName */
    10111013    }
    10121014    else if (mDataBase.m_uProtocolVersion >= 2)
     
    10441046        if (pObj->IsComplete()) /* Done reading? */
    10451047        {
    1046             LogRel2(("DnD: Transferring file '%s' to guest complete\n", pObj->GetSourcePathAbs().c_str()));
    1047             LogFlowFunc(("File '%s' complete\n", pObj->GetSourcePathAbs().c_str()));
     1048            LogRel2(("DnD: Transferring file '%s' to guest complete\n", pObj->GetPath().c_str()));
     1049            LogFlowFunc(("File '%s' complete\n", pObj->GetPath().c_str()));
    10481050
    10491051            /* DnDURIObject::Read() returns VINF_EOF when finished reading the entire fire,
     
    10541056
    10551057    if (RT_FAILURE(rc))
    1056         LogRel(("DnD: Reading from host file '%s' failed, rc=%Rrc\n", pObj->GetSourcePathAbs().c_str(), rc));
     1058        LogRel(("DnD: Reading from host file '%s' failed, rc=%Rrc\n", pObj->GetPath().c_str(), rc));
    10571059
    10581060    LogFlowFuncLeaveRC(rc);
     
    14491451    AssertPtr(pCurObj);
    14501452
    1451     DnDURIObject::Type enmType = pCurObj->GetType();
     1453    const DnDURIObject::Type enmType = pCurObj->GetType();
     1454
    14521455    LogRel3(("DnD: Processing: srcPath=%s, dstPath=%s, enmType=%RU32, cbSize=%RU32\n",
    1453              pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str(),
     1456             pCurObj->GetPath().c_str(), pCurObj->GetPath().c_str(),
    14541457             enmType, pCurObj->GetSize()));
    14551458
     
    14651468    {
    14661469        AssertMsgFailed(("enmType=%RU32 is not supported for srcPath=%s, dstPath=%s\n",
    1467                          enmType, pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str()));
     1470                         enmType, pCurObj->GetPath().c_str(), pCurObj->GetPath().c_str()));
    14681471        rc = VERR_NOT_SUPPORTED;
    14691472    }
     
    14781481    if (fRemove)
    14791482    {
    1480         LogFlowFunc(("Removing \"%s\" from list, rc=%Rrc\n", pCurObj->GetSourcePathAbs().c_str(), rc));
     1483        LogFlowFunc(("Removing \"%s\" from list, rc=%Rrc\n", pCurObj->GetPath().c_str(), rc));
    14811484        pCtx->mURI.removeObjCurrent();
    14821485    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette