- Timestamp:
- Oct 2, 2013 1:50:27 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r48770 r48818 594 594 &dataCb.u.read.cbData); 595 595 uint32_t cbRead = dataCb.u.read.cbData; 596 if (cbRead) 597 { 598 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 599 600 mData.mOffCurrent += cbRead; 601 602 alock.release(); 603 604 com::SafeArray<BYTE> data((size_t)cbRead); 605 data.initFrom((BYTE*)dataCb.u.read.pvData, cbRead); 606 607 fireGuestFileReadEvent(mEventSource, mSession, this, mData.mOffCurrent, 608 cbRead, ComSafeArrayAsInParam(data)); 609 } 596 597 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 598 599 mData.mOffCurrent += cbRead; 600 601 alock.release(); 602 603 com::SafeArray<BYTE> data((size_t)cbRead); 604 data.initFrom((BYTE*)dataCb.u.read.pvData, cbRead); 605 606 fireGuestFileReadEvent(mEventSource, mSession, this, mData.mOffCurrent, 607 cbRead, ComSafeArrayAsInParam(data)); 610 608 } 611 609 else … … 627 625 alock.release(); 628 626 629 if (dataCb.u.write.cbWritten) 630 fireGuestFileWriteEvent(mEventSource, mSession, this, uOffCurrent, 631 dataCb.u.write.cbWritten); 627 fireGuestFileWriteEvent(mEventSource, mSession, this, uOffCurrent, 628 dataCb.u.write.cbWritten); 632 629 } 633 630 else … … 645 642 646 643 mData.mOffCurrent = dataCb.u.seek.uOffActual; 647 uint64_t uOffCurrent = mData.mOffCurrent;648 644 649 645 alock.release(); 650 646 651 if (dataCb.u.seek.uOffActual) 652 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, 653 uOffCurrent, 0 /* Processed */); 647 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, 648 dataCb.u.seek.uOffActual, 0 /* Processed */); 654 649 } 655 650 else … … 666 661 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 667 662 668 if (mData.mOffCurrent != dataCb.u.tell.uOffActual) 669 { 670 mData.mOffCurrent = dataCb.u.tell.uOffActual; 671 uint64_t uOffCurrent = mData.mOffCurrent; 672 673 alock.release(); 674 675 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, 676 uOffCurrent, 0 /* Processed */); 677 } 663 mData.mOffCurrent = dataCb.u.tell.uOffActual; 664 665 alock.release(); 666 667 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, 668 dataCb.u.tell.uOffActual, 0 /* Processed */); 678 669 } 679 670 else … … 864 855 } 865 856 866 int GuestFile::seekAt( uint64_t uOffset, GUEST_FILE_SEEKTYPE eSeekType,857 int GuestFile::seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType, 867 858 uint32_t uTimeoutMS, uint64_t *puOffset) 868 859 { 869 LogFlowThisFunc((" uOffset=%RU64, uTimeoutMS=%RU32\n",870 uOffset, uTimeoutMS));860 LogFlowThisFunc(("iOffset=%RI64, uTimeoutMS=%RU32\n", 861 iOffset, uTimeoutMS)); 871 862 int vrc; 872 863 … … 894 885 paParms[i++].setUInt32(mData.mID /* File handle */); 895 886 paParms[i++].setUInt32(eSeekType /* Seek method */); 896 paParms[i++].setUInt64(uOffset /* Offset (in bytes) to start reading */); 887 /** @todo uint64_t vs. int64_t! */ 888 paParms[i++].setUInt64((uint64_t)iOffset /* Offset (in bytes) to start reading */); 897 889 898 890 vrc = sendCommand(HOST_FILE_SEEK, i, paParms); … … 1374 1366 default: 1375 1367 return setError(E_INVALIDARG, tr("Invalid seek type specified")); 1376 break; 1368 break; /* Never reached. */ 1377 1369 } 1378 1370 … … 1385 1377 default: 1386 1378 hr = setError(VBOX_E_IPRT_ERROR, 1387 tr("Seeking file \"%s\" (to offset %R U64) failed: %Rrc"),1379 tr("Seeking file \"%s\" (to offset %RI64) failed: %Rrc"), 1388 1380 mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1389 1381 break;
Note:
See TracChangeset
for help on using the changeset viewer.