Changeset 56215 in vbox
- Timestamp:
- Jun 3, 2015 11:02:03 AM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestDnDSourceImpl.h
r55963 r56215 93 93 int i_receiveRawData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout); 94 94 int i_receiveURIData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout); 95 int i_updateProcess(PRECVDATACTX pCtx, uint 32_t cbDataAdd);95 int i_updateProcess(PRECVDATACTX pCtx, uint64_t cbDataAdd); 96 96 97 97 protected: -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r55965 r56215 526 526 if (RT_SUCCESS(rc)) 527 527 { 528 /* Reset processed bytes. */ 528 529 pCtx->mData.cbProcessed = 0; 529 530 … … 534 535 pCtx->mData.cbToProcess = cbTotalSize; 535 536 536 LogFlowFunc(("URI data => cbToProcess=%RU64\n", pCtx->mData.cbToProcess)); 537 /* Update our process with the data we already received. 538 * Note: The total size will consist of the meta data (in vecData) and 539 * the actual accumulated file/directory data from the guest. */ 540 rc = i_updateProcess(pCtx, (uint64_t)pCtx->mData.vecData.size()); 541 542 LogFlowFunc(("URI data => cbProcessed=%RU64, cbToProcess=%RU64, rc=%Rrc\n", 543 pCtx->mData.cbProcessed, pCtx->mData.cbToProcess, rc)); 537 544 } 538 545 } … … 563 570 rc = RTDirCreateFullPath(pszDir, fMode); 564 571 if (RT_FAILURE(rc)) 565 LogRel2(("DnD: Error creating guest directory \"%s\"on the host, rc=%Rrc\n", pszDir, rc));572 LogRel2(("DnD: Error creating guest directory '%s' on the host, rc=%Rrc\n", pszDir, rc)); 566 573 567 574 RTStrFree(pszDir); … … 569 576 else 570 577 rc = VERR_NO_MEMORY; 571 572 if (RT_SUCCESS(rc))573 {574 if (mDataBase.mProtocolVersion <= 2)575 {576 /*577 * Protocols v1/v2 do *not* send root element names (files/directories)578 * in URI format. The initial GUEST_DND_GH_SND_DATA message(s) however579 * did take those element names into account, but *with* URI decoration580 * when it comes to communicating the total bytes being sent.581 *582 * So translate the path into a valid URI path and add the resulting583 * length (+ "\r\n" and termination) to the total bytes received584 * to keep the accounting right.585 */586 char *pszPathURI = RTUriCreate("file" /* pszScheme */, "/" /* pszAuthority */,587 pszPath /* pszPath */,588 NULL /* pszQuery */, NULL /* pszFragment */);589 if (pszPathURI)590 {591 bool fHasPath = RTPathHasPath(pszPath); /* Use original data received. */592 if (!fHasPath) /* Root path? */593 {594 cbPath = strlen(pszPathURI);595 cbPath += 3; /* Include "\r" + "\n" + termination -- see above. */596 597 rc = i_updateProcess(pCtx, cbPath);598 }599 600 LogFlowFunc(("URI pszPathURI=%s, fHasPath=%RTbool, cbPath=%RU32\n", pszPathURI, fHasPath, cbPath));601 RTStrFree(pszPathURI);602 }603 else604 rc = VERR_NO_MEMORY;605 }606 }607 578 608 579 LogFlowFuncLeaveRC(rc); … … 625 596 do 626 597 { 627 if (!pCtx->mURI.objURI.IsComplete()) 628 { 629 LogFlowFunc(("Warning: Object \"%s\" not complete yet\n", pCtx->mURI.objURI.GetDestPath().c_str())); 598 if ( pCtx->mURI.objURI.IsOpen() 599 && !pCtx->mURI.objURI.IsComplete()) 600 { 601 LogFlowFunc(("Warning: Object '%s' not complete yet\n", pCtx->mURI.objURI.GetDestPath().c_str())); 630 602 rc = VERR_INVALID_PARAMETER; 631 603 break; … … 634 606 if (pCtx->mURI.objURI.IsOpen()) /* File already opened? */ 635 607 { 636 LogFlowFunc(("Warning: Current opened object is \"%s\"\n", pCtx->mURI.objURI.GetDestPath().c_str()));608 LogFlowFunc(("Warning: Current opened object is '%s'\n", pCtx->mURI.objURI.GetDestPath().c_str())); 637 609 rc = VERR_WRONG_ORDER; 638 610 break; … … 682 654 } 683 655 684 if (mDataBase.mProtocolVersion <= 2)685 {686 /*687 * Protocols v1/v2 do *not* send root element names (files/directories)688 * in URI format. The initial GUEST_DND_GH_SND_DATA message(s) however689 * did take those element names into account, but *with* URI decoration690 * when it comes to communicating the total bytes being sent.691 *692 * So translate the path into a valid URI path and add the resulting693 * length (+ "\r\n" and termination) to the total bytes received694 * to keep the accounting right.695 */696 char *pszPathURI = RTUriCreate("file" /* pszScheme */, "/" /* pszAuthority */,697 pszPath /* pszPath */,698 NULL /* pszQuery */, NULL /* pszFragment */);699 if (pszPathURI)700 {701 bool fHasPath = RTPathHasPath(pszPath); /* Use original data received. */702 if (!fHasPath) /* Root path? */703 {704 cbPath = strlen(pszPathURI);705 cbPath += 3; /* Include "\r" + "\n" + termination -- see above. */706 707 rc = i_updateProcess(pCtx, cbPath);708 }709 710 LogFlowFunc(("URI pszPathURI=%s, fHasPath=%RTbool, cbPath=%RU32\n", pszPathURI, fHasPath, cbPath));711 RTStrFree(pszPathURI);712 }713 else714 {715 rc = VERR_NO_MEMORY;716 break;717 }718 }719 720 656 } while (0); 721 657 … … 736 672 if (pCtx->mURI.objURI.IsComplete()) 737 673 { 738 LogFlowFunc(("Warning: Object \"%s\"already completed\n", pCtx->mURI.objURI.GetDestPath().c_str()));674 LogFlowFunc(("Warning: Object '%s' already completed\n", pCtx->mURI.objURI.GetDestPath().c_str())); 739 675 rc = VERR_WRONG_ORDER; 740 676 break; … … 743 679 if (!pCtx->mURI.objURI.IsOpen()) /* File opened on host? */ 744 680 { 745 LogFlowFunc(("Warning: Object \"%s\"not opened\n", pCtx->mURI.objURI.GetDestPath().c_str()));681 LogFlowFunc(("Warning: Object '%s' not opened\n", pCtx->mURI.objURI.GetDestPath().c_str())); 746 682 rc = VERR_WRONG_ORDER; 747 683 break; … … 776 712 } 777 713 else 778 LogRel(("DnD: Error writing guest file to host to \"%s\": %Rrc\n", pCtx->mURI.objURI.GetDestPath().c_str(), rc)); 714 { 715 /** @todo What to do when the host's disk is full? */ 716 LogRel(("DnD: Error writing guest file to host to '%s': %Rrc\n", pCtx->mURI.objURI.GetDestPath().c_str(), rc)); 717 } 779 718 780 719 } while (0); … … 1261 1200 } 1262 1201 1263 int GuestDnDSource::i_updateProcess(PRECVDATACTX pCtx, uint 32_t cbDataAdd)1202 int GuestDnDSource::i_updateProcess(PRECVDATACTX pCtx, uint64_t cbDataAdd) 1264 1203 { 1265 1204 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1205 1206 LogFlowFunc(("cbProcessed=%RU64 (+ %RU64 = %RU64), cbToProcess=%RU64\n", 1207 pCtx->mData.cbProcessed, cbDataAdd, pCtx->mData.cbProcessed + cbDataAdd, pCtx->mData.cbToProcess)); 1266 1208 1267 1209 pCtx->mData.cbProcessed += cbDataAdd;
Note:
See TracChangeset
for help on using the changeset viewer.