Changeset 52934 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Oct 2, 2014 1:53:30 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96372
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r52926 r52934 6336 6336 void Console::i_onMousePointerShapeChange(bool fVisible, bool fAlpha, 6337 6337 uint32_t xHot, uint32_t yHot, 6338 uint32_t width, uint32_t height, 6339 ComSafeArrayIn(BYTE,pShape)) 6338 uint32_t width, uint32_t height, 6339 const uint8_t *pu8Shape, 6340 uint32_t cbShape) 6340 6341 { 6341 6342 #if 0 … … 6348 6349 AssertComRCReturnVoid(autoCaller.rc()); 6349 6350 6350 com::SafeArray<BYTE> aShape(ComSafeArrayInArg(pShape));6351 6351 if (!mMouse.isNull()) 6352 6352 mMouse->updateMousePointerShape(fVisible, fAlpha, xHot, yHot, width, height, 6353 aShape.raw(), aShape.size()); 6354 6355 fireMousePointerShapeChangedEvent(mEventSource, fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayInArg(pShape)); 6353 pu8Shape, cbShape); 6354 6355 com::SafeArray<BYTE> shape(cbShape); 6356 if (pu8Shape) 6357 memcpy(shape.raw(), pu8Shape, cbShape); 6358 fireMousePointerShapeChangedEvent(mEventSource, fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayAsInParam(shape)); 6356 6359 6357 6360 #if 0 -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r52769 r52934 3798 3798 Display *pThis = pDrv->pDisplay; 3799 3799 3800 size_t cbShapeSize = 0; 3801 3800 uint32_t cbShape = 0; 3802 3801 if (pvShape) 3803 3802 { 3804 cbShapeSize = (cx + 7) / 8 * cy; /* size of the AND mask */ 3805 cbShapeSize = ((cbShapeSize + 3) & ~3) + cx * 4 * cy; /* + gap + size of the XOR mask */ 3806 } 3807 com::SafeArray<BYTE> shapeData(cbShapeSize); 3808 3809 if (pvShape) 3810 ::memcpy(shapeData.raw(), pvShape, cbShapeSize); 3803 cbShape = (cx + 7) / 8 * cy; /* size of the AND mask */ 3804 cbShape = ((cbShape + 3) & ~3) + cx * 4 * cy; /* + gap + size of the XOR mask */ 3805 } 3811 3806 3812 3807 /* Tell the console about it */ 3813 3808 pDrv->pDisplay->mParent->i_onMousePointerShapeChange(fVisible, fAlpha, 3814 xHot, yHot, cx, cy, ComSafeArrayAsInParam(shapeData));3809 xHot, yHot, cx, cy, (uint8_t *)pvShape, cbShape); 3815 3810 3816 3811 return VINF_SUCCESS; -
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r50727 r52934 1273 1273 return setError(E_INVALIDARG, tr("The size to read is zero")); 1274 1274 1275 com::SafeArray<BYTE> data((size_t)aToRead); 1276 Assert(data.size() >= aToRead); 1275 aData.resize(aToRead); 1277 1276 1278 1277 HRESULT hr = S_OK; … … 1280 1279 uint32_t cbRead; 1281 1280 int vrc = i_readData(aToRead, aTimeoutMS, 1282 data.raw(), aToRead, &cbRead); 1283 1284 if (RT_SUCCESS(vrc)) 1285 { 1286 if (data.size() != cbRead) 1287 data.resize(cbRead); 1288 aData.resize(data.size()); 1289 for(size_t i = 0; i < data.size(); ++i) 1290 aData[i] = data[i]; 1281 &aData.front(), aToRead, &cbRead); 1282 1283 if (RT_SUCCESS(vrc)) 1284 { 1285 if (aData.size() != cbRead) 1286 aData.resize(cbRead); 1291 1287 } 1292 1288 else 1293 1289 { 1290 aData.resize(0); 1291 1294 1292 switch (vrc) 1295 1293 { … … 1315 1313 return setError(E_INVALIDARG, tr("The size to read is zero")); 1316 1314 1317 com::SafeArray<BYTE> data((size_t)aToRead); 1318 Assert(data.size() >= aToRead); 1315 aData.resize(aToRead); 1319 1316 1320 1317 HRESULT hr = S_OK; … … 1322 1319 size_t cbRead; 1323 1320 int vrc = i_readDataAt(aOffset, aToRead, aTimeoutMS, 1324 data.raw(), aToRead, &cbRead); 1325 if (RT_SUCCESS(vrc)) 1326 { 1327 if (data.size() != cbRead) 1328 data.resize(cbRead); 1329 aData.resize(data.size()); 1330 for(size_t i = 0; i < data.size(); ++i) 1331 aData[i] = data[i]; 1321 &aData.front(), aToRead, &cbRead); 1322 if (RT_SUCCESS(vrc)) 1323 { 1324 if (aData.size() != cbRead) 1325 aData.resize(cbRead); 1332 1326 } 1333 1327 else 1334 1328 { 1329 aData.resize(0); 1330 1335 1331 switch (vrc) 1336 1332 { … … 1410 1406 HRESULT hr = S_OK; 1411 1407 1412 com::SafeArray<BYTE> data(aData); 1413 int vrc = i_writeData(aTimeoutMS, data.raw(), (uint32_t)data.size(), 1408 uint32_t cbData = (uint32_t)aData.size(); 1409 void *pvData = cbData > 0? (void *)&aData.front(): NULL; 1410 int vrc = i_writeData(aTimeoutMS, pvData, cbData, 1414 1411 (uint32_t*)aWritten); 1415 1412 if (RT_FAILURE(vrc)) … … 1420 1417 hr = setError(VBOX_E_IPRT_ERROR, 1421 1418 tr("Writing %zubytes to file \"%s\" failed: %Rrc"), 1422 data.size(), mData.mOpenInfo.mFileName.c_str(), vrc);1419 aData.size(), mData.mOpenInfo.mFileName.c_str(), vrc); 1423 1420 break; 1424 1421 } … … 1440 1437 HRESULT hr = S_OK; 1441 1438 1442 com::SafeArray<BYTE> data(aData); 1443 int vrc = i_writeData(aTimeoutMS, data.raw(), (uint32_t)data.size(), 1439 uint32_t cbData = (uint32_t)aData.size(); 1440 void *pvData = cbData > 0? (void *)&aData.front(): NULL; 1441 int vrc = i_writeData(aTimeoutMS, pvData, cbData, 1444 1442 (uint32_t*)aWritten); 1445 1443 if (RT_FAILURE(vrc)) … … 1450 1448 hr = setError(VBOX_E_IPRT_ERROR, 1451 1449 tr("Writing %zubytes to file \"%s\" (at offset %RU64) failed: %Rrc"), 1452 data.size(), mData.mOpenInfo.mFileName.c_str(), aOffset, vrc);1450 aData.size(), mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1453 1451 break; 1454 1452 } -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r50899 r52934 292 292 293 293 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 294 295 com::SafeArray<BSTR> collection(mData.mProcess.mArguments.size()); 296 size_t s = 0; 297 for (ProcessArguments::const_iterator it = mData.mProcess.mArguments.begin(); 298 it != mData.mProcess.mArguments.end(); 299 it++, s++) 300 aArguments[s] = (*it); 301 294 aArguments = mData.mProcess.mArguments; 302 295 return S_OK; 303 296 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 312 305 313 306 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 314 315 com::SafeArray<BSTR> arguments(mData.mProcess.mEnvironment.Size()); 316 for (size_t i = 0; i < arguments.size(); i++) 317 aEnvironment[i] = mData.mProcess.mEnvironment.Get(i); 318 307 mData.mProcess.mEnvironment.CopyTo(aEnvironment); 319 308 return S_OK; 320 309 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 1751 1740 return setError(E_INVALIDARG, tr("The size to read is zero")); 1752 1741 1753 com::SafeArray<BYTE> data((size_t)aToRead); 1754 Assert(data.size() >= aToRead); 1742 aData.resize(aToRead); 1755 1743 1756 1744 HRESULT hr = S_OK; 1757 1745 1758 1746 uint32_t cbRead; int guestRc; 1759 int vrc = i_readData(aHandle, aToRead, aTimeoutMS, data.raw(), aToRead, &cbRead, &guestRc);1747 int vrc = i_readData(aHandle, aToRead, aTimeoutMS, &aData.front(), aToRead, &cbRead, &guestRc); 1760 1748 if (RT_SUCCESS(vrc)) 1761 1749 { 1762 if (data.size() != cbRead) 1763 data.resize(cbRead); 1764 for(size_t i = 0; i < data.size(); ++i) 1765 aData[i] = data[i]; 1750 if (aData.size() != cbRead) 1751 aData.resize(cbRead); 1766 1752 } 1767 1753 else 1768 1754 { 1755 aData.resize(0); 1756 1769 1757 switch (vrc) 1770 1758 { … … 1903 1891 1904 1892 HRESULT hr = S_OK; 1905 com::SafeArray<BYTE> data; 1906 for(size_t i = 0; i < aData.size(); ++i) 1907 data[i] = aData[i]; 1893 1908 1894 uint32_t cbWritten; int guestRc; 1909 int vrc = i_writeData(aHandle, aFlags, data.raw(), data.size(), aTimeoutMS, &cbWritten, &guestRc); 1895 uint32_t cbData = (uint32_t)aData.size(); 1896 void *pvData = cbData > 0? (void *)&aData.front(): NULL; 1897 int vrc = i_writeData(aHandle, aFlags, pvData, cbData, aTimeoutMS, &cbWritten, &guestRc); 1910 1898 if (RT_FAILURE(vrc)) 1911 1899 { -
trunk/src/VBox/Main/src-client/KeyboardImpl.cpp
r52924 r52934 175 175 ULONG *aCodesStored) 176 176 { 177 com::SafeArray<LONG> keys;178 keys.resize(aScancodes.size());179 for (size_t i = 0; i < aScancodes.size(); ++i)180 keys[i] = aScancodes[i];181 182 177 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 183 178 … … 213 208 if (aCodesStored) 214 209 *aCodesStored = sent; 210 211 com::SafeArray<LONG> keys(aScancodes.size()); 212 for (size_t i = 0; i < aScancodes.size(); ++i) 213 keys[i] = aScancodes[i]; 215 214 216 215 VBoxEventDesc evDesc; -
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r52921 r52934 861 861 ULONG aScanTime) 862 862 { 863 com::SafeArray <LONG64> arrayContacts(aContacts);864 865 863 LogRel3(("%s: aCount %d(actual %d), aScanTime %u\n", 866 __FUNCTION__, aCount, a rrayContacts.size(), aScanTime));864 __FUNCTION__, aCount, aContacts.size(), aScanTime)); 867 865 868 866 HRESULT rc = S_OK; 869 867 870 if ((LONG)a rrayContacts.size() >= aCount)871 { 872 LONG64* paContacts = arrayContacts.raw();868 if ((LONG)aContacts.size() >= aCount) 869 { 870 const LONG64 *paContacts = aCount > 0? &aContacts.front(): NULL; 873 871 874 872 rc = i_putEventMultiTouch(aCount, paContacts, aScanTime); … … 907 905 /* Used by PutEventMultiTouch and PutEventMultiTouchString. */ 908 906 HRESULT Mouse::i_putEventMultiTouch(LONG aCount, 909 LONG64 *paContacts,907 const LONG64 *paContacts, 910 908 ULONG aScanTime) 911 909 { -
trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
r52652 r52934 346 346 347 347 /* tell the console about it */ 348 size_t cbShapeSize = 0; 349 348 uint32_t cbShape = 0; 350 349 if (pShape) 351 350 { 352 cbShapeSize = (width + 7) / 8 * height; /* size of the AND mask */ 353 cbShapeSize = ((cbShapeSize + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */ 354 } 355 com::SafeArray<BYTE> shapeData(cbShapeSize); 356 if (pShape) 357 ::memcpy(shapeData.raw(), pShape, cbShapeSize); 358 pConsole->i_onMousePointerShapeChange(fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayAsInParam(shapeData)); 351 cbShape = (width + 7) / 8 * height; /* size of the AND mask */ 352 cbShape = ((cbShape + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */ 353 } 354 pConsole->i_onMousePointerShapeChange(fVisible, fAlpha, xHot, yHot, width, height, (uint8_t *)pShape, cbShape); 359 355 } 360 356
Note:
See TracChangeset
for help on using the changeset viewer.