Changeset 52934 in vbox
- Timestamp:
- Oct 2, 2014 1:53:30 PM (10 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r52926 r52934 235 235 uint32_t xHot, uint32_t yHot, 236 236 uint32_t width, uint32_t height, 237 ComSafeArrayIn(uint8_t, aShape)); 237 const uint8_t *pu8Shape, 238 uint32_t cbShape); 238 239 void i_onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, 239 240 BOOL supportsMT, BOOL needsHostCursor); -
trunk/src/VBox/Main/include/MouseImpl.h
r52921 r52934 108 108 HRESULT i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj, 109 109 bool *pfValid); 110 HRESULT i_putEventMultiTouch(LONG aCount, LONG64 *paContacts, ULONG aScanTime);110 HRESULT i_putEventMultiTouch(LONG aCount, const LONG64 *paContacts, ULONG aScanTime); 111 111 112 112 void i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT); -
trunk/src/VBox/Main/include/USBProxyService.h
r41528 r52934 58 58 /** @name Host Interfaces 59 59 * @{ */ 60 HRESULT getDeviceCollection( ComSafeArrayOut(IHostUSBDevice *, aUSBDevices));60 HRESULT getDeviceCollection(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices); 61 61 /** @} */ 62 62 -
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 -
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r52897 r52934 5 5 6 6 /* 7 * Copyright (C) 2013 Oracle Corporation7 * Copyright (C) 2013-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 67 67 68 68 inline static void detachVectorOfWString(const std::vector<std::wstring>& v, 69 ComSafeArrayOut(BSTR, aBstrArray)) 70 { 71 com::SafeArray<BSTR> aBstr(v.size()); 72 73 std::vector<std::wstring>::const_iterator it; 74 75 int i = 0; 76 it = v.begin(); 77 for (; it != v.end(); ++it, ++i) 78 Utf8Str(it->c_str()).cloneTo(&aBstr[i]); 79 80 aBstr.detachTo(ComSafeArrayOutArg(aBstrArray)); 69 std::vector<com::Utf8Str> &aArray) 70 { 71 aArray.resize(v.size()); 72 size_t i = 0; 73 for (std::vector<std::wstring>::const_iterator it = v.begin(); it != v.end(); ++it, ++i) 74 aArray[i] = Utf8Str(it->c_str()); 81 75 } 82 76 … … 265 259 } 266 260 267 HRESULT HostDnsMonitorProxy::GetNameServers( ComSafeArrayOut(BSTR, aNameServers))261 HRESULT HostDnsMonitorProxy::GetNameServers(std::vector<com::Utf8Str> &aNameServers) 268 262 { 269 263 AssertReturn(m && m->info, E_FAIL); … … 276 270 dumpHostDnsStrVector("Name Server", m->info->servers); 277 271 278 detachVectorOfWString(m->info->servers, ComSafeArrayOutArg(aNameServers));272 detachVectorOfWString(m->info->servers, aNameServers); 279 273 280 274 return S_OK; 281 275 } 282 276 283 HRESULT HostDnsMonitorProxy::GetDomainName( BSTR *aDomainName)277 HRESULT HostDnsMonitorProxy::GetDomainName(com::Utf8Str *pDomainName) 284 278 { 285 279 AssertReturn(m && m->info, E_FAIL); … … 291 285 LogRel(("HostDnsMonitorProxy::GetDomainName: %s\n", m->info->domain.c_str())); 292 286 293 Utf8Str(m->info->domain.c_str()).cloneTo(aDomainName);287 *pDomainName = m->info->domain.c_str(); 294 288 295 289 return S_OK; 296 290 } 297 291 298 HRESULT HostDnsMonitorProxy::GetSearchStrings( ComSafeArrayOut(BSTR, aSearchStrings))292 HRESULT HostDnsMonitorProxy::GetSearchStrings(std::vector<com::Utf8Str> &aSearchStrings) 299 293 { 300 294 AssertReturn(m && m->info, E_FAIL); … … 307 301 dumpHostDnsStrVector("Search String", m->info->searchList); 308 302 309 detachVectorOfWString(m->info->searchList, ComSafeArrayOutArg(aSearchStrings));303 detachVectorOfWString(m->info->searchList, aSearchStrings); 310 304 311 305 return S_OK; -
trunk/src/VBox/Main/src-server/HostDnsService.h
r52897 r52934 112 112 void notify() const; 113 113 114 HRESULT GetNameServers( ComSafeArrayOut(BSTR, aNameServers));115 HRESULT GetDomainName( BSTR *aDomainName);116 HRESULT GetSearchStrings( ComSafeArrayOut(BSTR, aSearchStrings));114 HRESULT GetNameServers(std::vector<com::Utf8Str> &aNameServers); 115 HRESULT GetDomainName(com::Utf8Str *pDomainName); 116 HRESULT GetSearchStrings(std::vector<com::Utf8Str> &aSearchStrings); 117 117 118 118 bool operator==(PCHostDnsMonitorProxy&); -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r52170 r52934 776 776 # endif /* RT_OS_LINUX */ 777 777 778 SafeIfaceArray<IHostNetworkInterface> networkInterfaces(list); 779 networkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces)); 778 aNetworkInterfaces.resize(list.size()); 779 size_t i = 0; 780 for (std::list<ComObjPtr<HostNetworkInterface> >::const_iterator it = list.begin(); it != list.end(); ++it, ++i) 781 aNetworkInterfaces[i] = *it; 780 782 781 783 return S_OK; … … 796 798 return rc; 797 799 798 SafeIfaceArray<IHostUSBDevice> resultArr; 799 rc = m->pUSBProxyService->getDeviceCollection(ComSafeArrayAsOutParam(resultArr)); 800 if (FAILED(rc)) 801 return rc; 802 803 aUSBDevices.resize(resultArr.size()); 804 for (size_t i = 0; i < resultArr.size(); ++i) 805 { 806 ComPtr<IHostUSBDevice> iHu = resultArr[i]; 807 iHu.queryInterfaceTo(aUSBDevices[i].asOutParam()); 808 } 809 810 return rc; 800 return m->pUSBProxyService->getDeviceCollection(aUSBDevices); 811 801 #else 812 802 /* Note: The GUI depends on this method returning E_NOTIMPL with no … … 827 817 { 828 818 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 829 830 com::SafeArray<BSTR> resultArr; 831 HRESULT rc = m->hostDnsMonitorProxy.GetNameServers(ComSafeArrayAsOutParam(resultArr)); 832 if (FAILED(rc)) 833 return rc; 834 835 aNameServers.resize(resultArr.size()); 836 for (size_t i = 0; i < resultArr.size(); ++i) 837 aNameServers[i] = com::Utf8Str(resultArr[i]); 838 839 return S_OK; 819 return m->hostDnsMonitorProxy.GetNameServers(aNameServers); 840 820 } 841 821 … … 848 828 /* XXX: note here should be synchronization with thread polling state 849 829 * changes in name resoving system on host */ 850 Bstr tmpName; 851 HRESULT rc = m->hostDnsMonitorProxy.GetDomainName(tmpName.asOutParam()); 852 if (FAILED(rc)) 853 return rc; 854 855 aDomainName = com::Utf8Str(tmpName); 856 857 return S_OK; 830 return m->hostDnsMonitorProxy.GetDomainName(&aDomainName); 858 831 } 859 832 … … 865 838 { 866 839 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 867 868 com::SafeArray<BSTR> resultArr; 869 HRESULT rc = m->hostDnsMonitorProxy.GetSearchStrings(ComSafeArrayAsOutParam(resultArr)); 870 if (FAILED(rc)) 871 return rc; 872 873 aSearchStrings.resize(resultArr.size()); 874 for (size_t i = 0; i < resultArr.size(); ++i) 875 aSearchStrings[i] = com::Utf8Str(resultArr[i]); 876 877 return S_OK; 840 return m->hostDnsMonitorProxy.GetSearchStrings(aSearchStrings); 878 841 } 879 842 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r52933 r52934 1659 1659 HRESULT Machine::setVideoCaptureScreens(const std::vector<BOOL> &aVideoCaptureScreens) 1660 1660 { 1661 SafeArray<BOOL> screens(aVideoCaptureScreens); 1662 AssertReturn(screens.size() <= RT_ELEMENTS(mHWData->maVideoCaptureScreens), E_INVALIDARG); 1661 AssertReturn(aVideoCaptureScreens.size() <= RT_ELEMENTS(mHWData->maVideoCaptureScreens), E_INVALIDARG); 1663 1662 bool fChanged = false; 1664 1663 1665 1664 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1666 1665 1667 for (unsigned i = 0; i < screens.size(); ++i)1668 { 1669 if (mHWData->maVideoCaptureScreens[i] != RT_BOOL( screens[i]))1670 { 1671 mHWData->maVideoCaptureScreens[i] = RT_BOOL( screens[i]);1666 for (unsigned i = 0; i < aVideoCaptureScreens.size(); ++i) 1667 { 1668 if (mHWData->maVideoCaptureScreens[i] != RT_BOOL(aVideoCaptureScreens[i])) 1669 { 1670 mHWData->maVideoCaptureScreens[i] = RT_BOOL(aVideoCaptureScreens[i]); 1672 1671 fChanged = true; 1673 1672 } … … 4823 4822 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4824 4823 4825 com::SafeArray<BSTR> saKeys(mData->pMachineConfigFile->mapExtraDataItems.size());4826 4824 aKeys.resize(mData->pMachineConfigFile->mapExtraDataItems.size()); 4827 4825 size_t i = 0; … … 6331 6329 *aHeight = u32Height; 6332 6330 6333 com::SafeArray<BYTE> bitmap(cbData);6331 aData.resize(cbData); 6334 6332 /* Convert pixels to format expected by the API caller. */ 6335 6333 if (aBGR) … … 6338 6336 for (unsigned i = 0; i < cbData; i += 4) 6339 6337 { 6340 bitmap[i] = pu8Data[i];6341 bitmap[i + 1] = pu8Data[i + 1];6342 bitmap[i + 2] = pu8Data[i + 2];6343 bitmap[i + 3] = 0xff;6338 aData[i] = pu8Data[i]; 6339 aData[i + 1] = pu8Data[i + 1]; 6340 aData[i + 2] = pu8Data[i + 2]; 6341 aData[i + 3] = 0xff; 6344 6342 } 6345 6343 } … … 6349 6347 for (unsigned i = 0; i < cbData; i += 4) 6350 6348 { 6351 bitmap[i] = pu8Data[i + 2]; 6352 bitmap[i + 1] = pu8Data[i + 1]; 6353 bitmap[i + 2] = pu8Data[i]; 6354 bitmap[i + 3] = 0xff; 6355 } 6356 } 6357 aData.resize(bitmap.size()); 6358 for (size_t i = 0; i < bitmap.size(); ++i) 6359 aData[i] = bitmap[i]; 6349 aData[i] = pu8Data[i + 2]; 6350 aData[i + 1] = pu8Data[i + 1]; 6351 aData[i + 2] = pu8Data[i]; 6352 aData[i + 3] = 0xff; 6353 } 6354 } 6360 6355 6361 6356 freeSavedDisplayScreenshot(pu8Data); … … 6396 6391 if (RT_SUCCESS(vrc)) 6397 6392 { 6398 com::SafeArray<BYTE> screenData(cbPNG); 6399 screenData.initFrom(pu8PNG, cbPNG); 6393 aData.resize(cbPNG); 6394 if (cbPNG) 6395 memcpy(&aData.front(), pu8PNG, cbPNG); 6400 6396 if (pu8PNG) 6401 6397 RTMemFree(pu8PNG); 6402 aData.resize(screenData.size());6403 for (size_t i = 0; i < screenData.size(); ++i)6404 aData[i] = screenData[i];6405 6398 } 6406 6399 else … … 6468 6461 *aHeight = u32Height; 6469 6462 6470 com::SafeArray<BYTE> png(cbData); 6471 png.initFrom(pu8Data, cbData); 6472 aData.resize(png.size()); 6473 for (size_t i = 0; i < png.size(); ++i) 6474 aData[i] = png[i]; 6463 aData.resize(cbData); 6464 if (cbData) 6465 memcpy(&aData.front(), pu8Data, cbData); 6475 6466 6476 6467 freeSavedDisplayScreenshot(pu8Data); … … 6597 6588 * One byte expands to approx. 25 bytes of breathtaking XML. */ 6598 6589 size_t cbData = (size_t)RT_MIN(aSize, 32768); 6599 com::SafeArray<BYTE> logData(cbData);6590 aData.resize(cbData); 6600 6591 6601 6592 RTFILE LogFile; … … 6604 6595 if (RT_SUCCESS(vrc)) 6605 6596 { 6606 vrc = RTFileReadAt(LogFile, aOffset, logData.raw(), cbData, &cbData);6597 vrc = RTFileReadAt(LogFile, aOffset, cbData? &aData.front(): NULL, cbData, &cbData); 6607 6598 if (RT_SUCCESS(vrc)) 6608 logData.resize(cbData);6599 aData.resize(cbData); 6609 6600 else 6610 6601 rc = setError(VBOX_E_IPRT_ERROR, … … 6619 6610 6620 6611 if (FAILED(rc)) 6621 logData.resize(0); 6622 6623 aData.resize(logData.size()); 6624 for (size_t i = 0; i < logData.size(); ++i) 6625 aData[i] = logData[i]; 6612 aData.resize(0); 6626 6613 6627 6614 return rc; … … 6982 6969 { 6983 6970 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6984 com::SafeArray<BYTE> icon(mUserData->mIcon.size()); 6985 aIcon.resize(mUserData->mIcon.size()); 6986 memcpy(icon.raw(), &mUserData->mIcon[0], mUserData->mIcon.size()); 6987 aIcon.resize(icon.size()); 6988 for (size_t i = 0; i < icon.size(); ++i) 6989 aIcon[i] = icon[i]; 6971 size_t cbIcon = mUserData->mIcon.size(); 6972 aIcon.resize(cbIcon); 6973 if (cbIcon) 6974 memcpy(&aIcon.front(), &mUserData->mIcon[0], cbIcon); 6990 6975 return S_OK; 6991 6976 } … … 6999 6984 i_setModified(IsModified_MachineData); 7000 6985 mUserData.backup(); 7001 com::SafeArray<BYTE> icon(aIcon); 7002 mUserData->mIcon.resize(aIcon.size()); 7003 memcpy(&mUserData->mIcon[0], icon.raw(), mUserData->mIcon.size()); 6986 size_t cbIcon = aIcon.size(); 6987 mUserData->mIcon.resize(cbIcon); 6988 if (cbIcon) 6989 memcpy(&mUserData->mIcon[0], &aIcon.front(), cbIcon); 7004 6990 } 7005 6991 return hrc; … … 7008 6994 HRESULT Machine::getUSBProxyAvailable(BOOL *aUSBProxyAvailable) 7009 6995 { 7010 7011 6996 #ifdef VBOX_WITH_USB 7012 6997 *aUSBProxyAvailable = true; … … 8424 8409 cbOut, 8425 8410 DECODE_STR_MAX); 8426 com::SafeArray<BYTE> iconByte(cbOut); 8427 int vrc = RTBase64Decode(pszStr, iconByte.raw(), cbOut, NULL, NULL); 8411 mUserData->mIcon.resize(cbOut); 8412 int vrc = VINF_SUCCESS; 8413 if (cbOut) 8414 vrc = RTBase64Decode(pszStr, &mUserData->mIcon.front(), cbOut, NULL, NULL); 8428 8415 if (RT_FAILURE(vrc)) 8416 { 8417 mUserData->mIcon.resize(0); 8429 8418 return setError(E_FAIL, 8430 8419 tr("Failure to Decode Icon Data. '%s' (%Rrc)"), 8431 8420 pszStr, 8432 8421 vrc); 8433 mUserData->mIcon.resize(iconByte.size()); 8434 memcpy(&mUserData->mIcon[0], iconByte.raw(), mUserData->mIcon.size()); 8422 } 8435 8423 8436 8424 // look up the object by Id to check it is valid … … 9821 9809 9822 9810 // Encode the Icon Override data from Machine and store on config userdata. 9823 com::SafeArray<BYTE> iconByte;9824 COMGETTER(Icon)(ComSafeArrayAsOutParam(iconByte));9811 std::vector<BYTE> iconByte; 9812 getIcon(iconByte); 9825 9813 ssize_t cbData = iconByte.size(); 9826 9814 if (cbData > 0) … … 9829 9817 Utf8Str strIconData; 9830 9818 strIconData.reserve(cchOut+1); 9831 int vrc = RTBase64Encode( iconByte.raw(), cbData,9819 int vrc = RTBase64Encode(&iconByte.front(), cbData, 9832 9820 strIconData.mutableRaw(), strIconData.capacity(), 9833 9821 NULL); -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r51498 r52934 133 133 * @remarks The caller must own the write lock of the host object. 134 134 */ 135 HRESULT USBProxyService::getDeviceCollection( ComSafeArrayOut(IHostUSBDevice *, aUSBDevices))135 HRESULT USBProxyService::getDeviceCollection(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices) 136 136 { 137 137 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 138 CheckComArgOutSafeArrayPointerValid(aUSBDevices);139 138 140 139 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 141 140 142 SafeIfaceArray<IHostUSBDevice> Collection(mDevices); 143 Collection.detachTo(ComSafeArrayOutArg(aUSBDevices)); 141 aUSBDevices.resize(mDevices.size()); 142 size_t i = 0; 143 for (HostUSBDeviceList::const_iterator it = mDevices.begin(); it != mDevices.end(); ++it, ++i) 144 aUSBDevices[i] = *it; 144 145 145 146 return S_OK; -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r52615 r52934 3209 3209 * Takes a list of machine groups, and sanitizes/validates it. 3210 3210 * 3211 * @param aMachineGroups Safearray with the machine groups.3211 * @param aMachineGroups Array with the machine groups. 3212 3212 * @param pllMachineGroups Pointer to list of strings for the result. 3213 3213 *
Note:
See TracChangeset
for help on using the changeset viewer.