Changeset 84864 in vbox
- Timestamp:
- Jun 17, 2020 2:10:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r84650 r84864 381 381 } 382 382 383 BYTE byBuf[_64K]; 383 BYTE byBuf[_64K]; /** @todo Can we do better here? */ 384 384 while (cbToRead) 385 385 { … … 404 404 } 405 405 406 Assert (cbToRead >= cbRead);406 AssertBreak(cbToRead >= cbRead); 407 407 cbToRead -= cbRead; 408 408 409 409 /* Update total bytes written to the guest. */ 410 410 cbWrittenTotal += cbRead; 411 Assert (cbWrittenTotal <= cbSize);411 AssertBreak(cbWrittenTotal <= cbSize); 412 412 413 413 /* Did the user cancel the operation above? */ … … 465 465 int GuestSessionTask::fileCopyFromGuest(const Utf8Str &strSrc, const Utf8Str &strDst, FileCopyFlag_T fFileCopyFlags) 466 466 { 467 LogFlowThisFunc(("strSource=%s, strDest=%s, enmFileCopyFlags= 0x%x\n", strSrc.c_str(), strDst.c_str(), fFileCopyFlags));467 LogFlowThisFunc(("strSource=%s, strDest=%s, enmFileCopyFlags=%#x\n", strSrc.c_str(), strDst.c_str(), fFileCopyFlags)); 468 468 469 469 GuestFileOpenInfo srcOpenInfo; … … 506 506 default: 507 507 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 508 Utf8StrFmt(GuestSession::tr("Guest object \"%s\" is not a file"), strSrc.c_str())); 508 Utf8StrFmt(GuestSession::tr("Guest object \"%s\" is not a file (is type %#x)"), 509 strSrc.c_str(), srcObjData.mType)); 509 510 rc = VERR_NOT_A_FILE; 510 511 break; … … 529 530 return rc; 530 531 531 char *pszDstFile = NULL;532 532 RTFSOBJINFO dstObjInfo; 533 533 RT_ZERO(dstObjInfo); … … 553 553 if (RTTimeSpecCompare(&srcModificationTimeTS, &dstObjInfo.ModificationTime) <= 0) 554 554 { 555 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 556 Utf8StrFmt(GuestSession::tr("Host file \"%s\" has same or newer modification date"), 557 strDst.c_str())); 555 LogRel2(("Guest Control: Host file \"%s\" has same or newer modification date, skipping", strDst.c_str())); 558 556 fSkip = true; 559 557 } … … 576 574 } 577 575 576 char *pszDstFile = NULL; 577 578 578 if (RT_SUCCESS(rc)) 579 579 { … … 593 593 /* Build the final file name with destination path (on the host). */ 594 594 char szDstPath[RTPATH_MAX]; 595 RTStrPrintf2(szDstPath, sizeof(szDstPath), "%s", strDst.c_str()); 596 597 if ( !strDst.endsWith("\\") 598 && !strDst.endsWith("/")) 599 RTPathAppend(szDstPath, sizeof(szDstPath), "/"); /* IPRT can handle / on all hosts. */ 600 601 RTPathAppend(szDstPath, sizeof(szDstPath), RTPathFilenameEx(strSrc.c_str(), mfPathStyle)); 602 603 pszDstFile = RTStrDup(szDstPath); 595 rc = RTStrCopy(szDstPath, sizeof(szDstPath), strDst.c_str()); 596 if (RT_SUCCESS(rc)) 597 { 598 rc = RTPathAppend(szDstPath, sizeof(szDstPath), RTPathFilenameEx(strSrc.c_str(), mfPathStyle)); 599 if (RT_SUCCESS(rc)) 600 pszDstFile = RTStrDup(szDstPath); 601 } 604 602 } 605 603 else if (RTFS_IS_SYMLINK(dstObjInfo.Attr.fMode)) … … 629 627 if (!pszDstFile) 630 628 { 631 setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(GuestSession::tr("No memory to allocate destinationfile path")));629 setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(GuestSession::tr("No memory to allocate host file path"))); 632 630 rc = VERR_NO_MEMORY; 633 631 } … … 1408 1406 if (mDest.isEmpty()) 1409 1407 { 1410 strErrorInfo = Utf8StrFmt(GuestSession::tr(" Destination must not be empty"));1408 strErrorInfo = Utf8StrFmt(GuestSession::tr("Host destination must not be empty")); 1411 1409 vrc = VERR_INVALID_PARAMETER; 1412 1410 } … … 1423 1421 if (strSrc.isEmpty()) 1424 1422 { 1425 strErrorInfo = Utf8StrFmt(GuestSession::tr(" Source entry must not be empty"));1423 strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest source entry must not be empty")); 1426 1424 vrc = VERR_INVALID_PARAMETER; 1427 1425 break; … … 1456 1454 if (RT_FAILURE(vrc)) 1457 1455 { 1458 strErrorInfo = Utf8StrFmt(GuestSession::tr("No such source file/directory: %s"), strSrc.c_str()); 1456 if (vrc == VERR_GSTCTL_GUEST_ERROR) 1457 strErrorInfo = GuestBase::getErrorAsString(GuestSession::tr("Guest file lookup failed"), 1458 GuestErrorInfo(GuestErrorInfo::Type_ToolStat, rcGuest, strSrc.c_str())); 1459 else 1460 strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest file lookup for \"%s\" failed: %Rrc"), 1461 strSrc.c_str(), vrc); 1459 1462 break; 1460 1463 } … … 1464 1467 if (itSrc->enmType != FsObjType_Directory) 1465 1468 { 1466 strErrorInfo = Utf8StrFmt(GuestSession::tr(" Source is not a file: %s"), strSrc.c_str());1469 strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest source is not a file: %s"), strSrc.c_str()); 1467 1470 vrc = VERR_NOT_A_FILE; 1468 1471 break; … … 1473 1476 if (itSrc->enmType != FsObjType_File) 1474 1477 { 1475 strErrorInfo = Utf8StrFmt(GuestSession::tr(" Source is not a directory: %s"), strSrc.c_str());1478 strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest source is not a directory: %s"), strSrc.c_str()); 1476 1479 vrc = VERR_NOT_A_DIRECTORY; 1477 1480 break; … … 1495 1498 { 1496 1499 delete pFsList; 1497 strErrorInfo = Utf8StrFmt(GuestSession::tr("Error adding source '%s' to list: %Rrc"), strSrc.c_str(), vrc); 1500 strErrorInfo = Utf8StrFmt(GuestSession::tr("Error adding guest source '%s' to list: %Rrc"), 1501 strSrc.c_str(), vrc); 1498 1502 break; 1499 1503 }
Note:
See TracChangeset
for help on using the changeset viewer.