VirtualBox

Changeset 55524 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 29, 2015 2:45:20 PM (10 years ago)
Author:
vboxsync
Message:

DnD: Another bugfix for protocol v1.

File:
1 edited

Legend:

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

    r55520 r55524  
    3030#include <iprt/file.h>
    3131#include <iprt/path.h>
     32#include <iprt/uri.h>
    3233
    3334#include <iprt/cpp/utils.h> /* For unconst(). */
     
    463464                        pCtx->mData.cbProcessed = 0;
    464465
    465                         /* Assign new total size which also includes all paths + file
    466                          * data to receive from the guest. */
     466                        /*
     467                         * Assign new total size which also includes all file data to receive
     468                         * from the guest.
     469                         */
    467470                        pCtx->mData.cbToProcess = cbTotalSize;
     471
     472                        LogFlowFunc(("URI data => cbToProcess=%RU64\n", pCtx->mData.cbToProcess));
    468473                    }
    469474                }
    470475            }
    471 
    472             if (RT_SUCCESS(rc))
    473                 rc = i_updateProcess(pCtx, cbData);
    474476        }
    475477    }
     
    489491    AssertReturn(cbPath,     VERR_INVALID_PARAMETER);
    490492
    491     LogFlowFunc(("pszPath=%s, cbPath=%zu, fMode=0x%x\n", pszPath, cbPath, fMode));
     493    LogFlowFunc(("pszPath=%s, cbPath=%RU32, fMode=0x%x\n", pszPath, cbPath, fMode));
    492494
    493495    int rc;
     
    505507
    506508    if (RT_SUCCESS(rc))
    507         rc = i_updateProcess(pCtx, cbPath);
     509    {
     510        if (mDataBase.mProtocolVersion <= 2)
     511        {
     512            /*
     513             * BUG: Protocol v1 does *not* send directory names in URI format,
     514             *      however, if this in a root URI directory (which came with the initial
     515             *      GUEST_DND_GH_SND_DATA message(s)) the total data announced was for
     516             *      root directory names which came in URI format, as an URI list.
     517             *
     518             *      So construct an URI path locally to keep the accounting right.
     519             */
     520            char *pszPathURI = RTUriCreate("file" /* pszScheme */, "/" /* pszAuthority */,
     521                                           pszPath /* pszPath */,
     522                                           NULL /* pszQuery */, NULL /* pszFragment */);
     523            if (pszPathURI)
     524            {
     525                cbPath  = strlen(pszPathURI);
     526                cbPath += 3;                  /* Include "\r" + "\n" + termination -- see above. */
     527
     528                LogFlowFunc(("URI pszPathURI=%s, cbPathURI=%RU32\n", pszPathURI, cbPath));
     529                RTStrFree(pszPathURI);
     530            }
     531            else
     532                rc = VERR_NO_MEMORY;
     533        }
     534
     535        if (RT_SUCCESS(rc))
     536            rc = i_updateProcess(pCtx, cbPath);
     537    }
    508538
    509539    LogFlowFuncLeaveRC(rc);
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