Changeset 78974 in vbox for trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp
- Timestamp:
- Jun 4, 2019 4:51:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp
r78897 r78974 46 46 47 47 48 VBoxClipboardWinStreamImpl::VBoxClipboardWinStreamImpl(SharedClipboardProvider *pProvider, SharedClipboardURIObject *pURIObj) 49 : m_lRefCount(1) 50 , m_pProvider(pProvider) 48 VBoxClipboardWinStreamImpl::VBoxClipboardWinStreamImpl(VBoxClipboardWinDataObject *pParent, 49 PSHAREDCLIPBOARDURITRANSFER pTransfer, SharedClipboardURIObject *pURIObj) 50 : m_pParent(pParent) 51 , m_lRefCount(1) 52 , m_pTransfer(pTransfer) 51 53 , m_pURIObj(pURIObj) 52 54 { 53 AssertPtr(m_pProvider); 55 AssertPtr(m_pTransfer); 56 AssertPtr(m_pTransfer->pProvider); 54 57 AssertPtr(m_pURIObj); 55 58 56 59 LogFunc(("szSrcPath=%s, cbSize=%RU64\n", m_pURIObj->GetSourcePathAbs().c_str(), m_pURIObj->GetSize())); 57 60 58 m_p Provider->AddRef();61 m_pTransfer->pProvider->AddRef(); 59 62 } 60 63 … … 62 65 { 63 66 LogFlowThisFuncEnter(); 64 m_pProvider->Release(); 67 68 if ( m_pTransfer 69 && m_pTransfer->pProvider) 70 m_pTransfer->pProvider->Release(); 65 71 } 66 72 … … 159 165 const uint64_t cbProcessed = m_pURIObj->GetProcessed(); 160 166 161 const size_t cbToRead = RT_MIN(cbSize - cbProcessed, nBytesToRead);162 size_t cbRead = 0;167 const uint32_t cbToRead = RT_MIN(cbSize - cbProcessed, nBytesToRead); 168 uint32_t cbRead = 0; 163 169 164 170 int rc = VINF_SUCCESS; 165 171 166 172 if (cbToRead) 167 rc = m_pProvider->ReadData(pvBuffer, cbToRead, &cbRead); 173 { 174 VBOXCLIPBOARDFILEDATA FileData; 175 RT_ZERO(FileData); 176 177 FileData.pvData = pvBuffer; 178 FileData.cbData = cbToRead; 179 180 rc = m_pTransfer->pProvider->ReadFileData(&FileData, &cbRead); 181 if (RT_SUCCESS(rc)) 182 { 183 if (m_pURIObj->IsComplete()) 184 m_pParent->OnTransferComplete(); 185 } 186 } 168 187 169 188 if (nBytesRead) … … 229 248 * 230 249 * @returns HRESULT 231 * @param pProvider Pointer to Shared Clipboard provider to use. 250 * @param pParent Pointer to the parent data object. 251 * @param pTransfer Pointer to URI transfer object to use. 232 252 * @param pURIObj Pointer to URI object to handle. 233 253 * @param ppStream Where to return the created stream object on success. 234 254 */ 235 255 /* static */ 236 HRESULT VBoxClipboardWinStreamImpl::Create(SharedClipboardProvider *pProvider, SharedClipboardURIObject *pURIObj, 256 HRESULT VBoxClipboardWinStreamImpl::Create(VBoxClipboardWinDataObject *pParent, 257 PSHAREDCLIPBOARDURITRANSFER pTransfer, SharedClipboardURIObject *pURIObj, 237 258 IStream **ppStream) 238 259 { 239 AssertPtrReturn(p Provider, E_POINTER);240 241 VBoxClipboardWinStreamImpl *pStream = new VBoxClipboardWinStreamImpl(pP rovider, pURIObj);260 AssertPtrReturn(pTransfer, E_POINTER); 261 262 VBoxClipboardWinStreamImpl *pStream = new VBoxClipboardWinStreamImpl(pParent, pTransfer, pURIObj); 242 263 if (pStream) 243 264 {
Note:
See TracChangeset
for help on using the changeset viewer.