diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2010-02-03 13:07:12 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2010-02-03 13:07:12 +0000 |
commit | adfa2049b274a50fe289edf3e7c13d07777f5f3d (patch) | |
tree | 78b51df944b7d1f72006c4f3aaa08c7e85ac43d9 | |
parent | 7eede5c59b0ab0faab998d8dcbaa580d8eaf2e65 (diff) | |
download | VirtualBox-svn-adfa2049b274a50fe289edf3e7c13d07777f5f3d.tar.gz |
Main: coding style fixes
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@26186 cfe28804-0f27-0410-a406-dd0f0b0b656f
45 files changed, 1083 insertions, 1095 deletions
diff --git a/src/VBox/Main/ConsoleImpl2.cpp b/src/VBox/Main/ConsoleImpl2.cpp index 9f8ae97de17..fc4d62b68cb 100644 --- a/src/VBox/Main/ConsoleImpl2.cpp +++ b/src/VBox/Main/ConsoleImpl2.cpp @@ -1034,7 +1034,7 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) for (size_t j = 0; j < atts.size(); ++j) { ComPtr<IMedium> medium; - hrc = atts [j]->COMGETTER(Medium)(medium.asOutParam()); H(); + hrc = atts[j]->COMGETTER(Medium)(medium.asOutParam()); H(); LONG lDev; hrc = atts[j]->COMGETTER(Device)(&lDev); H(); LONG lPort; @@ -2095,13 +2095,13 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) /* Register VM state change handler */ int rc2 = VMR3AtStateRegister (pVM, Console::vmstateChangeCallback, pConsole); - AssertRC (rc2); + AssertRC(rc2); if (RT_SUCCESS(rc)) rc = rc2; /* Register VM runtime error handler */ rc2 = VMR3AtRuntimeErrorRegister (pVM, Console::setVMRuntimeErrorCallback, pConsole); - AssertRC (rc2); + AssertRC(rc2); if (RT_SUCCESS(rc)) rc = rc2; @@ -2305,7 +2305,7 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) } } - Assert ((int)pThis->maTapFD[uInstance] >= 0); + Assert((int)pThis->maTapFD[uInstance] >= 0); if ((int)pThis->maTapFD[uInstance] >= 0) { if (fSniffer) @@ -2513,7 +2513,7 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) } } - Assert ((int)pThis->maTapFD[uInstance] >= 0); + Assert((int)pThis->maTapFD[uInstance] >= 0); if ((int)pThis->maTapFD[uInstance] >= 0) { rc = CFGMR3InsertString(pLunL0, "Driver", "HostInterface"); RC_CHECK(); diff --git a/src/VBox/Main/ConsoleVRDPServer.cpp b/src/VBox/Main/ConsoleVRDPServer.cpp index 1b75e62a116..8ff7ffbfb8f 100644 --- a/src/VBox/Main/ConsoleVRDPServer.cpp +++ b/src/VBox/Main/ConsoleVRDPServer.cpp @@ -45,8 +45,8 @@ class VRDPConsoleCallback : VBOX_SCRIPTABLE_IMPL(IConsoleCallback) { public: - VRDPConsoleCallback (ConsoleVRDPServer *server) : - m_server(server) + VRDPConsoleCallback(ConsoleVRDPServer *server) + : m_server(server) { #ifndef VBOX_WITH_XPCOM refcnt = 0; @@ -59,16 +59,16 @@ public: #ifndef VBOX_WITH_XPCOM STDMETHOD_(ULONG, AddRef)() { - return ::InterlockedIncrement (&refcnt); + return ::InterlockedIncrement(&refcnt); } STDMETHOD_(ULONG, Release)() { - long cnt = ::InterlockedDecrement (&refcnt); + long cnt = ::InterlockedDecrement(&refcnt); if (cnt == 0) delete this; return cnt; } - STDMETHOD(QueryInterface) (REFIID riid , void **ppObj) + STDMETHOD(QueryInterface)(REFIID riid , void **ppObj) { if (riid == IID_IUnknown) { *ppObj = this; @@ -102,7 +102,7 @@ public: { if (m_server) { - m_server->NotifyKeyboardLedsChange (fNumLock, fCapsLock, fScrollLock); + m_server->NotifyKeyboardLedsChange(fNumLock, fCapsLock, fScrollLock); } return S_OK; } @@ -127,22 +127,22 @@ public: return S_OK; } - STDMETHOD(OnNetworkAdapterChange) (INetworkAdapter *aNetworkAdapter) + STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *aNetworkAdapter) { return S_OK; } - STDMETHOD(OnSerialPortChange) (ISerialPort *aSerialPort) + STDMETHOD(OnSerialPortChange)(ISerialPort *aSerialPort) { return S_OK; } - STDMETHOD(OnParallelPortChange) (IParallelPort *aParallelPort) + STDMETHOD(OnParallelPortChange)(IParallelPort *aParallelPort) { return S_OK; } - STDMETHOD(OnStorageControllerChange) () + STDMETHOD(OnStorageControllerChange)() { return S_OK; } @@ -168,7 +168,7 @@ public: return S_OK; } - STDMETHOD(OnSharedFolderChange) (Scope_T aScope) + STDMETHOD(OnSharedFolderChange)(Scope_T aScope) { return S_OK; } @@ -187,7 +187,7 @@ public: return S_OK; } - STDMETHOD(OnShowWindow) (ULONG64 *winId) + STDMETHOD(OnShowWindow)(ULONG64 *winId) { if (!winId) return E_POINTER; @@ -211,7 +211,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDPConsoleCallback, IConsoleCallback) #ifdef DEBUG_sunlover #define LOGDUMPPTR Log -void dumpPointer (const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool fXorMaskRGB32) +void dumpPointer(const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool fXorMaskRGB32) { unsigned i; @@ -236,7 +236,7 @@ void dumpPointer (const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool if (fXorMaskRGB32) { - uint32_t *pu32Xor = (uint32_t *)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3)); + uint32_t *pu32Xor = (uint32_t*)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3)); for (i = 0; i < height; i++) { @@ -252,7 +252,7 @@ void dumpPointer (const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool else { /* RDP 24 bit RGB mask. */ - uint8_t *pu8Xor = (uint8_t *)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3)); + uint8_t *pu8Xor = (uint8_t*)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3)); for (i = 0; i < height; i++) { unsigned j; @@ -270,7 +270,7 @@ void dumpPointer (const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool #define dumpPointer(a, b, c, d) do {} while (0) #endif /* DEBUG_sunlover */ -static void findTopLeftBorder (const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width, uint32_t height, uint32_t *pxSkip, uint32_t *pySkip) +static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width, uint32_t height, uint32_t *pxSkip, uint32_t *pySkip) { /* * Find the top border of the AND mask. First assign to special value. @@ -390,8 +390,8 @@ static void findTopLeftBorder (const uint8_t *pu8AndMask, const uint8_t *pu8XorM xSkipXor = 0; } - *pxSkip = RT_MIN (xSkipAnd, xSkipXor); - *pySkip = RT_MIN (ySkipAnd, ySkipXor); + *pxSkip = RT_MIN(xSkipAnd, xSkipXor); + *pySkip = RT_MIN(ySkipAnd, ySkipXor); } /* Generate an AND mask for alpha pointers here, because @@ -400,9 +400,9 @@ static void findTopLeftBorder (const uint8_t *pu8AndMask, const uint8_t *pu8XorM * for the guest driver, but then additions reinstall would be * necessary, which we try to avoid. */ -static void mousePointerGenerateANDMask (uint8_t *pu8DstAndMask, int cbDstAndMask, const uint8_t *pu8SrcAlpha, int w, int h) +static void mousePointerGenerateANDMask(uint8_t *pu8DstAndMask, int cbDstAndMask, const uint8_t *pu8SrcAlpha, int w, int h) { - memset (pu8DstAndMask, 0xFF, cbDstAndMask); + memset(pu8DstAndMask, 0xFF, cbDstAndMask); int y; for (y = 0; y < h; y++) @@ -430,14 +430,13 @@ static void mousePointerGenerateANDMask (uint8_t *pu8DstAndMask, int cbDstAndMas } } -STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( - BOOL visible, - BOOL alpha, - ULONG xHot, - ULONG yHot, - ULONG width, - ULONG height, - BYTE *shape) +STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange(BOOL visible, + BOOL alpha, + ULONG xHot, + ULONG yHot, + ULONG width, + ULONG height, + BYTE *shape) { LogSunlover(("VRDPConsoleCallback::OnMousePointerShapeChange: %d, %d, %lux%lu, @%lu,%lu\n", visible, alpha, width, height, xHot, yHot)); @@ -447,7 +446,7 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( { if (!visible) { - m_server->MousePointerHide (); + m_server->MousePointerHide(); } } else if (width != 0 && height != 0) @@ -469,7 +468,7 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( * because most pointers are 32x32. */ - dumpPointer (shape, width, height, true); + dumpPointer(shape, width, height, true); int cbDstAndMask = (((width + 7) / 8) * height + 3) & ~3; @@ -478,9 +477,9 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( if (alpha) { - pu8AndMask = (uint8_t *)alloca (cbDstAndMask); + pu8AndMask = (uint8_t*)alloca(cbDstAndMask); - mousePointerGenerateANDMask (pu8AndMask, cbDstAndMask, pu8XorMask, width, height); + mousePointerGenerateANDMask(pu8AndMask, cbDstAndMask, pu8XorMask, width, height); } /* Windows guest alpha pointers are wider than 32 pixels. @@ -492,11 +491,11 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( uint32_t ySkip = 0; /* How many rows to skip at the top. */ uint32_t xSkip = 0; /* How many columns to skip at the left. */ - findTopLeftBorder (pu8AndMask, pu8XorMask, width, height, &xSkip, &ySkip); + findTopLeftBorder(pu8AndMask, pu8XorMask, width, height, &xSkip, &ySkip); /* Must not skip the hot spot. */ - xSkip = RT_MIN (xSkip, xHot); - ySkip = RT_MIN (ySkip, yHot); + xSkip = RT_MIN(xSkip, xHot); + ySkip = RT_MIN(ySkip, yHot); /* * Compute size and allocate memory for the pointer. @@ -514,15 +513,15 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( uint32_t rdpdatawidth = dstwidth * 3; uint32_t rdpdatalen = dstheight * rdpdatawidth; - pointer = (VRDPCOLORPOINTER *)RTMemTmpAlloc (sizeof (VRDPCOLORPOINTER) + rdpmasklen + rdpdatalen); + pointer = (VRDPCOLORPOINTER *)RTMemTmpAlloc(sizeof(VRDPCOLORPOINTER) + rdpmasklen + rdpdatalen); if (pointer) { - uint8_t *maskarray = (uint8_t *)pointer + sizeof (VRDPCOLORPOINTER); + uint8_t *maskarray = (uint8_t*)pointer + sizeof(VRDPCOLORPOINTER); uint8_t *dataarray = maskarray + rdpmasklen; - memset (maskarray, 0xFF, rdpmasklen); - memset (dataarray, 0x00, rdpdatalen); + memset(maskarray, 0xFF, rdpmasklen); + memset(dataarray, 0x00, rdpdatalen); uint32_t srcmaskwidth = (width + 7) / 8; uint32_t srcdatawidth = width * 4; @@ -531,8 +530,8 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( uint8_t *src = pu8AndMask + ySkip * srcmaskwidth; uint8_t *dst = maskarray + (dstheight - 1) * rdpmaskwidth; - uint32_t minheight = RT_MIN (height - ySkip, dstheight); - uint32_t minwidth = RT_MIN (width - xSkip, dstwidth); + uint32_t minheight = RT_MIN(height - ySkip, dstheight); + uint32_t minwidth = RT_MIN(width - xSkip, dstwidth); unsigned x, y; @@ -566,7 +565,7 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( { for (x = 0; x < minwidth; x++) { - memcpy (dst + x * 3, &src[4 * (x + xSkip)], 3); + memcpy(dst + x * 3, &src[4 * (x + xSkip)], 3); } src += srcdatawidth; @@ -582,11 +581,11 @@ STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( pointer->u16MaskLen = (uint16_t)rdpmasklen; pointer->u16DataLen = (uint16_t)rdpdatalen; - dumpPointer ((uint8_t *)pointer + sizeof (*pointer), dstwidth, dstheight, false); + dumpPointer((uint8_t*)pointer + sizeof(*pointer), dstwidth, dstheight, false); - m_server->MousePointerUpdate (pointer); + m_server->MousePointerUpdate(pointer); - RTMemTmpFree (pointer); + RTMemTmpFree(pointer); } } } @@ -607,7 +606,7 @@ VRDPENTRYPOINTS_1 *ConsoleVRDPServer::mpEntryPoints = NULL; VRDPCALLBACKS_1 ConsoleVRDPServer::mCallbacks = { - { VRDP_INTERFACE_VERSION_1, sizeof (VRDPCALLBACKS_1) }, + { VRDP_INTERFACE_VERSION_1, sizeof(VRDPCALLBACKS_1) }, ConsoleVRDPServer::VRDPCallbackQueryProperty, ConsoleVRDPServer::VRDPCallbackClientLogon, ConsoleVRDPServer::VRDPCallbackClientConnect, @@ -622,9 +621,9 @@ VRDPCALLBACKS_1 ConsoleVRDPServer::mCallbacks = ConsoleVRDPServer::VRDPCallbackVideoModeHint }; -DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) +DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); int rc = VERR_NOT_SUPPORTED; @@ -635,7 +634,7 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac /* This is obsolete, the VRDP server uses VRDP_QP_NETWORK_PORT_RANGE instead. */ ULONG port = 0; - if (cbBuffer >= sizeof (uint32_t)) + if (cbBuffer >= sizeof(uint32_t)) { *(uint32_t *)pvBuffer = (uint32_t)port; rc = VINF_SUCCESS; @@ -645,18 +644,18 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac rc = VINF_BUFFER_OVERFLOW; } - *pcbOut = sizeof (uint32_t); + *pcbOut = sizeof(uint32_t); } break; case VRDP_QP_NETWORK_ADDRESS: { com::Bstr bstr; - server->mConsole->getVRDPServer ()->COMGETTER(NetAddress) (bstr.asOutParam()); + server->mConsole->getVRDPServer()->COMGETTER(NetAddress)(bstr.asOutParam()); /* The server expects UTF8. */ com::Utf8Str address = bstr; - size_t cbAddress = address.length () + 1; + size_t cbAddress = address.length() + 1; if (cbAddress >= 0x10000) { @@ -671,7 +670,7 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac { if (address.raw()) { - memcpy (pvBuffer, address.raw(), cbAddress); + memcpy(pvBuffer, address.raw(), cbAddress); } else { @@ -694,9 +693,9 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac { ULONG cMonitors = 1; - server->mConsole->machine ()->COMGETTER(MonitorCount)(&cMonitors); + server->mConsole->machine()->COMGETTER(MonitorCount)(&cMonitors); - if (cbBuffer >= sizeof (uint32_t)) + if (cbBuffer >= sizeof(uint32_t)) { *(uint32_t *)pvBuffer = (uint32_t)cMonitors; rc = VINF_SUCCESS; @@ -706,13 +705,13 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac rc = VINF_BUFFER_OVERFLOW; } - *pcbOut = sizeof (uint32_t); + *pcbOut = sizeof(uint32_t); } break; case VRDP_QP_NETWORK_PORT_RANGE: { com::Bstr bstr; - HRESULT hrc = server->mConsole->getVRDPServer ()->COMGETTER(Ports) (bstr.asOutParam()); + HRESULT hrc = server->mConsole->getVRDPServer()->COMGETTER(Ports)(bstr.asOutParam()); if (hrc != S_OK) { @@ -742,7 +741,7 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac { if (portRange.raw()) { - memcpy (pvBuffer, portRange.raw(), cbPortRange); + memcpy(pvBuffer, portRange.raw(), cbPortRange); } else { @@ -763,7 +762,7 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac case VRDP_SP_NETWORK_BIND_PORT: { - if (cbBuffer != sizeof (uint32_t)) + if (cbBuffer != sizeof(uint32_t)) { rc = VERR_INVALID_PARAMETER; break; @@ -777,10 +776,10 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac if (pcbOut) { - *pcbOut = sizeof (uint32_t); + *pcbOut = sizeof(uint32_t); } - server->mConsole->onRemoteDisplayInfoChange (); + server->mConsole->onRemoteDisplayInfoChange(); } break; default: @@ -790,30 +789,30 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallbac return rc; } -DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon (void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain) +DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon(void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); return server->mConsole->VRDPClientLogon (u32ClientId, pszUser, pszPassword, pszDomain); } DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect (void *pvCallback, uint32_t u32ClientId) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); server->mConsole->VRDPClientConnect (u32ClientId); } DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercepted) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); server->mConsole->VRDPClientDisconnect (u32ClientId, fu32Intercepted); } DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackIntercept (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept, void **ppvIntercept) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); LogFlowFunc(("%x\n", fu32Intercept)); @@ -870,7 +869,7 @@ DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClipboard (void *pvCallback, v DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery (void *pvCallback, unsigned uScreenId, VRDPFRAMEBUFFERINFO *pInfo) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); bool fAvailable = false; @@ -925,7 +924,7 @@ DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery (void *pvCall DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock (void *pvCallback, unsigned uScreenId) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); if (server->maFramebuffers[uScreenId]) { @@ -935,7 +934,7 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock (void *pvCallb DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock (void *pvCallback, unsigned uScreenId) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); if (server->maFramebuffers[uScreenId]) { @@ -963,7 +962,7 @@ static void fixKbdLockStatus (VRDPInputSynch *pInputSynch, IKeyboard *pKeyboard) DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput (void *pvCallback, int type, const void *pvInput, unsigned cbInput) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); Console *pConsole = server->mConsole; switch (type) @@ -1092,9 +1091,9 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput (void *pvCallback, int t DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint (void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId) { - ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback); + ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); - server->mConsole->getDisplay ()->SetVideoModeHint(cWidth, cHeight, cBitsPerPixel, uScreenId); + server->mConsole->getDisplay()->SetVideoModeHint(cWidth, cHeight, cBitsPerPixel, uScreenId); } #endif /* VBOX_WITH_VRDP */ @@ -1102,8 +1101,8 @@ ConsoleVRDPServer::ConsoleVRDPServer (Console *console) { mConsole = console; - int rc = RTCritSectInit (&mCritSect); - AssertRC (rc); + int rc = RTCritSectInit(&mCritSect); + AssertRC(rc); mcClipboardRefs = 0; mpfnClipboardCallback = NULL; @@ -1337,7 +1336,7 @@ void ConsoleVRDPServer::notifyRemoteUSBThreadRunning (RTTHREAD thread) mUSBBackends.thread = thread; mUSBBackends.fThreadRunning = true; int rc = RTThreadUserSignal (thread); - AssertRC (rc); + AssertRC(rc); } bool ConsoleVRDPServer::isRemoteUSBThreadRunning (void) @@ -1377,7 +1376,7 @@ void ConsoleVRDPServer::remoteUSBThreadStart (void) { /* Wait until the thread is ready. */ rc = RTThreadUserWait (mUSBBackends.thread, 60000); - AssertRC (rc); + AssertRC(rc); Assert (mUSBBackends.fThreadRunning || RT_FAILURE(rc)); } } @@ -1393,7 +1392,7 @@ void ConsoleVRDPServer::remoteUSBThreadStop (void) RTSemEventSignal (mUSBBackends.event); int rc = RTThreadWait (mUSBBackends.thread, 60000, NULL); - AssertRC (rc); + AssertRC(rc); mUSBBackends.thread = NIL_RTTHREAD; } @@ -1485,7 +1484,7 @@ VRDPAuthResult ConsoleVRDPServer::Authenticate (const Guid &uuid, VRDPAuthGuestJ if (RT_FAILURE(rc)) { - mConsole->reportAuthLibraryError (filename.raw(), rc); + mConsole->reportAuthLibraryError(filename.raw(), rc); mpfnAuthEntry = NULL; mpfnAuthEntry2 = NULL; @@ -1545,7 +1544,7 @@ void ConsoleVRDPServer::AuthDisconnect (const Guid &uuid, uint32_t u32ClientId) int ConsoleVRDPServer::lockConsoleVRDPServer (void) { int rc = RTCritSectEnter (&mCritSect); - AssertRC (rc); + AssertRC(rc); return rc; } @@ -1940,7 +1939,7 @@ void ConsoleVRDPServer::usbBackendRemoveFromList (RemoteUSBBackend *pRemoteUSBBa { #ifdef VBOX_WITH_USB int rc = lockConsoleVRDPServer (); - AssertRC (rc); + AssertRC(rc); /* Exclude the found instance from the list. */ if (pRemoteUSBBackend->pNext) diff --git a/src/VBox/Main/DHCPServerRunner.cpp b/src/VBox/Main/DHCPServerRunner.cpp index df88462f35a..8bb58b037a8 100644 --- a/src/VBox/Main/DHCPServerRunner.cpp +++ b/src/VBox/Main/DHCPServerRunner.cpp @@ -85,8 +85,8 @@ int DHCPServerRunner::start() const char * args[DHCPCFG_NOTOPT_MAXVAL * 2]; /* get the path to the executable */ - char exePathBuf [RTPATH_MAX]; - const char *exePath = RTProcGetExecutableName (exePathBuf, RTPATH_MAX); + char exePathBuf[RTPATH_MAX]; + const char *exePath = RTProcGetExecutableName(exePathBuf, RTPATH_MAX); char *substrSl = strrchr(exePathBuf, '/'); char *substrBs = strrchr(exePathBuf, '\\'); char *suffix = substrSl ? substrSl : substrBs; @@ -120,7 +120,7 @@ int DHCPServerRunner::start() args[index++] = NULL; - int rc = RTProcCreate (exePath, args, RTENV_DEFAULT, 0, &mProcess); + int rc = RTProcCreate(exePath, args, RTENV_DEFAULT, 0, &mProcess); if (RT_FAILURE(rc)) mProcess = NIL_RTPROCESS; diff --git a/src/VBox/Main/DisplayImpl.cpp b/src/VBox/Main/DisplayImpl.cpp index a3f89e36aa9..7bbac9871ef 100644 --- a/src/VBox/Main/DisplayImpl.cpp +++ b/src/VBox/Main/DisplayImpl.cpp @@ -104,8 +104,8 @@ HRESULT Display::FinalConstruct() mLastHeight = 0; #ifdef VBOX_WITH_OLD_VBVA_LOCK - int rc = RTCritSectInit (&mVBVALock); - AssertRC (rc); + int rc = RTCritSectInit(&mVBVALock); + AssertRC(rc); mfu32PendingVideoAccelDisable = false; #endif /* VBOX_WITH_OLD_VBVA_LOCK */ @@ -2246,11 +2246,11 @@ STDMETHODIMP Display::TakeScreenShot (BYTE *address, ULONG width, ULONG height) #endif /* !VBOX_WITH_OLD_VBVA_LOCK */ if (vrc == VERR_NOT_IMPLEMENTED) - rc = setError (E_NOTIMPL, - tr ("This feature is not implemented")); + rc = setError(E_NOTIMPL, + tr("This feature is not implemented")); else if (RT_FAILURE(vrc)) - rc = setError (VBOX_E_IPRT_ERROR, - tr ("Could not take a screenshot (%Rrc)"), vrc); + rc = setError(VBOX_E_IPRT_ERROR, + tr("Could not take a screenshot (%Rrc)"), vrc); LogFlowFunc (("rc=%08X\n", rc)); LogFlowFuncLeave(); @@ -2322,11 +2322,11 @@ STDMETHODIMP Display::TakeScreenShotSlow (ULONG width, ULONG height, screenData.detachTo(ComSafeArrayOutArg(aScreenData)); } else if (vrc == VERR_NOT_IMPLEMENTED) - rc = setError (E_NOTIMPL, - tr ("This feature is not implemented")); + rc = setError(E_NOTIMPL, + tr("This feature is not implemented")); else - rc = setError (VBOX_E_IPRT_ERROR, - tr ("Could not take a screenshot (%Rrc)"), vrc); + rc = setError(VBOX_E_IPRT_ERROR, + tr("Could not take a screenshot (%Rrc)"), vrc); LogFlowFunc (("rc=%08X\n", rc)); LogFlowFuncLeave(); @@ -2394,8 +2394,8 @@ STDMETHODIMP Display::DrawToScreen (BYTE *address, ULONG x, ULONG y, rc = E_NOTIMPL; } else if (RT_FAILURE(rcVBox)) - rc = setError (VBOX_E_IPRT_ERROR, - tr ("Could not draw to the screen (%Rrc)"), rcVBox); + rc = setError(VBOX_E_IPRT_ERROR, + tr("Could not draw to the screen (%Rrc)"), rcVBox); //@todo // else // { @@ -2455,8 +2455,8 @@ STDMETHODIMP Display::InvalidateAndUpdate() alock.enter (); if (RT_FAILURE(rcVBox)) - rc = setError (VBOX_E_IPRT_ERROR, - tr ("Could not invalidate and update the screen (%Rrc)"), rcVBox); + rc = setError(VBOX_E_IPRT_ERROR, + tr("Could not invalidate and update the screen (%Rrc)"), rcVBox); LogFlowFunc (("rc=%08X\n", rc)); LogFlowFuncLeave(); @@ -2486,9 +2486,8 @@ STDMETHODIMP Display::ResizeCompleted(ULONG aScreenId) /* this is only valid for external framebuffers */ if (maFramebuffers[aScreenId].pFramebuffer == NULL) - return setError (VBOX_E_NOT_SUPPORTED, - tr ("Resize completed notification is valid only " - "for external framebuffers")); + return setError(VBOX_E_NOT_SUPPORTED, + tr("Resize completed notification is valid only for external framebuffers")); /* Set the flag indicating that the resize has completed and display * data need to be updated. */ @@ -2522,9 +2521,8 @@ STDMETHODIMP Display::UpdateCompleted() /* this is only valid for external framebuffers */ if (maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer == NULL) - return setError (VBOX_E_NOT_SUPPORTED, - tr ("Resize completed notification is valid only " - "for external framebuffers")); + return setError(VBOX_E_NOT_SUPPORTED, + tr("Resize completed notification is valid only for external framebuffers")); return S_OK; } diff --git a/src/VBox/Main/GuestImpl.cpp b/src/VBox/Main/GuestImpl.cpp index 2a46a5c1242..017fe866836 100644 --- a/src/VBox/Main/GuestImpl.cpp +++ b/src/VBox/Main/GuestImpl.cpp @@ -282,8 +282,8 @@ STDMETHODIMP Guest::SetCredentials(IN_BSTR aUserName, IN_BSTR aPassword, return S_OK; } - return setError (VBOX_E_VM_ERROR, - tr ("VMM device is not available (is the VM running?)")); + return setError(VBOX_E_VM_ERROR, + tr("VMM device is not available (is the VM running?)")); } STDMETHODIMP Guest::GetStatistic(ULONG aCpuId, GuestStatisticType_T aStatistic, ULONG *aStatVal) diff --git a/src/VBox/Main/HostImpl.cpp b/src/VBox/Main/HostImpl.cpp index a105a4a3c8d..22dcce7e4a6 100644 --- a/src/VBox/Main/HostImpl.cpp +++ b/src/VBox/Main/HostImpl.cpp @@ -224,19 +224,19 @@ HRESULT Host::init(VirtualBox *aParent) * Create and initialize the USB Proxy Service. */ # if defined (RT_OS_DARWIN) - m->pUSBProxyService = new USBProxyServiceDarwin (this); + m->pUSBProxyService = new USBProxyServiceDarwin(this); # elif defined (RT_OS_LINUX) - m->pUSBProxyService = new USBProxyServiceLinux (this); + m->pUSBProxyService = new USBProxyServiceLinux(this); # elif defined (RT_OS_OS2) m->pUSBProxyService = new USBProxyServiceOs2 (this); # elif defined (RT_OS_SOLARIS) - m->pUSBProxyService = new USBProxyServiceSolaris (this); + m->pUSBProxyService = new USBProxyServiceSolaris(this); # elif defined (RT_OS_WINDOWS) - m->pUSBProxyService = new USBProxyServiceWindows (this); + m->pUSBProxyService = new USBProxyServiceWindows(this); # elif defined (RT_OS_FREEBSD) - m->pUSBProxyService = new USBProxyServiceFreeBSD (this); + m->pUSBProxyService = new USBProxyServiceFreeBSD(this); # else - m->pUSBProxyService = new USBProxyService (this); + m->pUSBProxyService = new USBProxyService(this); # endif HRESULT hrc = m->pUSBProxyService->init(); AssertComRCReturn(hrc, hrc); @@ -247,11 +247,11 @@ HRESULT Host::init(VirtualBox *aParent) #endif /* VBOX_WITH_RESOURCE_USAGE_API */ #if defined (RT_OS_WINDOWS) - m->pHostPowerService = new HostPowerServiceWin (m->pParent); + m->pHostPowerService = new HostPowerServiceWin(m->pParent); #elif defined (RT_OS_DARWIN) - m->pHostPowerService = new HostPowerServiceDarwin (m->pParent); + m->pHostPowerService = new HostPowerServiceDarwin(m->pParent); #else - m->pHostPowerService = new HostPowerService (m->pParent); + m->pHostPowerService = new HostPowerService(m->pParent); #endif /* Cache the features reported by GetProcessorFeature. */ @@ -1156,7 +1156,7 @@ STDMETHODIMP Host::CreateUSBDeviceFilter(IN_BSTR aName, ComObjPtr<HostUSBDeviceFilter> filter; filter.createObject(); - HRESULT rc = filter->init (this, aName); + HRESULT rc = filter->init(this, aName); ComAssertComRCRet (rc, rc); rc = filter.queryInterfaceTo(aFilter); AssertComRCReturn (rc, rc); @@ -1202,8 +1202,8 @@ STDMETHODIMP Host::InsertUSBDeviceFilter(ULONG aPosition, tr("The given USB device filter is not created within this VirtualBox instance")); if (pFilter->mInList) - return setError (E_INVALIDARG, - tr ("The given USB device filter is already in the list")); + return setError(E_INVALIDARG, + tr("The given USB device filter is already in the list")); /* iterate to the position... */ USBDeviceFilterList::iterator it = m->llUSBDeviceFilters.begin(); @@ -1247,13 +1247,13 @@ STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition) if (FAILED(rc)) return rc; if (!m->llUSBDeviceFilters.size()) - return setError (E_INVALIDARG, - tr ("The USB device filter list is empty")); + return setError(E_INVALIDARG, + tr("The USB device filter list is empty")); if (aPosition >= m->llUSBDeviceFilters.size()) - return setError (E_INVALIDARG, - tr ("Invalid position: %lu (must be in range [0, %lu])"), - aPosition, m->llUSBDeviceFilters.size() - 1); + return setError(E_INVALIDARG, + tr("Invalid position: %lu (must be in range [0, %lu])"), + aPosition, m->llUSBDeviceFilters.size() - 1); ComObjPtr<HostUSBDeviceFilter> filter; { @@ -1368,8 +1368,8 @@ STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInte } if (!found) - return setError (E_INVALIDARG, HostNetworkInterface::tr ( - "The host network interface with the given name could not be found")); + return setError(E_INVALIDARG, + HostNetworkInterface::tr("The host network interface with the given name could not be found")); found->setVirtualBox(m->pParent); @@ -1406,8 +1406,8 @@ STDMETHODIMP Host::FindHostNetworkInterfaceById(IN_BSTR id, IHostNetworkInterfac } if (!found) - return setError (E_INVALIDARG, HostNetworkInterface::tr ( - "The host network interface with the given GUID could not be found")); + return setError(E_INVALIDARG, + HostNetworkInterface::tr("The host network interface with the given GUID could not be found")); found->setVirtualBox(m->pParent); @@ -1447,7 +1447,7 @@ STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T ty } STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress, - IHostUSBDevice **aDevice) + IHostUSBDevice **aDevice) { #ifdef VBOX_WITH_USB CheckComArgNotNull(aAddress); @@ -2401,98 +2401,98 @@ HRESULT Host::checkUSBProxyService() #endif /* VBOX_WITH_USB */ #ifdef VBOX_WITH_RESOURCE_USAGE_API -void Host::registerMetrics (PerformanceCollector *aCollector) +void Host::registerMetrics(PerformanceCollector *aCollector) { pm::CollectorHAL *hal = aCollector->getHAL(); /* Create sub metrics */ - pm::SubMetric *cpuLoadUser = new pm::SubMetric ("CPU/Load/User", + pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User", "Percentage of processor time spent in user mode."); - pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel", + pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel", "Percentage of processor time spent in kernel mode."); - pm::SubMetric *cpuLoadIdle = new pm::SubMetric ("CPU/Load/Idle", + pm::SubMetric *cpuLoadIdle = new pm::SubMetric("CPU/Load/Idle", "Percentage of processor time spent idling."); - pm::SubMetric *cpuMhzSM = new pm::SubMetric ("CPU/MHz", + pm::SubMetric *cpuMhzSM = new pm::SubMetric("CPU/MHz", "Average of current frequency of all processors."); - pm::SubMetric *ramUsageTotal = new pm::SubMetric ("RAM/Usage/Total", + pm::SubMetric *ramUsageTotal = new pm::SubMetric("RAM/Usage/Total", "Total physical memory installed."); - pm::SubMetric *ramUsageUsed = new pm::SubMetric ("RAM/Usage/Used", + pm::SubMetric *ramUsageUsed = new pm::SubMetric("RAM/Usage/Used", "Physical memory currently occupied."); - pm::SubMetric *ramUsageFree = new pm::SubMetric ("RAM/Usage/Free", + pm::SubMetric *ramUsageFree = new pm::SubMetric("RAM/Usage/Free", "Physical memory currently available to applications."); /* Create and register base metrics */ IUnknown *objptr; ComObjPtr<Host> tmp = this; tmp.queryInterfaceTo(&objptr); - pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw (hal, objptr, cpuLoadUser, cpuLoadKernel, + pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw(hal, objptr, cpuLoadUser, cpuLoadKernel, cpuLoadIdle); aCollector->registerBaseMetric (cpuLoad); - pm::BaseMetric *cpuMhz = new pm::HostCpuMhz (hal, objptr, cpuMhzSM); + pm::BaseMetric *cpuMhz = new pm::HostCpuMhz(hal, objptr, cpuMhzSM); aCollector->registerBaseMetric (cpuMhz); - pm::BaseMetric *ramUsage = new pm::HostRamUsage (hal, objptr, ramUsageTotal, ramUsageUsed, + pm::BaseMetric *ramUsage = new pm::HostRamUsage(hal, objptr, ramUsageTotal, ramUsageUsed, ramUsageFree); aCollector->registerBaseMetric (ramUsage); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, 0)); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, - new pm::AggregateMax())); - - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, 0)); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, - new pm::AggregateMax())); - - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle, 0)); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle, - new pm::AggregateMax())); - - aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, 0)); - aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, - new pm::AggregateMax())); - - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal, 0)); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal, - new pm::AggregateMax())); - - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed, 0)); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed, - new pm::AggregateMax())); - - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree, 0)); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree, - new pm::AggregateMax())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0)); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, + new pm::AggregateMax())); + + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0)); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, + new pm::AggregateMax())); + + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 0)); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, + new pm::AggregateMax())); + + aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 0)); + aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, + new pm::AggregateMax())); + + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 0)); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, + new pm::AggregateMax())); + + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 0)); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, + new pm::AggregateMax())); + + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 0)); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, + new pm::AggregateMax())); }; void Host::unregisterMetrics (PerformanceCollector *aCollector) { - aCollector->unregisterMetricsFor (this); - aCollector->unregisterBaseMetricsFor (this); + aCollector->unregisterMetricsFor(this); + aCollector->unregisterBaseMetricsFor(this); }; #endif /* VBOX_WITH_RESOURCE_USAGE_API */ diff --git a/src/VBox/Main/HostPower.cpp b/src/VBox/Main/HostPower.cpp index a3760545070..bc869a798c4 100644 --- a/src/VBox/Main/HostPower.cpp +++ b/src/VBox/Main/HostPower.cpp @@ -35,7 +35,7 @@ HostPowerService::HostPowerService (VirtualBox *aVirtualBox) { - Assert (aVirtualBox != NULL); + Assert(aVirtualBox != NULL); mVirtualBox = aVirtualBox; } @@ -74,15 +74,15 @@ void HostPowerService::notify(HostPowerEvent aEvent) /* get the remote console */ ComPtr<IConsole> console; - rc = pControl->GetRemoteConsole (console.asOutParam()); + rc = pControl->GetRemoteConsole(console.asOutParam()); /* the VM could have been powered down and closed or whatever */ - if (FAILED (rc)) + if (FAILED(rc)) continue; /* note that Pause() will simply return a failure if the VM is * in an inappropriate state */ rc = console->Pause(); - if (FAILED (rc)) + if (FAILED(rc)) continue; /* save the control to un-pause the VM later */ @@ -101,14 +101,14 @@ void HostPowerService::notify(HostPowerEvent aEvent) size_t resumed = 0; /* go through VMs we paused on Suspend */ - for (size_t i = 0; i < mConsoles.size(); ++ i) + for (size_t i = 0; i < mConsoles.size(); ++i) { /* note that Resume() will simply return a failure if the VM is * in an inappropriate state (it will also fail if the VM has * been somehow closed by this time already so that the * console reference we have is dead) */ - rc = mConsoles [i]->Resume(); - if (FAILED (rc)) + rc = mConsoles[i]->Resume(); + if (FAILED(rc)) continue; ++ resumed; @@ -147,7 +147,7 @@ void HostPowerService::notify(HostPowerEvent aEvent) ComPtr<IConsole> console; rc = pControl->GetRemoteConsole (console.asOutParam()); /* the VM could have been powered down and closed or whatever */ - if (FAILED (rc)) + if (FAILED(rc)) continue; ComPtr<IProgress> progress; @@ -155,7 +155,7 @@ void HostPowerService::notify(HostPowerEvent aEvent) /* note that SaveState() will simply return a failure if the VM * is in an inappropriate state */ rc = console->SaveState (progress.asOutParam()); - if (FAILED (rc)) + if (FAILED(rc)) continue; /* Wait until the operation has been completed. */ diff --git a/src/VBox/Main/KeyboardImpl.cpp b/src/VBox/Main/KeyboardImpl.cpp index 80f33eb0778..6891b4c34c7 100644 --- a/src/VBox/Main/KeyboardImpl.cpp +++ b/src/VBox/Main/KeyboardImpl.cpp @@ -137,14 +137,14 @@ STDMETHODIMP Keyboard::PutScancode (LONG scancode) AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - CHECK_CONSOLE_DRV (mpDrv); + CHECK_CONSOLE_DRV(mpDrv); - int vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)scancode); + int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)scancode); if (RT_FAILURE(vrc)) - rc = setError (VBOX_E_IPRT_ERROR, - tr ("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"), - scancode, vrc); + rc = setError(VBOX_E_IPRT_ERROR, + tr("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"), + scancode, vrc); return rc; } @@ -178,12 +178,12 @@ STDMETHODIMP Keyboard::PutScancodes (ComSafeArrayIn (LONG, scancodes), int vrc = VINF_SUCCESS; for (uint32_t i = 0; (i < keys.size()) && RT_SUCCESS(vrc); i++) - vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)keys [i]); + vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)keys[i]); if (RT_FAILURE(vrc)) - return setError (VBOX_E_IPRT_ERROR, - tr ("Could not send all scan codes to the virtual keyboard (%Rrc)"), - vrc); + return setError(VBOX_E_IPRT_ERROR, + tr("Could not send all scan codes to the virtual keyboard (%Rrc)"), + vrc); /// @todo is it actually possible that not all scancodes can be transmitted? if (codesStored) @@ -201,16 +201,16 @@ STDMETHODIMP Keyboard::PutScancodes (ComSafeArrayIn (LONG, scancodes), */ STDMETHODIMP Keyboard::PutCAD() { - static com::SafeArray<LONG> cadSequence (6); + static com::SafeArray<LONG> cadSequence(6); - cadSequence [0] = 0x1d; // Ctrl down - cadSequence [1] = 0x38; // Alt down - cadSequence [2] = 0x53; // Del down - cadSequence [3] = 0xd3; // Del up - cadSequence [4] = 0xb8; // Alt up - cadSequence [5] = 0x9d; // Ctrl up + cadSequence[0] = 0x1d; // Ctrl down + cadSequence[1] = 0x38; // Alt down + cadSequence[2] = 0x53; // Del down + cadSequence[3] = 0xd3; // Del up + cadSequence[4] = 0xb8; // Alt up + cadSequence[5] = 0x9d; // Ctrl up - return PutScancodes (ComSafeArrayAsInParam (cadSequence), NULL); + return PutScancodes(ComSafeArrayAsInParam(cadSequence), NULL); } // diff --git a/src/VBox/Main/MachineImpl.cpp b/src/VBox/Main/MachineImpl.cpp index cb50c3b0420..02b3836c474 100644 --- a/src/VBox/Main/MachineImpl.cpp +++ b/src/VBox/Main/MachineImpl.cpp @@ -178,11 +178,11 @@ Machine::HWData::HWData() mPropertyServiceActive = false; /* default boot order: floppy - DVD - HDD */ - mBootOrder [0] = DeviceType_Floppy; - mBootOrder [1] = DeviceType_DVD; - mBootOrder [2] = DeviceType_HardDisk; - for (size_t i = 3; i < RT_ELEMENTS (mBootOrder); ++i) - mBootOrder [i] = DeviceType_Null; + mBootOrder[0] = DeviceType_Floppy; + mBootOrder[1] = DeviceType_DVD; + mBootOrder[2] = DeviceType_HardDisk; + for (size_t i = 3; i < RT_ELEMENTS(mBootOrder); ++i) + mBootOrder[i] = DeviceType_Null; mClipboardMode = ClipboardMode_Bidirectional; mGuestPropertyNotificationPatterns = ""; @@ -508,7 +508,7 @@ void Machine::uninit() { LogFlowThisFuncEnter(); - Assert (!isWriteLockOnCurrentThread()); + Assert(!isWriteLockOnCurrentThread()); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); @@ -1729,7 +1729,7 @@ STDMETHODIMP Machine::COMGETTER(VRDPServer)(IVRDPServer **vrdpServer) AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - Assert (!!mVRDPServer); + Assert(!!mVRDPServer); mVRDPServer.queryInterfaceTo(vrdpServer); return S_OK; @@ -2277,7 +2277,7 @@ STDMETHODIMP Machine::SetBootOrder(ULONG aPosition, DeviceType_T aDevice) setModified(IsModified_MachineData); mHWData.backup(); - mHWData->mBootOrder [aPosition - 1] = aDevice; + mHWData->mBootOrder[aPosition - 1] = aDevice; return S_OK; } @@ -2294,7 +2294,7 @@ STDMETHODIMP Machine::GetBootOrder (ULONG aPosition, DeviceType_T *aDevice) AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - *aDevice = mHWData->mBootOrder [aPosition - 1]; + *aDevice = mHWData->mBootOrder[aPosition - 1]; return S_OK; } @@ -3034,40 +3034,40 @@ STDMETHODIMP Machine::GetMedium(IN_BSTR aControllerName, return S_OK; } -STDMETHODIMP Machine::GetSerialPort (ULONG slot, ISerialPort **port) +STDMETHODIMP Machine::GetSerialPort(ULONG slot, ISerialPort **port) { CheckComArgOutPointerValid(port); - CheckComArgExpr (slot, slot < RT_ELEMENTS (mSerialPorts)); + CheckComArgExpr(slot, slot < RT_ELEMENTS(mSerialPorts)); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - mSerialPorts [slot].queryInterfaceTo(port); + mSerialPorts[slot].queryInterfaceTo(port); return S_OK; } -STDMETHODIMP Machine::GetParallelPort (ULONG slot, IParallelPort **port) +STDMETHODIMP Machine::GetParallelPort(ULONG slot, IParallelPort **port) { CheckComArgOutPointerValid(port); - CheckComArgExpr (slot, slot < RT_ELEMENTS (mParallelPorts)); + CheckComArgExpr(slot, slot < RT_ELEMENTS(mParallelPorts)); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - mParallelPorts [slot].queryInterfaceTo(port); + mParallelPorts[slot].queryInterfaceTo(port); return S_OK; } -STDMETHODIMP Machine::GetNetworkAdapter (ULONG slot, INetworkAdapter **adapter) +STDMETHODIMP Machine::GetNetworkAdapter(ULONG slot, INetworkAdapter **adapter) { CheckComArgOutPointerValid(adapter); - CheckComArgExpr (slot, slot < RT_ELEMENTS (mNetworkAdapters)); + CheckComArgExpr(slot, slot < RT_ELEMENTS(mNetworkAdapters)); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); @@ -3250,7 +3250,7 @@ STDMETHODIMP Machine::DiscardSettings() * during this rollback, the session will be notified if data has * been actually changed */ - rollback (true /* aNotify */); + rollback(true /* aNotify */); return S_OK; } @@ -3380,7 +3380,7 @@ STDMETHODIMP Machine::SetCurrentSnapshot (IN_BSTR /* aId */) /// @todo (dmik) don't forget to set // mData->mCurrentStateModified to FALSE - return setError (E_NOTIMPL, "Not implemented"); + return setError(E_NOTIMPL, "Not implemented"); } STDMETHODIMP Machine::CreateSharedFolder (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable) @@ -3866,9 +3866,9 @@ STDMETHODIMP Machine::AddStorageController(IN_BSTR aName, if ( (aConnectionType <= StorageBus_Null) || (aConnectionType > StorageBus_SAS)) - return setError (E_INVALIDARG, - tr ("Invalid connection type: %d"), - aConnectionType); + return setError(E_INVALIDARG, + tr("Invalid connection type: %d"), + aConnectionType); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); @@ -3883,8 +3883,9 @@ STDMETHODIMP Machine::AddStorageController(IN_BSTR aName, rc = getStorageControllerByName (aName, ctrl, false /* aSetError */); if (SUCCEEDED(rc)) - return setError (VBOX_E_OBJECT_IN_USE, - tr ("Storage controller named '%ls' already exists"), aName); + return setError(VBOX_E_OBJECT_IN_USE, + tr("Storage controller named '%ls' already exists"), + aName); ctrl.createObject(); @@ -4145,8 +4146,9 @@ STDMETHODIMP Machine::QuerySavedThumbnailSize(ULONG *aSize, ULONG *aWidth, ULONG int vrc = readSavedDisplayScreenshot(&mSSData->mStateFilePath, 0 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height); if (RT_FAILURE(vrc)) - return setError (VBOX_E_IPRT_ERROR, - tr("Saved screenshot data is not available (%Rrc)"), vrc); + return setError(VBOX_E_IPRT_ERROR, + tr("Saved screenshot data is not available (%Rrc)"), + vrc); *aSize = cbData; *aWidth = u32Width; @@ -4178,8 +4180,9 @@ STDMETHODIMP Machine::ReadSavedThumbnailToArray(BOOL aBGR, ULONG *aWidth, ULONG int vrc = readSavedDisplayScreenshot(&mSSData->mStateFilePath, 0 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height); if (RT_FAILURE(vrc)) - return setError (VBOX_E_IPRT_ERROR, - tr("Saved screenshot data is not available (%Rrc)"), vrc); + return setError(VBOX_E_IPRT_ERROR, + tr("Saved screenshot data is not available (%Rrc)"), + vrc); *aWidth = u32Width; *aHeight = u32Height; @@ -4236,8 +4239,9 @@ STDMETHODIMP Machine::QuerySavedScreenshotPNGSize(ULONG *aSize, ULONG *aWidth, U int vrc = readSavedDisplayScreenshot(&mSSData->mStateFilePath, 1 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height); if (RT_FAILURE(vrc)) - return setError (VBOX_E_IPRT_ERROR, - tr("Saved screenshot data is not available (%Rrc)"), vrc); + return setError(VBOX_E_IPRT_ERROR, + tr("Saved screenshot data is not available (%Rrc)"), + vrc); *aSize = cbData; *aWidth = u32Width; @@ -4269,8 +4273,9 @@ STDMETHODIMP Machine::ReadSavedScreenshotPNGToArray(ULONG *aWidth, ULONG *aHeigh int vrc = readSavedDisplayScreenshot(&mSSData->mStateFilePath, 1 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height); if (RT_FAILURE(vrc)) - return setError (VBOX_E_IPRT_ERROR, - tr("Saved screenshot data is not available (%Rrc)"), vrc); + return setError(VBOX_E_IPRT_ERROR, + tr("Saved screenshot data is not available (%Rrc)"), + vrc); *aWidth = u32Width; *aHeight = u32Height; @@ -4507,7 +4512,7 @@ void Machine::getLogFolder (Utf8Str &aLogFolder) else { /* Log folder is <Machines>/<VM_SnapshotFolder>/Logs */ - Assert (!mUserData->mSnapshotFolderFull.isEmpty()); + Assert(!mUserData->mSnapshotFolderFull.isEmpty()); aLogFolder = Utf8StrFmt ("%ls%cLogs", mUserData->mSnapshotFolderFull.raw(), RTPATH_DELIMITER); } @@ -4686,7 +4691,7 @@ HRESULT Machine::openSession(IInternalSessionControl *aControl) * and reset session state to Closed (@note keep the code in sync * with the relevant part in openSession()). */ - Assert (mData->mSession.mRemoteControls.size() == 1); + Assert(mData->mSession.mRemoteControls.size() == 1); if (mData->mSession.mRemoteControls.size() == 1) { ErrorInfoKeeper eik; @@ -4849,7 +4854,7 @@ HRESULT Machine::openRemoteSession(IInternalSessionControl *aControl, # else const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE; # endif - Assert (sz >= sizeof (VirtualBox_exe)); + Assert(sz >= sizeof (VirtualBox_exe)); strcpy (cmd, VirtualBox_exe); Utf8Str idStr = mData->mUuid.toString(); @@ -4872,7 +4877,7 @@ HRESULT Machine::openRemoteSession(IInternalSessionControl *aControl, if (strType == "sdl" || strType == "GUI/SDL") { const char VBoxSDL_exe[] = "VBoxSDL" HOSTSUFF_EXE; - Assert (sz >= sizeof (VBoxSDL_exe)); + Assert(sz >= sizeof (VBoxSDL_exe)); strcpy (cmd, VBoxSDL_exe); Utf8Str idStr = mData->mUuid.toString(); @@ -4900,7 +4905,7 @@ HRESULT Machine::openRemoteSession(IInternalSessionControl *aControl, ) { const char VBoxHeadless_exe[] = "VBoxHeadless" HOSTSUFF_EXE; - Assert (sz >= sizeof (VBoxHeadless_exe)); + Assert(sz >= sizeof (VBoxHeadless_exe)); strcpy (cmd, VBoxHeadless_exe); Utf8Str idStr = mData->mUuid.toString(); @@ -4971,7 +4976,7 @@ HRESULT Machine::openRemoteSession(IInternalSessionControl *aControl, } /* attach launch data to the machine */ - Assert (mData->mSession.mPid == NIL_RTPROCESS); + Assert(mData->mSession.mPid == NIL_RTPROCESS); mData->mSession.mRemoteControls.push_back (aControl); mData->mSession.mProgress = aProgress; mData->mSession.mPid = pid; @@ -4998,15 +5003,16 @@ HRESULT Machine::openExistingSession (IInternalSessionControl *aControl) AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (!mData->mRegistered) - return setError (E_UNEXPECTED, - tr ("The machine '%ls' is not registered"), mUserData->mName.raw()); + return setError(E_UNEXPECTED, + tr("The machine '%ls' is not registered"), + mUserData->mName.raw()); LogFlowThisFunc(("mSession.state=%s\n", Global::stringifySessionState(mData->mSession.mState))); if (mData->mSession.mState != SessionState_Open) - return setError (VBOX_E_INVALID_SESSION_STATE, - tr ("The machine '%ls' does not have an open session"), - mUserData->mName.raw()); + return setError(VBOX_E_INVALID_SESSION_STATE, + tr("The machine '%ls' does not have an open session"), + mUserData->mName.raw()); ComAssertRet (!mData->mSession.mDirectControl.isNull(), E_FAIL); @@ -5017,11 +5023,12 @@ HRESULT Machine::openExistingSession (IInternalSessionControl *aControl) ComPtr<IConsole> console; HRESULT rc = mData->mSession.mDirectControl-> GetRemoteConsole (console.asOutParam()); - if (FAILED (rc)) + if (FAILED(rc)) { /* The failure may occur w/o any error info (from RPC), so provide one */ - return setError (VBOX_E_VM_ERROR, - tr ("Failed to get a console object from the direct session (%Rrc)"), rc); + return setError(VBOX_E_VM_ERROR, + tr("Failed to get a console object from the direct session (%Rrc)"), + rc); } ComAssertRet (!console.isNull(), E_FAIL); @@ -5426,7 +5433,7 @@ HRESULT Machine::addStateDependency (StateDependency aDepType /* = AnyStateDep * } ++mData->mMachineStateDeps; - Assert (mData->mMachineStateDeps != 0 /* overflow */); + Assert(mData->mMachineStateDeps != 0 /* overflow */); } if (aState) @@ -5458,7 +5465,7 @@ void Machine::releaseStateDependency() /* inform ensureNoStateDependencies() that there are no more deps */ if (mData->mMachineStateChangePending != 0) { - Assert (mData->mMachineStateDepsSem != NIL_RTSEMEVENTMULTI); + Assert(mData->mMachineStateDepsSem != NIL_RTSEMEVENTMULTI); RTSemEventMultiSignal (mData->mMachineStateDepsSem); } } @@ -5573,41 +5580,41 @@ HRESULT Machine::initDataAndChildObjects() /* create associated BIOS settings object */ unconst(mBIOSSettings).createObject(); - mBIOSSettings->init (this); + mBIOSSettings->init(this); #ifdef VBOX_WITH_VRDP /* create an associated VRDPServer object (default is disabled) */ unconst(mVRDPServer).createObject(); - mVRDPServer->init (this); + mVRDPServer->init(this); #endif /* create associated serial port objects */ - for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) { - unconst(mSerialPorts [slot]).createObject(); - mSerialPorts [slot]->init (this, slot); + unconst(mSerialPorts[slot]).createObject(); + mSerialPorts[slot]->init(this, slot); } /* create associated parallel port objects */ - for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) { - unconst(mParallelPorts [slot]).createObject(); - mParallelPorts [slot]->init (this, slot); + unconst(mParallelPorts[slot]).createObject(); + mParallelPorts[slot]->init(this, slot); } /* create the audio adapter object (always present, default is disabled) */ unconst(mAudioAdapter).createObject(); - mAudioAdapter->init (this); + mAudioAdapter->init(this); /* create the USB controller object (always present, default is disabled) */ unconst(mUSBController).createObject(); - mUSBController->init (this); + mUSBController->init(this); /* create associated network adapter objects */ - for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot ++) { - unconst(mNetworkAdapters [slot]).createObject(); - mNetworkAdapters [slot]->init (this, slot); + unconst(mNetworkAdapters[slot]).createObject(); + mNetworkAdapters[slot]->init(this, slot); } return S_OK; @@ -6769,7 +6776,7 @@ HRESULT Machine::prepareSaveSettings(bool &aRenamed, newConfigDir.raw(), RTPATH_DELIMITER, newName.raw()); /* new dir and old dir cannot be equal here because of 'if' * above and because name != newName */ - Assert (configDir != newConfigDir); + Assert(configDir != newConfigDir); if (!aNew) { /* perform real rename only if the machine is not new */ @@ -8020,7 +8027,7 @@ void Machine::commitMedia(bool aOnline /*= false*/) MediumState_T state; rc = pMedium->UnlockWrite(&state); /* the disk may be alredy relocked for reading above */ - Assert (SUCCEEDED(rc) || state == MediumState_LockedRead); + Assert(SUCCEEDED(rc) || state == MediumState_LockedRead); } } } @@ -8299,12 +8306,12 @@ void Machine::commit() mAudioAdapter->commit(); mUSBController->commit(); - for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) - mNetworkAdapters [slot]->commit(); - for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) - mSerialPorts [slot]->commit(); - for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) - mParallelPorts [slot]->commit(); + for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) + mNetworkAdapters[slot]->commit(); + for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) + mSerialPorts[slot]->commit(); + for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) + mParallelPorts[slot]->commit(); bool commitStorageControllers = false; @@ -8331,12 +8338,12 @@ void Machine::commit() /* no peer means the device is a newly created one; * create a peer owning data this device share it with */ peer.createObject(); - peer->init (mPeer, *it, true /* aReshare */); + peer->init(mPeer, *it, true /* aReshare */); } else { /* remove peer from the old list */ - mPeer->mStorageControllers->remove (peer); + mPeer->mStorageControllers->remove(peer); } /* and add it to the new list */ newList->push_back(peer); @@ -8353,7 +8360,7 @@ void Machine::commit() } /* attach new list of controllers to our peer */ - mPeer->mStorageControllers.attach (newList); + mPeer->mStorageControllers.attach(newList); } else { @@ -8382,8 +8389,8 @@ void Machine::commit() if (getClassID() == clsidSessionMachine) { /* attach new data to the primary machine and reshare it */ - mPeer->mUserData.attach (mUserData); - mPeer->mHWData.attach (mHWData); + mPeer->mUserData.attach(mUserData); + mPeer->mHWData.attach(mHWData); /* mMediaData is reshared by fixupMedia */ // mPeer->mMediaData.attach(mMediaData); Assert(mPeer->mMediaData.data() == mMediaData.data()); @@ -8407,7 +8414,7 @@ void Machine::copyFrom(Machine *aThat) AssertReturnVoid(getClassID() == clsidMachine || getClassID() == clsidSessionMachine); AssertReturnVoid(aThat->getClassID() == clsidSnapshotMachine); - AssertReturnVoid(!Global::IsOnline (mData->mMachineState)); + AssertReturnVoid(!Global::IsOnline(mData->mMachineState)); mHWData.assignCopy(aThat->mHWData); @@ -8420,7 +8427,7 @@ void Machine::copyFrom(Machine *aThat) ComObjPtr<SharedFolder> folder; folder.createObject(); HRESULT rc = folder->initCopy(getMachine(), *it); - AssertComRC (rc); + AssertComRC(rc); *it = folder; } @@ -8440,65 +8447,65 @@ void Machine::copyFrom(Machine *aThat) { ComObjPtr<StorageController> ctrl; ctrl.createObject(); - ctrl->initCopy (this, *it); + ctrl->initCopy(this, *it); mStorageControllers->push_back(ctrl); } - for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) - mNetworkAdapters[slot]->copyFrom (aThat->mNetworkAdapters [slot]); - for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) - mSerialPorts[slot]->copyFrom (aThat->mSerialPorts [slot]); - for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) - mParallelPorts[slot]->copyFrom (aThat->mParallelPorts [slot]); + for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) + mNetworkAdapters[slot]->copyFrom(aThat->mNetworkAdapters[slot]); + for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) + mSerialPorts[slot]->copyFrom(aThat->mSerialPorts[slot]); + for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) + mParallelPorts[slot]->copyFrom(aThat->mParallelPorts[slot]); } #ifdef VBOX_WITH_RESOURCE_USAGE_API -void Machine::registerMetrics (PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid) +void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid) { pm::CollectorHAL *hal = aCollector->getHAL(); /* Create sub metrics */ - pm::SubMetric *cpuLoadUser = new pm::SubMetric ("CPU/Load/User", + pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User", "Percentage of processor time spent in user mode by VM process."); - pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel", + pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel", "Percentage of processor time spent in kernel mode by VM process."); - pm::SubMetric *ramUsageUsed = new pm::SubMetric ("RAM/Usage/Used", + pm::SubMetric *ramUsageUsed = new pm::SubMetric("RAM/Usage/Used", "Size of resident portion of VM process in memory."); /* Create and register base metrics */ - pm::BaseMetric *cpuLoad = new pm::MachineCpuLoadRaw (hal, aMachine, pid, - cpuLoadUser, cpuLoadKernel); - aCollector->registerBaseMetric (cpuLoad); - pm::BaseMetric *ramUsage = new pm::MachineRamUsage (hal, aMachine, pid, - ramUsageUsed); - aCollector->registerBaseMetric (ramUsage); - - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser, 0)); - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser, - new pm::AggregateMax())); - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel, 0)); - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel, - new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel, - new pm::AggregateMax())); - - aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed, 0)); - aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed, + pm::BaseMetric *cpuLoad = new pm::MachineCpuLoadRaw(hal, aMachine, pid, + cpuLoadUser, cpuLoadKernel); + aCollector->registerBaseMetric(cpuLoad); + pm::BaseMetric *ramUsage = new pm::MachineRamUsage(hal, aMachine, pid, + ramUsageUsed); + aCollector->registerBaseMetric(ramUsage); + + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0)); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, new pm::AggregateAvg())); - aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed, - new pm::AggregateMin())); - aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed, - new pm::AggregateMax())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, + new pm::AggregateMax())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0)); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, + new pm::AggregateMax())); + + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 0)); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, + new pm::AggregateAvg())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, + new pm::AggregateMin())); + aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, + new pm::AggregateMax())); }; -void Machine::unregisterMetrics (PerformanceCollector *aCollector, Machine *aMachine) +void Machine::unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine) { - aCollector->unregisterMetricsFor (aMachine); - aCollector->unregisterBaseMetricsFor (aMachine); + aCollector->unregisterMetricsFor(aMachine); + aCollector->unregisterBaseMetricsFor(aMachine); }; #endif /* VBOX_WITH_RESOURCE_USAGE_API */ @@ -8528,13 +8535,13 @@ void SessionMachine::FinalRelease() { LogFlowThisFunc(("\n")); - uninit (Uninit::Unexpected); + uninit(Uninit::Unexpected); } /** * @note Must be called only by Machine::openSession() from its own write lock. */ -HRESULT SessionMachine::init (Machine *aMachine) +HRESULT SessionMachine::init(Machine *aMachine) { LogFlowThisFuncEnter(); LogFlowThisFunc(("mName={%ls}\n", aMachine->mUserData->mName.raw())); @@ -8553,20 +8560,20 @@ HRESULT SessionMachine::init (Machine *aMachine) for (size_t i = 0; i < mIPCSemName.length(); i++) if (mIPCSemName[i] == '\\') mIPCSemName[i] = '/'; - mIPCSem = ::CreateMutex (NULL, FALSE, mIPCSemName); - ComAssertMsgRet (mIPCSem, - ("Cannot create IPC mutex '%ls', err=%d", - mIPCSemName.raw(), ::GetLastError()), - E_FAIL); + mIPCSem = ::CreateMutex(NULL, FALSE, mIPCSemName); + ComAssertMsgRet(mIPCSem, + ("Cannot create IPC mutex '%ls', err=%d", + mIPCSemName.raw(), ::GetLastError()), + E_FAIL); #elif defined(RT_OS_OS2) - Utf8Str ipcSem = Utf8StrFmt ("\\SEM32\\VBOX\\VM\\{%RTuuid}", - aMachine->mData->mUuid.raw()); + Utf8Str ipcSem = Utf8StrFmt("\\SEM32\\VBOX\\VM\\{%RTuuid}", + aMachine->mData->mUuid.raw()); mIPCSemName = ipcSem; - APIRET arc = ::DosCreateMutexSem ((PSZ) ipcSem.raw(), &mIPCSem, 0, FALSE); - ComAssertMsgRet (arc == NO_ERROR, - ("Cannot create IPC mutex '%s', arc=%ld", - ipcSem.raw(), arc), - E_FAIL); + APIRET arc = ::DosCreateMutexSem((PSZ)ipcSem.raw(), &mIPCSem, 0, FALSE); + ComAssertMsgRet(arc == NO_ERROR, + ("Cannot create IPC mutex '%s', arc=%ld", + ipcSem.raw(), arc), + E_FAIL); #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) # ifdef VBOX_WITH_NEW_SYS_V_KEYGEN # if defined(RT_OS_FREEBSD) && (HC_ARCH_BITS == 64) @@ -8581,23 +8588,23 @@ HRESULT SessionMachine::init (Machine *aMachine) for (uint32_t i = 0; i < 1 << 24; i++) { key = ((uint32_t)'V' << 24) | i; - int sem = ::semget (key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL); + int sem = ::semget(key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL); if (sem >= 0 || (errno != EEXIST && errno != EACCES)) { mIPCSem = sem; if (sem >= 0) - mIPCKey = BstrFmt ("%u", key); + mIPCKey = BstrFmt("%u", key); break; } } # else /* !VBOX_WITH_NEW_SYS_V_KEYGEN */ Utf8Str semName = aMachine->mData->m_strConfigFileFull; char *pszSemName = NULL; - RTStrUtf8ToCurrentCP (&pszSemName, semName); - key_t key = ::ftok (pszSemName, 'V'); - RTStrFree (pszSemName); + RTStrUtf8ToCurrentCP(&pszSemName, semName); + key_t key = ::ftok(pszSemName, 'V'); + RTStrFree(pszSemName); - mIPCSem = ::semget (key, 1, S_IRWXU | S_IRWXG | S_IRWXO | IPC_CREAT); + mIPCSem = ::semget(key, 1, S_IRWXU | S_IRWXG | S_IRWXO | IPC_CREAT); # endif /* !VBOX_WITH_NEW_SYS_V_KEYGEN */ int errnoSave = errno; @@ -8628,12 +8635,12 @@ HRESULT SessionMachine::init (Machine *aMachine) #endif return E_FAIL; } - ComAssertMsgRet (mIPCSem >= 0, ("Cannot create IPC semaphore, errno=%d", errnoSave), - E_FAIL); + ComAssertMsgRet(mIPCSem >= 0, ("Cannot create IPC semaphore, errno=%d", errnoSave), + E_FAIL); /* set the initial value to 1 */ - int rv = ::semctl (mIPCSem, 0, SETVAL, 1); - ComAssertMsgRet (rv == 0, ("Cannot init IPC semaphore, errno=%d", errno), - E_FAIL); + int rv = ::semctl(mIPCSem, 0, SETVAL, 1); + ComAssertMsgRet(rv == 0, ("Cannot init IPC semaphore, errno=%d", errno), + E_FAIL); #else # error "Port me!" #endif @@ -8644,11 +8651,11 @@ HRESULT SessionMachine::init (Machine *aMachine) unconst(mParent) = aMachine->mParent; /* take the pointers to data to share */ - mData.share (aMachine->mData); - mSSData.share (aMachine->mSSData); + mData.share(aMachine->mData); + mSSData.share(aMachine->mSSData); - mUserData.share (aMachine->mUserData); - mHWData.share (aMachine->mHWData); + mUserData.share(aMachine->mUserData); + mHWData.share(aMachine->mHWData); mMediaData.share(aMachine->mMediaData); mStorageControllers.allocate(); @@ -8659,30 +8666,30 @@ HRESULT SessionMachine::init (Machine *aMachine) ComObjPtr<StorageController> ctl; ctl.createObject(); ctl->init(this, *it); - mStorageControllers->push_back (ctl); + mStorageControllers->push_back(ctl); } unconst(mBIOSSettings).createObject(); - mBIOSSettings->init (this, aMachine->mBIOSSettings); + mBIOSSettings->init(this, aMachine->mBIOSSettings); #ifdef VBOX_WITH_VRDP /* create another VRDPServer object that will be mutable */ unconst(mVRDPServer).createObject(); - mVRDPServer->init (this, aMachine->mVRDPServer); + mVRDPServer->init(this, aMachine->mVRDPServer); #endif /* create another audio adapter object that will be mutable */ unconst(mAudioAdapter).createObject(); - mAudioAdapter->init (this, aMachine->mAudioAdapter); + mAudioAdapter->init(this, aMachine->mAudioAdapter); /* create a list of serial ports that will be mutable */ - for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) { - unconst(mSerialPorts [slot]).createObject(); - mSerialPorts [slot]->init (this, aMachine->mSerialPorts [slot]); + unconst(mSerialPorts[slot]).createObject(); + mSerialPorts[slot]->init(this, aMachine->mSerialPorts[slot]); } /* create a list of parallel ports that will be mutable */ - for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) { - unconst(mParallelPorts [slot]).createObject(); - mParallelPorts [slot]->init (this, aMachine->mParallelPorts [slot]); + unconst(mParallelPorts[slot]).createObject(); + mParallelPorts[slot]->init(this, aMachine->mParallelPorts[slot]); } /* create another USB controller object that will be mutable */ unconst(mUSBController).createObject(); @@ -8691,8 +8698,8 @@ HRESULT SessionMachine::init (Machine *aMachine) /* create a list of network adapters that will be mutable */ for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) { - unconst(mNetworkAdapters [slot]).createObject(); - mNetworkAdapters[slot]->init (this, aMachine->mNetworkAdapters [slot]); + unconst(mNetworkAdapters[slot]).createObject(); + mNetworkAdapters[slot]->init(this, aMachine->mNetworkAdapters[slot]); } /* default is to delete saved state on Saved -> PoweredOff transition */ @@ -8713,7 +8720,7 @@ HRESULT SessionMachine::init (Machine *aMachine) * * @note Locks mParent + this object for writing. */ -void SessionMachine::uninit (Uninit::Reason aReason) +void SessionMachine::uninit(Uninit::Reason aReason) { LogFlowThisFuncEnter(); LogFlowThisFunc(("reason=%d\n", aReason)); @@ -8745,15 +8752,15 @@ void SessionMachine::uninit (Uninit::Reason aReason) LogFlowThisFunc(("Initialization failed.\n")); #if defined(RT_OS_WINDOWS) if (mIPCSem) - ::CloseHandle (mIPCSem); + ::CloseHandle(mIPCSem); mIPCSem = NULL; #elif defined(RT_OS_OS2) if (mIPCSem != NULLHANDLE) - ::DosCloseMutexSem (mIPCSem); + ::DosCloseMutexSem(mIPCSem); mIPCSem = NULLHANDLE; #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) if (mIPCSem >= 0) - ::semctl (mIPCSem, 0, IPC_RMID); + ::semctl(mIPCSem, 0, IPC_RMID); mIPCSem = -1; # ifdef VBOX_WITH_NEW_SYS_V_KEYGEN mIPCKey = "0"; @@ -8784,7 +8791,7 @@ void SessionMachine::uninit (Uninit::Reason aReason) if (aReason == Uninit::Abnormal) { LogWarningThisFunc(("ABNORMAL client termination! (wasBusy=%d)\n", - Global::IsOnlineOrTransient (lastState))); + Global::IsOnlineOrTransient(lastState))); /* reset the state to Aborted */ if (mData->mMachineState != MachineState_Aborted) @@ -8795,7 +8802,7 @@ void SessionMachine::uninit (Uninit::Reason aReason) if (m_flModifications) { LogWarningThisFunc(("Discarding unsaved settings changes!\n")); - rollback (false /* aNotify */); + rollback(false /* aNotify */); } Assert(mSnapshotData.mStateFilePath.isEmpty() || !mSnapshotData.mSnapshot); @@ -8820,7 +8827,7 @@ void SessionMachine::uninit (Uninit::Reason aReason) #ifdef VBOX_WITH_USB /* release all captured USB devices */ - if (aReason == Uninit::Abnormal && Global::IsOnline (lastState)) + if (aReason == Uninit::Abnormal && Global::IsOnline(lastState)) { /* Console::captureUSBDevices() is called in the VM process only after * setting the machine state to Starting or Restoring. @@ -8830,13 +8837,13 @@ void SessionMachine::uninit (Uninit::Reason aReason) * * This is identical to SessionMachine::DetachAllUSBDevices except * for the aAbnormal argument. */ - HRESULT rc = mUSBController->notifyProxy (false /* aInsertFilters */); + HRESULT rc = mUSBController->notifyProxy(false /* aInsertFilters */); AssertComRC(rc); - NOREF (rc); + NOREF(rc); USBProxyService *service = mParent->host()->usbProxyService(); if (service) - service->detachAllDevicesFromVM (this, true /* aDone */, true /* aAbnormal */); + service->detachAllDevicesFromVM(this, true /* aDone */, true /* aAbnormal */); } #endif /* VBOX_WITH_USB */ @@ -8846,8 +8853,8 @@ void SessionMachine::uninit (Uninit::Reason aReason) * VirtualBox::OpenRemoteSession(), therefore it is our child. We * need to queue the PID to reap the process (and avoid zombies on * Linux). */ - Assert (mData->mSession.mPid != NIL_RTPROCESS); - mParent->addProcessToReap (mData->mSession.mPid); + Assert(mData->mSession.mPid != NIL_RTPROCESS); + mParent->addProcessToReap(mData->mSession.mPid); } mData->mSession.mPid = NIL_RTPROCESS; @@ -8873,7 +8880,7 @@ void SessionMachine::uninit (Uninit::Reason aReason) LogFlowThisFunc((" Calling remoteControl->Uninitialize()...\n")); HRESULT rc = (*it)->Uninitialize(); LogFlowThisFunc((" remoteControl->Uninitialize() returned %08X\n", rc)); - if (FAILED (rc)) + if (FAILED(rc)) LogWarningThisFunc(("Forgot to close the remote session?\n")); ++it; } @@ -8902,17 +8909,17 @@ void SessionMachine::uninit (Uninit::Reason aReason) else { /* this must be null here (see #OnSessionEnd()) */ - Assert (mData->mSession.mDirectControl.isNull()); - Assert (mData->mSession.mState == SessionState_Closing); - Assert (!mData->mSession.mProgress.isNull()); + Assert(mData->mSession.mDirectControl.isNull()); + Assert(mData->mSession.mState == SessionState_Closing); + Assert(!mData->mSession.mProgress.isNull()); mData->mSession.mProgress->notifyComplete (S_OK); mData->mSession.mProgress.setNull(); } /* remove the association between the peer machine and this session machine */ - Assert (mData->mSession.mMachine == this || - aReason == Uninit::Unexpected); + Assert(mData->mSession.mMachine == this || + aReason == Uninit::Unexpected); /* reset the rest of session data */ mData->mSession.mMachine.setNull(); @@ -9191,7 +9198,7 @@ STDMETHODIMP SessionMachine::OnSessionEnd (ISession *aSession, /* go to the closing state (essential for all open*Session() calls and * for #checkForDeath()) */ - Assert (mData->mSession.mState == SessionState_Open); + Assert(mData->mSession.mState == SessionState_Open); mData->mSession.mState = SessionState_Closing; /* set direct control to NULL to release the remote instance */ @@ -10196,7 +10203,7 @@ void SessionMachine::unlockMedia() /* The second can happen if an object was re-locked in * Machine::fixupMedia(). The last can happen when e.g a DVD/Floppy * image was unmounted at runtime. */ - Assert (SUCCEEDED(rc) || state == MediumState_LockedRead || state == MediumState_Created); + Assert(SUCCEEDED(rc) || state == MediumState_LockedRead || state == MediumState_Created); } mData->mSession.mLockedMedia.clear(); diff --git a/src/VBox/Main/Matching.cpp b/src/VBox/Main/Matching.cpp index 5818e5785ef..2569e53c1a2 100644 --- a/src/VBox/Main/Matching.cpp +++ b/src/VBox/Main/Matching.cpp @@ -54,10 +54,10 @@ void ParsedIntervalFilter_base::parse (const char *aFilter, do { - end = strcspn (aFilter + start, ",-"); + end = strcspn(aFilter + start, ",-"); end += start; - char delim = aFilter [end]; + char delim = aFilter[end]; if (delim == '-') { @@ -72,12 +72,12 @@ void ParsedIntervalFilter_base::parse (const char *aFilter, // skip spaces around numbers size_t s = start; - while (s < end && aFilter [s] == ' ') ++ s; + while (s < end && aFilter[s] == ' ') ++s; size_t e = end - 1; - while (e > s && aFilter [e] == ' ') -- e; - ++ e; + while (e > s && aFilter[e] == ' ') --e; + ++e; - that->parseValue (aFilter, s, e, mode); + that->parseValue(aFilter, s, e, mode); if (!that->mValid) return; diff --git a/src/VBox/Main/MediumFormatImpl.cpp b/src/VBox/Main/MediumFormatImpl.cpp index 58a27c4a703..f6439ff3893 100644 --- a/src/VBox/Main/MediumFormatImpl.cpp +++ b/src/VBox/Main/MediumFormatImpl.cpp @@ -197,22 +197,22 @@ STDMETHODIMP MediumFormat::COMGETTER(Name)(BSTR *aName) return S_OK; } -STDMETHODIMP MediumFormat:: -COMGETTER(FileExtensions)(ComSafeArrayOut (BSTR, aFileExtensions)) +STDMETHODIMP MediumFormat::COMGETTER(FileExtensions)(ComSafeArrayOut(BSTR, aFileExtensions)) { - if (ComSafeArrayOutIsNull (aFileExtensions)) + if (ComSafeArrayOutIsNull(aFileExtensions)) return E_POINTER; AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); /* this is const, no need to lock */ - com::SafeArray <BSTR> fileExtentions (m.fileExtensions.size()); + com::SafeArray<BSTR> fileExtentions(m.fileExtensions.size()); int i = 0; for (BstrList::const_iterator it = m.fileExtensions.begin(); - it != m.fileExtensions.end(); ++ it, ++ i) - (*it).cloneTo (&fileExtentions [i]); - fileExtentions.detachTo (ComSafeArrayOutArg (aFileExtensions)); + it != m.fileExtensions.end(); + ++it, ++i) + (*it).cloneTo(&fileExtentions[i]); + fileExtentions.detachTo(ComSafeArrayOutArg(aFileExtensions)); return S_OK; } @@ -253,29 +253,30 @@ STDMETHODIMP MediumFormat::DescribeProperties(ComSafeArrayOut (BSTR, aNames), if (FAILED(autoCaller.rc())) return autoCaller.rc(); /* this is const, no need to lock */ - com::SafeArray <BSTR> propertyNames (m.properties.size()); - com::SafeArray <BSTR> propertyDescriptions (m.properties.size()); - com::SafeArray <DataType_T> propertyTypes (m.properties.size()); - com::SafeArray <ULONG> propertyFlags (m.properties.size()); - com::SafeArray <BSTR> propertyDefaults (m.properties.size()); + com::SafeArray<BSTR> propertyNames(m.properties.size()); + com::SafeArray<BSTR> propertyDescriptions (m.properties.size()); + com::SafeArray<DataType_T> propertyTypes(m.properties.size()); + com::SafeArray<ULONG> propertyFlags(m.properties.size()); + com::SafeArray<BSTR> propertyDefaults(m.properties.size()); int i = 0; for (PropertyList::const_iterator it = m.properties.begin(); - it != m.properties.end(); ++ it, ++ i) + it != m.properties.end(); + ++it, ++i) { const Property &prop = (*it); - prop.name.cloneTo (&propertyNames [i]); - prop.description.cloneTo (&propertyDescriptions [i]); - propertyTypes [i] = prop.type; - propertyFlags [i] = prop.flags; - prop.defaultValue.cloneTo (&propertyDefaults [i]); + prop.name.cloneTo(&propertyNames[i]); + prop.description.cloneTo(&propertyDescriptions[i]); + propertyTypes[i] = prop.type; + propertyFlags[i] = prop.flags; + prop.defaultValue.cloneTo(&propertyDefaults[i]); } - propertyNames.detachTo (ComSafeArrayOutArg (aNames)); - propertyDescriptions.detachTo (ComSafeArrayOutArg (aDescriptions)); - propertyTypes.detachTo (ComSafeArrayOutArg (aTypes)); - propertyFlags.detachTo (ComSafeArrayOutArg (aFlags)); - propertyDefaults.detachTo (ComSafeArrayOutArg (aDefaults)); + propertyNames.detachTo(ComSafeArrayOutArg(aNames)); + propertyDescriptions.detachTo(ComSafeArrayOutArg(aDescriptions)); + propertyTypes.detachTo(ComSafeArrayOutArg(aTypes)); + propertyFlags.detachTo(ComSafeArrayOutArg(aFlags)); + propertyDefaults.detachTo(ComSafeArrayOutArg(aDefaults)); return S_OK; } diff --git a/src/VBox/Main/MediumImpl.cpp b/src/VBox/Main/MediumImpl.cpp index 7c22e8029d1..06edf280a0e 100644 --- a/src/VBox/Main/MediumImpl.cpp +++ b/src/VBox/Main/MediumImpl.cpp @@ -1752,7 +1752,7 @@ STDMETHODIMP Medium::COMGETTER(MachineIds)(ComSafeArrayOut(BSTR,aMachineIds)) for (BackRefList::const_iterator it = m->backRefs.begin(); it != m->backRefs.end(); ++ it, ++ i) { - it->machineId.toUtf16().detachTo(&machineIds [i]); + it->machineId.toUtf16().detachTo(&machineIds[i]); } } @@ -2169,9 +2169,9 @@ STDMETHODIMP Medium::GetProperties(IN_BSTR aNames, { it->first.cloneTo(&names[i]); if (it->second.isEmpty()) - Bstr("").cloneTo(&values [i]); + Bstr("").cloneTo(&values[i]); else - it->second.cloneTo(&values [i]); + it->second.cloneTo(&values[i]); ++ i; } @@ -2217,7 +2217,7 @@ STDMETHODIMP Medium::SetProperties(ComSafeArrayIn(IN_BSTR, aNames), if (values[i] && !*values[i]) it->second = (const char *)NULL; else - it->second = values [i]; + it->second = values[i]; } HRESULT rc = m->pVirtualBox->saveSettings(); @@ -2607,7 +2607,7 @@ STDMETHODIMP Medium::Reset(IProgress **aProgress) rc = aRC; } - if (FAILED (rc)) + if (FAILED(rc)) { HRESULT rc2 = UnlockWrite(NULL); AssertComRC(rc2); diff --git a/src/VBox/Main/MouseImpl.cpp b/src/VBox/Main/MouseImpl.cpp index bd63c7de1c3..cc379df4783 100644 --- a/src/VBox/Main/MouseImpl.cpp +++ b/src/VBox/Main/MouseImpl.cpp @@ -239,9 +239,9 @@ STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw, LONG butto int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, dx, dy, dz, dw, fButtons); if (RT_FAILURE(vrc)) - rc = setError (VBOX_E_IPRT_ERROR, - tr ("Could not send the mouse event to the virtual mouse (%Rrc)"), - vrc); + rc = setError(VBOX_E_IPRT_ERROR, + tr("Could not send the mouse event to the virtual mouse (%Rrc)"), + vrc); return rc; } @@ -341,9 +341,9 @@ STDMETHODIMP Mouse::PutMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw, mLastAbsX = mouseXAbs; mLastAbsY = mouseYAbs; if (RT_FAILURE(vrc)) - rc = setError (VBOX_E_IPRT_ERROR, - tr ("Could not send the mouse event to the virtual mouse (%Rrc)"), - vrc); + rc = setError(VBOX_E_IPRT_ERROR, + tr("Could not send the mouse event to the virtual mouse (%Rrc)"), + vrc); } return rc; diff --git a/src/VBox/Main/NetworkAdapterImpl.cpp b/src/VBox/Main/NetworkAdapterImpl.cpp index 0fca8e49b9a..8455ca3a7de 100644 --- a/src/VBox/Main/NetworkAdapterImpl.cpp +++ b/src/VBox/Main/NetworkAdapterImpl.cpp @@ -220,9 +220,9 @@ STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType) (NetworkAdapterType_T aAdapt #endif /* VBOX_WITH_VIRTIO */ break; default: - return setError (E_FAIL, - tr("Invalid network adapter type '%d'"), - aAdapterType); + return setError(E_FAIL, + tr("Invalid network adapter type '%d'"), + aAdapterType); } if (mData->mAdapterType != aAdapterType) @@ -238,7 +238,7 @@ STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType) (NetworkAdapterType_T aAdapt mParent->setModified(Machine::IsModified_NetworkAdapters); mlock.release(); - mParent->onNetworkAdapterChange (this, FALSE); + mParent->onNetworkAdapterChange(this, FALSE); } return S_OK; @@ -296,7 +296,7 @@ STDMETHODIMP NetworkAdapter::COMSETTER(Enabled) (BOOL aEnabled) mParent->setModified(Machine::IsModified_NetworkAdapters); mlock.release(); - mParent->onNetworkAdapterChange (this, FALSE); + mParent->onNetworkAdapterChange(this, FALSE); } return S_OK; @@ -407,7 +407,7 @@ STDMETHODIMP NetworkAdapter::COMSETTER(MACAddress)(IN_BSTR aMACAddress) // we have left the lock in any case at this point if (emitChangeEvent) - mParent->onNetworkAdapterChange (this, FALSE); + mParent->onNetworkAdapterChange(this, FALSE); return rc; } @@ -507,8 +507,8 @@ STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork) (IN_BSTR aInternalNetwor if ( (aInternalNetwork == NULL || *aInternalNetwork == '\0') && mData->mAttachmentType == NetworkAttachmentType_Internal) { - return setError (E_FAIL, - tr ("Empty or null internal network name is not valid")); + return setError(E_FAIL, + tr("Empty or null internal network name is not valid")); } mData.backup(); @@ -783,8 +783,8 @@ STDMETHODIMP NetworkAdapter::AttachToNAT() mParent->setModified(Machine::IsModified_NetworkAdapters); mlock.release(); - HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE); - if (FAILED (rc)) + HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); + if (FAILED(rc)) { /* If changing the attachment failed then we can't assume * that the previous attachment will attach correctly @@ -830,8 +830,8 @@ STDMETHODIMP NetworkAdapter::AttachToBridgedInterface() mParent->setModified(Machine::IsModified_NetworkAdapters); mlock.release(); - HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE); - if (FAILED (rc)) + HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); + if (FAILED(rc)) { /* If changing the attachment failed then we can't assume * that the previous attachment will attach correctly @@ -885,8 +885,8 @@ STDMETHODIMP NetworkAdapter::AttachToInternalNetwork() mParent->setModified(Machine::IsModified_NetworkAdapters); mlock.release(); - HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE); - if (FAILED (rc)) + HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); + if (FAILED(rc)) { /* If changing the attachment failed then we can't assume * that the previous attachment will attach correctly @@ -932,8 +932,8 @@ STDMETHODIMP NetworkAdapter::AttachToHostOnlyInterface() mParent->setModified(Machine::IsModified_NetworkAdapters); mlock.release(); - HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE); - if (FAILED (rc)) + HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); + if (FAILED(rc)) { /* If changing the attachment failed then we can't assume * that the previous attachment will attach correctly @@ -973,7 +973,7 @@ STDMETHODIMP NetworkAdapter::Detach() mParent->setModified(Machine::IsModified_NetworkAdapters); mlock.release(); - mParent->onNetworkAdapterChange (this, TRUE); + mParent->onNetworkAdapterChange(this, TRUE); } return S_OK; diff --git a/src/VBox/Main/ParallelPortImpl.cpp b/src/VBox/Main/ParallelPortImpl.cpp index 31ec9806eac..fa81b539efe 100644 --- a/src/VBox/Main/ParallelPortImpl.cpp +++ b/src/VBox/Main/ParallelPortImpl.cpp @@ -226,10 +226,9 @@ STDMETHODIMP ParallelPort::COMSETTER(Enabled) (BOOL aEnabled) { if (aEnabled && m->bd->strPath.isEmpty()) - return setError (E_INVALIDARG, - tr ("Cannot enable the parallel port %d " - "because the port path is empty or null"), - m->bd->ulSlot); + return setError(E_INVALIDARG, + tr("Cannot enable the parallel port %d because the port path is empty or null"), + m->bd->ulSlot); m->bd.backup(); m->bd->fEnabled = aEnabled; @@ -281,10 +280,9 @@ STDMETHODIMP ParallelPort::COMSETTER(IRQ)(ULONG aIRQ) /* check IRQ limits * (when changing this, make sure it corresponds to XML schema */ if (aIRQ > 255) - return setError (E_INVALIDARG, - tr ("Invalid IRQ number of the parallel port %d: " - "%lu (must be in range [0, %lu])"), - m->bd->ulSlot, aIRQ, 255); + return setError(E_INVALIDARG, + tr("Invalid IRQ number of the parallel port %d: %lu (must be in range [0, %lu])"), + m->bd->ulSlot, aIRQ, 255); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); @@ -333,10 +331,9 @@ STDMETHODIMP ParallelPort::COMSETTER(IOBase)(ULONG aIOBase) /* check IOBase limits * (when changing this, make sure it corresponds to XML schema */ if (aIOBase > 0xFFFF) - return setError (E_INVALIDARG, - tr ("Invalid I/O port base address of the parallel port %d: " - "%lu (must be in range [0, 0x%X])"), - m->bd->ulSlot, aIOBase, 0, 0xFFFF); + return setError(E_INVALIDARG, + tr("Invalid I/O port base address of the parallel port %d: %lu (must be in range [0, 0x%X])"), + m->bd->ulSlot, aIOBase, 0, 0xFFFF); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); diff --git a/src/VBox/Main/PerformanceImpl.cpp b/src/VBox/Main/PerformanceImpl.cpp index f0d32f6f47b..0186f45a81b 100644 --- a/src/VBox/Main/PerformanceImpl.cpp +++ b/src/VBox/Main/PerformanceImpl.cpp @@ -167,8 +167,7 @@ void PerformanceCollector::uninit() // IPerformanceCollector properties //////////////////////////////////////////////////////////////////////////////// -STDMETHODIMP -PerformanceCollector::COMGETTER(MetricNames) (ComSafeArrayOut(BSTR, theMetricNames)) +STDMETHODIMP PerformanceCollector::COMGETTER(MetricNames)(ComSafeArrayOut(BSTR, theMetricNames)) { if (ComSafeArrayOutIsNull(theMetricNames)) return E_POINTER; @@ -215,10 +214,9 @@ HRESULT PerformanceCollector::toIPerformanceMetric(pm::BaseMetric *src, IPerform return rc; } -STDMETHODIMP -PerformanceCollector::GetMetrics (ComSafeArrayIn (IN_BSTR, metricNames), - ComSafeArrayIn (IUnknown *, objects), - ComSafeArrayOut(IPerformanceMetric *, outMetrics)) +STDMETHODIMP PerformanceCollector::GetMetrics(ComSafeArrayIn(IN_BSTR, metricNames), + ComSafeArrayIn(IUnknown *, objects), + ComSafeArrayOut(IPerformanceMetric *, outMetrics)) { LogFlowThisFuncEnter(); //LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType)); @@ -250,25 +248,24 @@ PerformanceCollector::GetMetrics (ComSafeArrayIn (IN_BSTR, metricNames), AssertComRCReturnRC(rc); LogFlow (("PerformanceCollector::GetMetrics() store a metric at " "retMetrics[%d]...\n", i)); - metric.queryInterfaceTo(&retMetrics [i++]); + metric.queryInterfaceTo(&retMetrics[i++]); } retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); LogFlowThisFuncLeave(); return rc; } -STDMETHODIMP -PerformanceCollector::SetupMetrics (ComSafeArrayIn (IN_BSTR, metricNames), - ComSafeArrayIn (IUnknown *, objects), - ULONG aPeriod, ULONG aCount, - ComSafeArrayOut(IPerformanceMetric *, - outMetrics)) +STDMETHODIMP PerformanceCollector::SetupMetrics(ComSafeArrayIn(IN_BSTR, metricNames), + ComSafeArrayIn(IUnknown *, objects), + ULONG aPeriod, + ULONG aCount, + ComSafeArrayOut(IPerformanceMetric *, outMetrics)) { AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - pm::Filter filter (ComSafeArrayInArg (metricNames), - ComSafeArrayInArg (objects)); + pm::Filter filter(ComSafeArrayInArg (metricNames), + ComSafeArrayInArg (objects)); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -296,28 +293,26 @@ PerformanceCollector::SetupMetrics (ComSafeArrayIn (IN_BSTR, metricNames), filteredMetrics.push_back(*it); } - com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size()); + com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size()); int i = 0; for (it = filteredMetrics.begin(); it != filteredMetrics.end() && SUCCEEDED(rc); ++it) - rc = toIPerformanceMetric(*it, &retMetrics [i++]); + rc = toIPerformanceMetric(*it, &retMetrics[i++]); retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); LogFlowThisFuncLeave(); return rc; } -STDMETHODIMP -PerformanceCollector::EnableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), - ComSafeArrayIn (IUnknown *, objects), - ComSafeArrayOut(IPerformanceMetric *, - outMetrics)) +STDMETHODIMP PerformanceCollector::EnableMetrics(ComSafeArrayIn(IN_BSTR, metricNames), + ComSafeArrayIn(IUnknown *, objects), + ComSafeArrayOut(IPerformanceMetric *, outMetrics)) { AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - pm::Filter filter (ComSafeArrayInArg (metricNames), - ComSafeArrayInArg (objects)); + pm::Filter filter(ComSafeArrayInArg(metricNames), + ComSafeArrayInArg(objects)); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Write lock is not needed atm since we are */ /* fiddling with enable bit only, but we */ @@ -333,28 +328,26 @@ PerformanceCollector::EnableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), filteredMetrics.push_back(*it); } - com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size()); + com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size()); int i = 0; for (it = filteredMetrics.begin(); it != filteredMetrics.end() && SUCCEEDED(rc); ++it) - rc = toIPerformanceMetric(*it, &retMetrics [i++]); + rc = toIPerformanceMetric(*it, &retMetrics[i++]); retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); LogFlowThisFuncLeave(); return rc; } -STDMETHODIMP -PerformanceCollector::DisableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), - ComSafeArrayIn (IUnknown *, objects), - ComSafeArrayOut(IPerformanceMetric *, - outMetrics)) +STDMETHODIMP PerformanceCollector::DisableMetrics(ComSafeArrayIn(IN_BSTR, metricNames), + ComSafeArrayIn(IUnknown *, objects), + ComSafeArrayOut(IPerformanceMetric *, outMetrics)) { AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - pm::Filter filter (ComSafeArrayInArg (metricNames), - ComSafeArrayInArg (objects)); + pm::Filter filter(ComSafeArrayInArg(metricNames), + ComSafeArrayInArg(objects)); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Write lock is not needed atm since we are */ /* fiddling with enable bit only, but we */ @@ -370,34 +363,33 @@ PerformanceCollector::DisableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), filteredMetrics.push_back(*it); } - com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size()); + com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size()); int i = 0; for (it = filteredMetrics.begin(); it != filteredMetrics.end() && SUCCEEDED(rc); ++it) - rc = toIPerformanceMetric(*it, &retMetrics [i++]); + rc = toIPerformanceMetric(*it, &retMetrics[i++]); retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); LogFlowThisFuncLeave(); return rc; } -STDMETHODIMP -PerformanceCollector::QueryMetricsData (ComSafeArrayIn (IN_BSTR, metricNames), - ComSafeArrayIn (IUnknown *, objects), - ComSafeArrayOut(BSTR, outMetricNames), - ComSafeArrayOut(IUnknown *, outObjects), - ComSafeArrayOut(BSTR, outUnits), - ComSafeArrayOut(ULONG, outScales), - ComSafeArrayOut(ULONG, outSequenceNumbers), - ComSafeArrayOut(ULONG, outDataIndices), - ComSafeArrayOut(ULONG, outDataLengths), - ComSafeArrayOut(LONG, outData)) +STDMETHODIMP PerformanceCollector::QueryMetricsData(ComSafeArrayIn (IN_BSTR, metricNames), + ComSafeArrayIn (IUnknown *, objects), + ComSafeArrayOut(BSTR, outMetricNames), + ComSafeArrayOut(IUnknown *, outObjects), + ComSafeArrayOut(BSTR, outUnits), + ComSafeArrayOut(ULONG, outScales), + ComSafeArrayOut(ULONG, outSequenceNumbers), + ComSafeArrayOut(ULONG, outDataIndices), + ComSafeArrayOut(ULONG, outDataLengths), + ComSafeArrayOut(LONG, outData)) { AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - pm::Filter filter (ComSafeArrayInArg (metricNames), - ComSafeArrayInArg (objects)); + pm::Filter filter(ComSafeArrayInArg(metricNames), + ComSafeArrayInArg(objects)); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -415,14 +407,14 @@ PerformanceCollector::QueryMetricsData (ComSafeArrayIn (IN_BSTR, metricNames), int i = 0; size_t flatIndex = 0; size_t numberOfMetrics = filteredMetrics.size(); - com::SafeArray<BSTR> retNames (numberOfMetrics); - com::SafeIfaceArray<IUnknown> retObjects (numberOfMetrics); - com::SafeArray<BSTR> retUnits (numberOfMetrics); - com::SafeArray<ULONG> retScales (numberOfMetrics); - com::SafeArray<ULONG> retSequenceNumbers (numberOfMetrics); - com::SafeArray<ULONG> retIndices (numberOfMetrics); - com::SafeArray<ULONG> retLengths (numberOfMetrics); - com::SafeArray<LONG> retData (flatSize); + com::SafeArray<BSTR> retNames(numberOfMetrics); + com::SafeIfaceArray<IUnknown> retObjects(numberOfMetrics); + com::SafeArray<BSTR> retUnits(numberOfMetrics); + com::SafeArray<ULONG> retScales(numberOfMetrics); + com::SafeArray<ULONG> retSequenceNumbers(numberOfMetrics); + com::SafeArray<ULONG> retIndices(numberOfMetrics); + com::SafeArray<ULONG> retLengths(numberOfMetrics); + com::SafeArray<LONG> retData(flatSize); for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it, ++i) { @@ -458,7 +450,7 @@ PerformanceCollector::QueryMetricsData (ComSafeArrayIn (IN_BSTR, metricNames), // public methods for internal purposes /////////////////////////////////////////////////////////////////////////////// -void PerformanceCollector::registerBaseMetric (pm::BaseMetric *baseMetric) +void PerformanceCollector::registerBaseMetric(pm::BaseMetric *baseMetric) { //LogFlowThisFuncEnter(); AutoCaller autoCaller(this); @@ -470,7 +462,7 @@ void PerformanceCollector::registerBaseMetric (pm::BaseMetric *baseMetric) //LogFlowThisFuncLeave(); } -void PerformanceCollector::registerMetric (pm::Metric *metric) +void PerformanceCollector::registerMetric(pm::Metric *metric) { //LogFlowThisFuncEnter(); AutoCaller autoCaller(this); @@ -482,7 +474,7 @@ void PerformanceCollector::registerMetric (pm::Metric *metric) //LogFlowThisFuncLeave(); } -void PerformanceCollector::unregisterBaseMetricsFor (const ComPtr<IUnknown> &aObject) +void PerformanceCollector::unregisterBaseMetricsFor(const ComPtr<IUnknown> &aObject) { //LogFlowThisFuncEnter(); AutoCaller autoCaller(this); @@ -503,7 +495,7 @@ void PerformanceCollector::unregisterBaseMetricsFor (const ComPtr<IUnknown> &aOb //LogFlowThisFuncLeave(); } -void PerformanceCollector::unregisterMetricsFor (const ComPtr<IUnknown> &aObject) +void PerformanceCollector::unregisterMetricsFor(const ComPtr<IUnknown> &aObject) { //LogFlowThisFuncEnter(); AutoCaller autoCaller(this); @@ -546,12 +538,12 @@ void PerformanceCollector::resumeSampling() /////////////////////////////////////////////////////////////////////////////// /* static */ -void PerformanceCollector::staticSamplerCallback (RTTIMERLR hTimerLR, void *pvUser, - uint64_t /* iTick */) +void PerformanceCollector::staticSamplerCallback(RTTIMERLR hTimerLR, void *pvUser, + uint64_t /* iTick */) { AssertReturnVoid (pvUser != NULL); PerformanceCollector *collector = static_cast <PerformanceCollector *> (pvUser); - Assert (collector->mMagic == MAGIC); + Assert(collector->mMagic == MAGIC); if (collector->mMagic == MAGIC) { collector->samplerCallback(); @@ -620,7 +612,7 @@ void PerformanceMetric::FinalRelease() // public initializer/uninitializer for internal purposes only //////////////////////////////////////////////////////////////////////////////// -HRESULT PerformanceMetric::init (pm::Metric *aMetric) +HRESULT PerformanceMetric::init(pm::Metric *aMetric) { m.name = aMetric->getName(); m.object = aMetric->getObject(); @@ -633,7 +625,7 @@ HRESULT PerformanceMetric::init (pm::Metric *aMetric) return S_OK; } -HRESULT PerformanceMetric::init (pm::BaseMetric *aMetric) +HRESULT PerformanceMetric::init(pm::BaseMetric *aMetric) { m.name = aMetric->getName(); m.object = aMetric->getObject(); @@ -650,7 +642,7 @@ void PerformanceMetric::uninit() { } -STDMETHODIMP PerformanceMetric::COMGETTER(MetricName) (BSTR *aMetricName) +STDMETHODIMP PerformanceMetric::COMGETTER(MetricName)(BSTR *aMetricName) { /// @todo (r=dmik) why do all these getters not do AutoCaller and /// AutoReadLock? Is the underlying metric a constant object? @@ -659,43 +651,43 @@ STDMETHODIMP PerformanceMetric::COMGETTER(MetricName) (BSTR *aMetricName) return S_OK; } -STDMETHODIMP PerformanceMetric::COMGETTER(Object) (IUnknown **anObject) +STDMETHODIMP PerformanceMetric::COMGETTER(Object)(IUnknown **anObject) { m.object.queryInterfaceTo(anObject); return S_OK; } -STDMETHODIMP PerformanceMetric::COMGETTER(Description) (BSTR *aDescription) +STDMETHODIMP PerformanceMetric::COMGETTER(Description)(BSTR *aDescription) { m.description.cloneTo(aDescription); return S_OK; } -STDMETHODIMP PerformanceMetric::COMGETTER(Period) (ULONG *aPeriod) +STDMETHODIMP PerformanceMetric::COMGETTER(Period)(ULONG *aPeriod) { *aPeriod = m.period; return S_OK; } -STDMETHODIMP PerformanceMetric::COMGETTER(Count) (ULONG *aCount) +STDMETHODIMP PerformanceMetric::COMGETTER(Count)(ULONG *aCount) { *aCount = m.count; return S_OK; } -STDMETHODIMP PerformanceMetric::COMGETTER(Unit) (BSTR *aUnit) +STDMETHODIMP PerformanceMetric::COMGETTER(Unit)(BSTR *aUnit) { m.unit.cloneTo(aUnit); return S_OK; } -STDMETHODIMP PerformanceMetric::COMGETTER(MinimumValue) (LONG *aMinValue) +STDMETHODIMP PerformanceMetric::COMGETTER(MinimumValue)(LONG *aMinValue) { *aMinValue = m.min; return S_OK; } -STDMETHODIMP PerformanceMetric::COMGETTER(MaximumValue) (LONG *aMaxValue) +STDMETHODIMP PerformanceMetric::COMGETTER(MaximumValue)(LONG *aMaxValue) { *aMaxValue = m.max; return S_OK; diff --git a/src/VBox/Main/ProgressImpl.cpp b/src/VBox/Main/ProgressImpl.cpp index 02ecb76da0f..acbf20a6451 100644 --- a/src/VBox/Main/ProgressImpl.cpp +++ b/src/VBox/Main/ProgressImpl.cpp @@ -139,7 +139,7 @@ HRESULT ProgressBase::protectedInit (AutoInitSpan &aAutoInitSpan, #if !defined (VBOX_COM_INPROC) /* add to the global collection of progress operations (note: after * creating mId) */ - mParent->addProgress (this); + mParent->addProgress(this); #endif unconst(mDescription) = aDescription; @@ -401,8 +401,8 @@ STDMETHODIMP ProgressBase::COMGETTER(ResultCode) (LONG *aResultCode) AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); if (!mCompleted) - return setError (E_FAIL, - tr ("Result code is not available, operation is still in progress")); + return setError(E_FAIL, + tr("Result code is not available, operation is still in progress")); *aResultCode = mResultCode; @@ -419,8 +419,8 @@ STDMETHODIMP ProgressBase::COMGETTER(ErrorInfo) (IVirtualBoxErrorInfo **aErrorIn AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); if (!mCompleted) - return setError (E_FAIL, - tr ("Error info is not available, operation is still in progress")); + return setError(E_FAIL, + tr("Error info is not available, operation is still in progress")); mErrorInfo.queryInterfaceTo(aErrorInfo); @@ -1086,7 +1086,7 @@ HRESULT Progress::setResultCode(HRESULT aResultCode) /** * Marks the whole task as complete and sets the result code. * - * If the result code indicates a failure (|FAILED (@a aResultCode)|) then this + * If the result code indicates a failure (|FAILED(@a aResultCode)|) then this * method will import the error info from the current thread and assign it to * the errorInfo attribute (it will return an error if no info is available in * such case). @@ -1171,7 +1171,7 @@ HRESULT Progress::notifyComplete(HRESULT aResultCode, mCompleted = TRUE; mResultCode = aResultCode; - AssertReturn(FAILED (aResultCode), E_FAIL); + AssertReturn(FAILED(aResultCode), E_FAIL); ComObjPtr<VirtualBoxErrorInfo> errorInfo; HRESULT rc = errorInfo.createObject(); @@ -1285,8 +1285,7 @@ HRESULT CombinedProgress::protectedInit (AutoInitSpan &aAutoInitSpan, m_cOperations = 0; /* will be calculated later */ m_ulCurrentOperation = 0; - rc = mProgresses [0]->COMGETTER(OperationDescription) ( - m_bstrOperationDescription.asOutParam()); + rc = mProgresses[0]->COMGETTER(OperationDescription)(m_bstrOperationDescription.asOutParam()); if (FAILED(rc)) return rc; for (size_t i = 0; i < mProgresses.size(); i ++) @@ -1294,7 +1293,7 @@ HRESULT CombinedProgress::protectedInit (AutoInitSpan &aAutoInitSpan, if (mCancelable) { BOOL cancelable = FALSE; - rc = mProgresses [i]->COMGETTER(Cancelable) (&cancelable); + rc = mProgresses[i]->COMGETTER(Cancelable)(&cancelable); if (FAILED(rc)) return rc; if (!cancelable) @@ -1303,7 +1302,7 @@ HRESULT CombinedProgress::protectedInit (AutoInitSpan &aAutoInitSpan, { ULONG opCount = 0; - rc = mProgresses [i]->COMGETTER(OperationCount) (&opCount); + rc = mProgresses[i]->COMGETTER(OperationCount)(&opCount); if (FAILED(rc)) return rc; m_cOperations += opCount; @@ -1327,28 +1326,31 @@ HRESULT CombinedProgress::protectedInit (AutoInitSpan &aAutoInitSpan, * @param aProgress2 Second normal progress object. * @param aId See ProgressBase::init(). */ -HRESULT CombinedProgress::init ( +HRESULT CombinedProgress::init( #if !defined (VBOX_COM_INPROC) - VirtualBox *aParent, + VirtualBox *aParent, #endif - IUnknown *aInitiator, - CBSTR aDescription, - IProgress *aProgress1, IProgress *aProgress2, - OUT_GUID aId /* = NULL */) + IUnknown *aInitiator, + CBSTR aDescription, + IProgress *aProgress1, + IProgress *aProgress2, + OUT_GUID aId /* = NULL */) { /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); - mProgresses.resize (2); - mProgresses [0] = aProgress1; - mProgresses [1] = aProgress2; + mProgresses.resize(2); + mProgresses[0] = aProgress1; + mProgresses[1] = aProgress2; - HRESULT rc = protectedInit (autoInitSpan, + HRESULT rc = protectedInit(autoInitSpan, #if !defined (VBOX_COM_INPROC) - aParent, + aParent, #endif - aInitiator, aDescription, aId); + aInitiator, + aDescription, + aId); /* Confirm a successful initialization when it's the case */ if (SUCCEEDED(rc)) @@ -1607,8 +1609,8 @@ STDMETHODIMP CombinedProgress::WaitForOperationCompletion (ULONG aOperation, LON AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (aOperation >= m_cOperations) - return setError (E_FAIL, - tr ("Operation number must be in range [0, %d]"), m_ulCurrentOperation - 1); + return setError(E_FAIL, + tr("Operation number must be in range [0, %d]"), m_ulCurrentOperation - 1); /* if we're already completed or if the given operation is already done, * then take a shortcut */ @@ -1622,8 +1624,8 @@ STDMETHODIMP CombinedProgress::WaitForOperationCompletion (ULONG aOperation, LON do { ULONG opCount = 0; - rc = mProgresses [progress]->COMGETTER(OperationCount) (&opCount); - if (FAILED (rc)) + rc = mProgresses[progress]->COMGETTER(OperationCount)(&opCount); + if (FAILED(rc)) return rc; if (completedOps + opCount > aOperation) @@ -1687,7 +1689,7 @@ STDMETHODIMP CombinedProgress::Cancel() AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (!mCancelable) - return setError (E_FAIL, tr ("Operation cannot be canceled")); + return setError(E_FAIL, tr("Operation cannot be canceled")); if (!mCanceled) { @@ -1730,29 +1732,29 @@ HRESULT CombinedProgress::checkProgress() do { rc = progress->COMGETTER(Completed)(&fCompleted); - if (FAILED (rc)) + if (FAILED(rc)) return rc; if (fCompleted) { rc = progress->COMGETTER(Canceled)(&mCanceled); - if (FAILED (rc)) + if (FAILED(rc)) return rc; LONG iRc; rc = progress->COMGETTER(ResultCode)(&iRc); - if (FAILED (rc)) + if (FAILED(rc)) return rc; mResultCode = iRc; - if (FAILED (mResultCode)) + if (FAILED(mResultCode)) { rc = progress->COMGETTER(ErrorInfo) (mErrorInfo.asOutParam()); - if (FAILED (rc)) + if (FAILED(rc)) return rc; } - if (FAILED (mResultCode) || mCanceled) + if (FAILED(mResultCode) || mCanceled) { mCompleted = TRUE; } @@ -1760,14 +1762,14 @@ HRESULT CombinedProgress::checkProgress() { ULONG opCount = 0; rc = progress->COMGETTER(OperationCount) (&opCount); - if (FAILED (rc)) + if (FAILED(rc)) return rc; mCompletedOperations += opCount; mProgress ++; if (mProgress < mProgresses.size()) - progress = mProgresses [mProgress]; + progress = mProgresses[mProgress]; else mCompleted = TRUE; } diff --git a/src/VBox/Main/SerialPortImpl.cpp b/src/VBox/Main/SerialPortImpl.cpp index 33a9898e8c4..00aa301f18a 100644 --- a/src/VBox/Main/SerialPortImpl.cpp +++ b/src/VBox/Main/SerialPortImpl.cpp @@ -348,10 +348,9 @@ STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ) /* check IRQ limits * (when changing this, make sure it corresponds to XML schema */ if (aIRQ > 255) - return setError (E_INVALIDARG, - tr ("Invalid IRQ number of the serial port %d: " - "%lu (must be in range [0, %lu])"), - m->bd->ulSlot, aIRQ, 255); + return setError(E_INVALIDARG, + tr("Invalid IRQ number of the serial port %d: %lu (must be in range [0, %lu])"), + m->bd->ulSlot, aIRQ, 255); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); @@ -400,10 +399,9 @@ STDMETHODIMP SerialPort::COMSETTER(IOBase)(ULONG aIOBase) /* check IOBase limits * (when changing this, make sure it corresponds to XML schema */ if (aIOBase > 0xFFFF) - return setError (E_INVALIDARG, - tr ("Invalid I/O port base address of the serial port %d: " - "%lu (must be in range [0, 0x%X])"), - m->bd->ulSlot, aIOBase, 0, 0xFFFF); + return setError(E_INVALIDARG, + tr("Invalid I/O port base address of the serial port %d: %lu (must be in range [0, 0x%X])"), + m->bd->ulSlot, aIOBase, 0, 0xFFFF); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); diff --git a/src/VBox/Main/SessionImpl.cpp b/src/VBox/Main/SessionImpl.cpp index a71a8cb7f63..aa7b787ed37 100644 --- a/src/VBox/Main/SessionImpl.cpp +++ b/src/VBox/Main/SessionImpl.cpp @@ -39,7 +39,7 @@ #if defined(RT_OS_WINDOWS) || defined (RT_OS_OS2) /** VM IPC mutex holder thread */ -static DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser); +static DECLCALLBACK(int) IPCMutexHolderThread(RTTHREAD Thread, void *pvUser); #endif /** @@ -50,9 +50,7 @@ static DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser); #define CHECK_OPEN() \ do { \ if (mState != SessionState_Open) \ - return setError (E_UNEXPECTED, \ - tr ("The session is not open (session state: %s)"), \ - Global::stringifySessionState(mState)); \ + return setError(E_UNEXPECTED, tr ("The session is not open (session state: %s)"), Global::stringifySessionState(mState)); \ } while (0) // constructor / destructor @@ -69,7 +67,7 @@ void Session::FinalRelease() { LogFlowThisFunc(("\n")); - uninit (true /* aFinalRelease */); + uninit(true /* aFinalRelease */); } // public initializer/uninitializer for internal purposes only @@ -114,7 +112,7 @@ HRESULT Session::init() * * @note Locks this object for writing. */ -void Session::uninit (bool aFinalRelease) +void Session::uninit(bool aFinalRelease) { LogFlowThisFuncEnter(); LogFlowThisFunc(("aFinalRelease=%d\n", aFinalRelease)); @@ -133,11 +131,11 @@ void Session::uninit (bool aFinalRelease) if (mState != SessionState_Closed) { - Assert (mState == SessionState_Open || - mState == SessionState_Spawning); + Assert(mState == SessionState_Open || + mState == SessionState_Spawning); - HRESULT rc = close (aFinalRelease, false /* aFromServer */); - AssertComRC (rc); + HRESULT rc = close(aFinalRelease, false /* aFromServer */); + AssertComRC(rc); } LogFlowThisFuncLeave(); @@ -146,7 +144,7 @@ void Session::uninit (bool aFinalRelease) // ISession properties ///////////////////////////////////////////////////////////////////////////// -STDMETHODIMP Session::COMGETTER(State) (SessionState_T *aState) +STDMETHODIMP Session::COMGETTER(State)(SessionState_T *aState) { CheckComArgOutPointerValid(aState); @@ -160,7 +158,7 @@ STDMETHODIMP Session::COMGETTER(State) (SessionState_T *aState) return S_OK; } -STDMETHODIMP Session::COMGETTER(Type) (SessionType_T *aType) +STDMETHODIMP Session::COMGETTER(Type)(SessionType_T *aType) { CheckComArgOutPointerValid(aType); @@ -175,7 +173,7 @@ STDMETHODIMP Session::COMGETTER(Type) (SessionType_T *aType) return S_OK; } -STDMETHODIMP Session::COMGETTER(Machine) (IMachine **aMachine) +STDMETHODIMP Session::COMGETTER(Machine)(IMachine **aMachine) { CheckComArgOutPointerValid(aMachine); @@ -192,12 +190,12 @@ STDMETHODIMP Session::COMGETTER(Machine) (IMachine **aMachine) rc = mConsole->machine().queryInterfaceTo(aMachine); else rc = mRemoteMachine.queryInterfaceTo(aMachine); - ComAssertComRC (rc); + ComAssertComRC(rc); return rc; } -STDMETHODIMP Session::COMGETTER(Console) (IConsole **aConsole) +STDMETHODIMP Session::COMGETTER(Console)(IConsole **aConsole) { CheckComArgOutPointerValid(aConsole); @@ -214,7 +212,7 @@ STDMETHODIMP Session::COMGETTER(Console) (IConsole **aConsole) rc = mConsole.queryInterfaceTo(aConsole); else rc = mRemoteConsole.queryInterfaceTo(aConsole); - ComAssertComRC (rc); + ComAssertComRC(rc); return rc; } @@ -234,41 +232,42 @@ STDMETHODIMP Session::Close() CHECK_OPEN(); - return close (false /* aFinalRelease */, false /* aFromServer */); + return close(false /* aFinalRelease */, false /* aFromServer */); } // IInternalSessionControl methods ///////////////////////////////////////////////////////////////////////////// -STDMETHODIMP Session::GetPID (ULONG *aPid) +STDMETHODIMP Session::GetPID(ULONG *aPid) { AssertReturn(aPid, E_POINTER); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - *aPid = (ULONG) RTProcSelf(); - AssertCompile (sizeof (*aPid) == sizeof (RTPROCESS)); + *aPid = (ULONG)RTProcSelf(); + AssertCompile(sizeof(*aPid) == sizeof(RTPROCESS)); return S_OK; } -STDMETHODIMP Session::GetRemoteConsole (IConsole **aConsole) +STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole) { LogFlowThisFuncEnter(); AssertReturn(aConsole, E_POINTER); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState != SessionState_Closed, VBOX_E_INVALID_VM_STATE); - AssertMsgReturn (mType == SessionType_Direct && !!mConsole, - ("This is not a direct session!\n"), VBOX_E_INVALID_OBJECT_STATE); + AssertMsgReturn(mType == SessionType_Direct && !!mConsole, + ("This is not a direct session!\n"), + VBOX_E_INVALID_OBJECT_STATE); /* return a failure if the session already transitioned to Closing * but the server hasn't processed Machine::OnSessionEnd() yet. */ @@ -282,13 +281,13 @@ STDMETHODIMP Session::GetRemoteConsole (IConsole **aConsole) return S_OK; } -STDMETHODIMP Session::AssignMachine (IMachine *aMachine) +STDMETHODIMP Session::AssignMachine(IMachine *aMachine) { LogFlowThisFuncEnter(); LogFlowThisFunc(("aMachine=%p\n", aMachine)); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -318,10 +317,10 @@ STDMETHODIMP Session::AssignMachine (IMachine *aMachine) AssertReturn(!!mControl, E_FAIL); rc = mConsole.createObject(); - AssertComRCReturn (rc, rc); + AssertComRCReturn(rc, rc); - rc = mConsole->init (aMachine, mControl); - AssertComRCReturn (rc, rc); + rc = mConsole->init(aMachine, mControl); + AssertComRCReturn(rc, rc); rc = grabIPCSemaphore(); @@ -330,7 +329,7 @@ STDMETHODIMP Session::AssignMachine (IMachine *aMachine) * until the session is closed */ if (SUCCEEDED(rc)) - rc = aMachine->COMGETTER(Parent) (mVirtualBox.asOutParam()); + rc = aMachine->COMGETTER(Parent)(mVirtualBox.asOutParam()); if (SUCCEEDED(rc)) { @@ -351,7 +350,7 @@ STDMETHODIMP Session::AssignMachine (IMachine *aMachine) return rc; } -STDMETHODIMP Session::AssignRemoteMachine (IMachine *aMachine, IConsole *aConsole) +STDMETHODIMP Session::AssignRemoteMachine(IMachine *aMachine, IConsole *aConsole) { LogFlowThisFuncEnter(); LogFlowThisFunc(("aMachine=%p, aConsole=%p\n", aMachine, aConsole)); @@ -359,7 +358,7 @@ STDMETHODIMP Session::AssignRemoteMachine (IMachine *aMachine, IConsole *aConsol AssertReturn(aMachine && aConsole, E_INVALIDARG); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -395,7 +394,7 @@ STDMETHODIMP Session::AssignRemoteMachine (IMachine *aMachine, IConsole *aConsol * Reference the VirtualBox object to ensure the server is up * until the session is closed */ - rc = aMachine->COMGETTER(Parent) (mVirtualBox.asOutParam()); + rc = aMachine->COMGETTER(Parent)(mVirtualBox.asOutParam()); if (SUCCEEDED(rc)) { @@ -406,7 +405,7 @@ STDMETHODIMP Session::AssignRemoteMachine (IMachine *aMachine, IConsole *aConsol if (mType != SessionType_Remote) mType = SessionType_Existing; else - Assert (mState == SessionState_Spawning); + Assert(mState == SessionState_Spawning); mState = SessionState_Open; } @@ -424,7 +423,7 @@ STDMETHODIMP Session::AssignRemoteMachine (IMachine *aMachine, IConsole *aConsol return rc; } -STDMETHODIMP Session::UpdateMachineState (MachineState_T aMachineState) +STDMETHODIMP Session::UpdateMachineState(MachineState_T aMachineState) { AutoCaller autoCaller(this); @@ -452,7 +451,7 @@ STDMETHODIMP Session::UpdateMachineState (MachineState_T aMachineState) AssertReturn(!mControl.isNull(), E_FAIL); AssertReturn(!mConsole.isNull(), E_FAIL); - return mConsole->updateMachineState (aMachineState); + return mConsole->updateMachineState(aMachineState); } STDMETHODIMP Session::Uninitialize() @@ -480,7 +479,7 @@ STDMETHODIMP Session::Uninitialize() mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE); /* close ourselves */ - rc = close (false /* aFinalRelease */, true /* aFromServer */); + rc = close(false /* aFinalRelease */, true /* aFromServer */); } else if (autoCaller.state() == InUninit) { @@ -507,7 +506,7 @@ STDMETHODIMP Session::OnNetworkAdapterChange(INetworkAdapter *networkAdapter, BO LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -521,7 +520,7 @@ STDMETHODIMP Session::OnSerialPortChange(ISerialPort *serialPort) LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -535,7 +534,7 @@ STDMETHODIMP Session::OnParallelPortChange(IParallelPort *parallelPort) LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -549,7 +548,7 @@ STDMETHODIMP Session::OnStorageControllerChange() LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -563,7 +562,7 @@ STDMETHODIMP Session::OnMediumChange(IMediumAttachment *aMediumAttachment, BOOL LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -577,7 +576,7 @@ STDMETHODIMP Session::OnCPUChange(ULONG aCPU, BOOL aRemove) LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -591,7 +590,7 @@ STDMETHODIMP Session::OnVRDPServerChange() LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -605,7 +604,7 @@ STDMETHODIMP Session::OnUSBControllerChange() LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); @@ -614,55 +613,55 @@ STDMETHODIMP Session::OnUSBControllerChange() return mConsole->onUSBControllerChange(); } -STDMETHODIMP Session::OnSharedFolderChange (BOOL aGlobal) +STDMETHODIMP Session::OnSharedFolderChange(BOOL aGlobal) { LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); - return mConsole->onSharedFolderChange (aGlobal); + return mConsole->onSharedFolderChange(aGlobal); } -STDMETHODIMP Session::OnUSBDeviceAttach (IUSBDevice *aDevice, - IVirtualBoxErrorInfo *aError, - ULONG aMaskedIfs) +STDMETHODIMP Session::OnUSBDeviceAttach(IUSBDevice *aDevice, + IVirtualBoxErrorInfo *aError, + ULONG aMaskedIfs) { LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); - return mConsole->onUSBDeviceAttach (aDevice, aError, aMaskedIfs); + return mConsole->onUSBDeviceAttach(aDevice, aError, aMaskedIfs); } -STDMETHODIMP Session::OnUSBDeviceDetach (IN_BSTR aId, - IVirtualBoxErrorInfo *aError) +STDMETHODIMP Session::OnUSBDeviceDetach(IN_BSTR aId, + IVirtualBoxErrorInfo *aError) { LogFlowThisFunc(("\n")); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); - return mConsole->onUSBDeviceDetach (aId, aError); + return mConsole->onUSBDeviceDetach(aId, aError); } -STDMETHODIMP Session::OnShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId) +STDMETHODIMP Session::OnShowWindow(BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId) { AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -679,59 +678,59 @@ STDMETHODIMP Session::OnShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId return aCheck ? S_OK : E_FAIL; } - return mConsole->onShowWindow (aCheck, aCanShow, aWinId); + return mConsole->onShowWindow(aCheck, aCanShow, aWinId); } -STDMETHODIMP Session::AccessGuestProperty (IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags, - BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags) +STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags, + BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags) { #ifdef VBOX_WITH_GUEST_PROPS AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); if (mState != SessionState_Open) - return setError (VBOX_E_INVALID_VM_STATE, - tr ("Machine session is not open (session state: %s)."), - Global::stringifySessionState(mState)); + return setError(VBOX_E_INVALID_VM_STATE, + tr("Machine session is not open (session state: %s)."), + Global::stringifySessionState(mState)); AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); CheckComArgNotNull(aName); - if (!aIsSetter && !VALID_PTR (aRetValue)) + if (!aIsSetter && !VALID_PTR(aRetValue)) return E_POINTER; - if (!aIsSetter && !VALID_PTR (aRetTimestamp)) + if (!aIsSetter && !VALID_PTR(aRetTimestamp)) return E_POINTER; - if (!aIsSetter && !VALID_PTR (aRetFlags)) + if (!aIsSetter && !VALID_PTR(aRetFlags)) return E_POINTER; /* aValue can be NULL for a setter call if the property is to be deleted. */ - if (aIsSetter && (aValue != NULL) && !VALID_PTR (aValue)) + if (aIsSetter && (aValue != NULL) && !VALID_PTR(aValue)) return E_INVALIDARG; /* aFlags can be null if it is to be left as is */ - if (aIsSetter && (aFlags != NULL) && !VALID_PTR (aFlags)) + if (aIsSetter && (aFlags != NULL) && !VALID_PTR(aFlags)) return E_INVALIDARG; if (!aIsSetter) - return mConsole->getGuestProperty (aName, aRetValue, aRetTimestamp, aRetFlags); + return mConsole->getGuestProperty(aName, aRetValue, aRetTimestamp, aRetFlags); else - return mConsole->setGuestProperty (aName, aValue, aFlags); + return mConsole->setGuestProperty(aName, aValue, aFlags); #else /* VBOX_WITH_GUEST_PROPS not defined */ ReturnComNotImplemented(); #endif /* VBOX_WITH_GUEST_PROPS not defined */ } -STDMETHODIMP Session::EnumerateGuestProperties (IN_BSTR aPatterns, - ComSafeArrayOut(BSTR, aNames), - ComSafeArrayOut(BSTR, aValues), - ComSafeArrayOut(ULONG64, aTimestamps), - ComSafeArrayOut(BSTR, aFlags)) +STDMETHODIMP Session::EnumerateGuestProperties(IN_BSTR aPatterns, + ComSafeArrayOut(BSTR, aNames), + ComSafeArrayOut(BSTR, aValues), + ComSafeArrayOut(ULONG64, aTimestamps), + ComSafeArrayOut(BSTR, aFlags)) { #ifdef VBOX_WITH_GUEST_PROPS AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); if (mState != SessionState_Open) - return setError (VBOX_E_INVALID_VM_STATE, - tr ("Machine session is not open (session state: %s)."), - Global::stringifySessionState(mState)); + return setError(VBOX_E_INVALID_VM_STATE, + tr("Machine session is not open (session state: %s)."), + Global::stringifySessionState(mState)); AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); - if (!VALID_PTR (aPatterns) && (aPatterns != NULL)) + if (!VALID_PTR(aPatterns) && (aPatterns != NULL)) return E_POINTER; if (ComSafeArrayOutIsNull(aNames)) return E_POINTER; @@ -763,7 +762,7 @@ STDMETHODIMP Session::EnumerateGuestProperties (IN_BSTR aPatterns, * @note To be called only from #uninit(), #Close() or #Uninitialize(). * @note Locks this object for writing. */ -HRESULT Session::close (bool aFinalRelease, bool aFromServer) +HRESULT Session::close(bool aFinalRelease, bool aFromServer) { LogFlowThisFuncEnter(); LogFlowThisFunc(("aFinalRelease=%d, isFromServer=%d\n", @@ -778,7 +777,7 @@ HRESULT Session::close (bool aFinalRelease, bool aFromServer) if (mState != SessionState_Open) { - Assert (mState == SessionState_Spawning); + Assert(mState == SessionState_Spawning); /* The session object is going to be uninitialized before it has been * assigned a direct console of the machine the client requested to open @@ -788,17 +787,17 @@ HRESULT Session::close (bool aFinalRelease, bool aFromServer) * direct session). Otherwise, it means that the client is too fast and * trying to close the session before waiting for the progress object it * got from IVirtualBox:: openRemoteSession() to complete, so assert. */ - Assert (aFromServer); + Assert(aFromServer); mState = SessionState_Closed; mType = SessionType_Null; #if defined(RT_OS_WINDOWS) - Assert (!mIPCSem && !mIPCThreadSem); + Assert(!mIPCSem && !mIPCThreadSem); #elif defined(RT_OS_OS2) - Assert (mIPCThread == NIL_RTTHREAD && - mIPCThreadSem == NIL_RTSEMEVENT); + Assert(mIPCThread == NIL_RTTHREAD && + mIPCThreadSem == NIL_RTSEMEVENT); #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) - Assert (mIPCSem == -1); + Assert(mIPCSem == -1); #else # error "Port me!" #endif @@ -844,7 +843,7 @@ HRESULT Session::close (bool aFinalRelease, bool aFromServer) alock.leave(); LogFlowThisFunc(("Calling mControl->OnSessionEnd()...\n")); - HRESULT rc = mControl->OnSessionEnd (this, progress.asOutParam()); + HRESULT rc = mControl->OnSessionEnd(this, progress.asOutParam()); LogFlowThisFunc(("mControl->OnSessionEnd()=%08X\n", rc)); alock.enter(); @@ -856,7 +855,7 @@ HRESULT Session::close (bool aFinalRelease, bool aFromServer) if (mType != SessionType_Direct && rc == E_UNEXPECTED) rc = S_OK; - AssertComRC (rc); + AssertComRC(rc); } mControl.setNull(); @@ -871,9 +870,9 @@ HRESULT Session::close (bool aFinalRelease, bool aFromServer) * machine (allowing us to open a new session with the same machine * once this method returns) */ - Assert (!!progress); + Assert(!!progress); if (progress) - progress->WaitForCompletion (-1); + progress->WaitForCompletion(-1); } } @@ -894,7 +893,7 @@ HRESULT Session::grabIPCSemaphore() /* open the IPC semaphore based on the sessionId and try to grab it */ Bstr ipcId; - rc = mControl->GetIPCId (ipcId.asOutParam()); + rc = mControl->GetIPCId(ipcId.asOutParam()); AssertComRCReturnRC(rc); LogFlowThisFunc(("ipcId='%ls'\n", ipcId.raw())); @@ -908,36 +907,35 @@ HRESULT Session::grabIPCSemaphore() * thread to hold the IPC mutex and then release it in close(). */ - mIPCThreadSem = ::CreateEvent (NULL, FALSE, FALSE, NULL); - AssertMsgReturn (mIPCThreadSem, - ("Cannot create an event sem, err=%d", ::GetLastError()), - E_FAIL); + mIPCThreadSem = ::CreateEvent(NULL, FALSE, FALSE, NULL); + AssertMsgReturn(mIPCThreadSem, + ("Cannot create an event sem, err=%d", ::GetLastError()), + E_FAIL); - void *data [3]; - data [0] = (void *) (BSTR) ipcId; - data [1] = (void *) mIPCThreadSem; - data [2] = 0; /* will get an output from the thread */ + void *data[3]; + data[0] = (void*)(BSTR)ipcId; + data[1] = (void*)mIPCThreadSem; + data[2] = 0; /* will get an output from the thread */ /* create a thread to hold the IPC mutex until signalled to release it */ RTTHREAD tid; - int vrc = RTThreadCreate (&tid, IPCMutexHolderThread, (void *) data, - 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder"); - AssertRCReturn (vrc, E_FAIL); + int vrc = RTThreadCreate(&tid, IPCMutexHolderThread, (void*)data, 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder"); + AssertRCReturn(vrc, E_FAIL); /* wait until thread init is completed */ - DWORD wrc = ::WaitForSingleObject (mIPCThreadSem, INFINITE); - AssertMsg (wrc == WAIT_OBJECT_0, ("Wait failed, err=%d\n", ::GetLastError())); - Assert (data [2]); + DWORD wrc = ::WaitForSingleObject(mIPCThreadSem, INFINITE); + AssertMsg(wrc == WAIT_OBJECT_0, ("Wait failed, err=%d\n", ::GetLastError())); + Assert(data[2]); - if (wrc == WAIT_OBJECT_0 && data [2]) + if (wrc == WAIT_OBJECT_0 && data[2]) { /* memorize the event sem we should signal in close() */ - mIPCSem = (HANDLE) data [2]; + mIPCSem = (HANDLE)data[2]; rc = S_OK; } else { - ::CloseHandle (mIPCThreadSem); + ::CloseHandle(mIPCThreadSem); mIPCThreadSem = NULL; rc = E_FAIL; } @@ -949,25 +947,25 @@ HRESULT Session::grabIPCSemaphore() * the mutex). Therefore, we need a separate thread to hold the IPC mutex * and then release it in close(). */ - int vrc = RTSemEventCreate (&mIPCThreadSem); - AssertRCReturn (vrc, E_FAIL); + int vrc = RTSemEventCreate(&mIPCThreadSem); + AssertRCReturn(vrc, E_FAIL); - void *data [3]; - data [0] = (void *) ipcId.raw(); - data [1] = (void *) mIPCThreadSem; - data [2] = (void *) false; /* will get the thread result here */ + void *data[3]; + data[0] = (void*)ipcId.raw(); + data[1] = (void*)mIPCThreadSem; + data[2] = (void*)false; /* will get the thread result here */ /* create a thread to hold the IPC mutex until signalled to release it */ - vrc = RTThreadCreate (&mIPCThread, IPCMutexHolderThread, (void *) data, - 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder"); - AssertRCReturn (vrc, E_FAIL); + vrc = RTThreadCreate(&mIPCThread, IPCMutexHolderThread, (void *) data, + 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder"); + AssertRCReturn(vrc, E_FAIL); /* wait until thread init is completed */ vrc = RTThreadUserWait (mIPCThread, RT_INDEFINITE_WAIT); AssertReturn(RT_SUCCESS(vrc) || vrc == VERR_INTERRUPTED, E_FAIL); /* the thread must succeed */ - AssertReturn((bool) data [2], E_FAIL); + AssertReturn((bool)data[2], E_FAIL); #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) @@ -1033,7 +1031,7 @@ void Session::releaseIPCSemaphore() /* tell the thread holding the IPC mutex to release it */ int vrc = RTSemEventSignal (mIPCThreadSem); - AssertRC (vrc == NO_ERROR); + AssertRC(vrc == NO_ERROR); /* wait for the thread to finish */ vrc = RTThreadUserWait (mIPCThread, RT_INDEFINITE_WAIT); @@ -1072,8 +1070,8 @@ DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser) Assert (pvUser); void **data = (void **) pvUser; - BSTR sessionId = (BSTR) data [0]; - HANDLE initDoneSem = (HANDLE) data [1]; + BSTR sessionId = (BSTR)data[0]; + HANDLE initDoneSem = (HANDLE)data[1]; HANDLE ipcMutex = ::OpenMutex (MUTEX_ALL_ACCESS, FALSE, sessionId); AssertMsg (ipcMutex, ("cannot open IPC mutex, err=%d\n", ::GetLastError())); @@ -1089,7 +1087,7 @@ DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser) AssertMsg (finishSem, ("cannot create event sem, err=%d\n", ::GetLastError())); if (finishSem) { - data [2] = (void *) finishSem; + data[2] = (void*)finishSem; /* signal we're done with init */ ::SetEvent (initDoneSem); /* wait until we're signaled to release the IPC mutex */ @@ -1122,8 +1120,8 @@ DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser) Assert (pvUser); void **data = (void **) pvUser; - Utf8Str ipcId = (BSTR) data [0]; - RTSEMEVENT finishSem = (RTSEMEVENT) data [1]; + Utf8Str ipcId = (BSTR)data[0]; + RTSEMEVENT finishSem = (RTSEMEVENT)data[1]; LogFlowFunc (("ipcId='%s', finishSem=%p\n", ipcId.raw(), finishSem)); @@ -1140,10 +1138,10 @@ DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser) if (arc == NO_ERROR) { /* store the answer */ - data [2] = (void *) true; + data[2] = (void*)true; /* signal we're done */ int vrc = RTThreadUserSignal (Thread); - AssertRC (vrc); + AssertRC(vrc); /* wait until we're signaled to release the IPC mutex */ LogFlowFunc (("waiting for termination signal..\n")); @@ -1160,10 +1158,10 @@ DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser) } /* store the answer */ - data [1] = (void *) false; + data[1] = (void*)false; /* signal we're done */ int vrc = RTThreadUserSignal (Thread); - AssertRC (vrc); + AssertRC(vrc); LogFlowFuncLeave(); diff --git a/src/VBox/Main/SharedFolderImpl.cpp b/src/VBox/Main/SharedFolderImpl.cpp index 267cded9cad..c0b044f7f36 100644 --- a/src/VBox/Main/SharedFolderImpl.cpp +++ b/src/VBox/Main/SharedFolderImpl.cpp @@ -208,18 +208,20 @@ HRESULT SharedFolder::protectedInit(VirtualBoxBase *aParent, hostPath.stripTrailingSlash(); /* Check whether the path is full (absolute) */ - char hostPathFull [RTPATH_MAX]; + char hostPathFull[RTPATH_MAX]; int vrc = RTPathAbsEx(NULL, hostPath.c_str(), hostPathFull, sizeof (hostPathFull)); if (RT_FAILURE(vrc)) - return setError (E_INVALIDARG, - tr ("Invalid shared folder path: '%s' (%Rrc)"), hostPath.raw(), vrc); + return setError(E_INVALIDARG, + tr("Invalid shared folder path: '%s' (%Rrc)"), + hostPath.raw(), vrc); if (RTPathCompare(hostPath.c_str(), hostPathFull) != 0) - return setError (E_INVALIDARG, - tr ("Shared folder path '%s' is not absolute"), hostPath.raw()); + return setError(E_INVALIDARG, + tr("Shared folder path '%s' is not absolute"), + hostPath.raw()); unconst(mParent) = aParent; diff --git a/src/VBox/Main/SnapshotImpl.cpp b/src/VBox/Main/SnapshotImpl.cpp index 56c89ed63ea..0e55a9243a4 100644 --- a/src/VBox/Main/SnapshotImpl.cpp +++ b/src/VBox/Main/SnapshotImpl.cpp @@ -105,13 +105,13 @@ struct Snapshot::Data HRESULT Snapshot::FinalConstruct() { - LogFlowMember (("Snapshot::FinalConstruct()\n")); + LogFlowMember(("Snapshot::FinalConstruct()\n")); return S_OK; } void Snapshot::FinalRelease() { - LogFlowMember (("Snapshot::FinalRelease()\n")); + LogFlowMember(("Snapshot::FinalRelease()\n")); uninit(); } @@ -135,7 +135,7 @@ HRESULT Snapshot::init(VirtualBox *aVirtualBox, { LogFlowMember(("Snapshot::init(uuid: %s, aParent->uuid=%s)\n", aId.toString().c_str(), (aParent) ? aParent->m->uuid.toString().c_str() : "")); - ComAssertRet (!aId.isEmpty() && !aName.isEmpty() && aMachine, E_INVALIDARG); + ComAssertRet(!aId.isEmpty() && !aName.isEmpty() && aMachine, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); @@ -173,7 +173,7 @@ HRESULT Snapshot::init(VirtualBox *aVirtualBox, */ void Snapshot::uninit() { - LogFlowMember (("Snapshot::uninit()\n")); + LogFlowMember(("Snapshot::uninit()\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); @@ -309,7 +309,7 @@ void Snapshot::deparent() // //////////////////////////////////////////////////////////////////////////////// -STDMETHODIMP Snapshot::COMGETTER(Id) (BSTR *aId) +STDMETHODIMP Snapshot::COMGETTER(Id)(BSTR *aId) { CheckComArgOutPointerValid(aId); @@ -322,7 +322,7 @@ STDMETHODIMP Snapshot::COMGETTER(Id) (BSTR *aId) return S_OK; } -STDMETHODIMP Snapshot::COMGETTER(Name) (BSTR *aName) +STDMETHODIMP Snapshot::COMGETTER(Name)(BSTR *aName) { CheckComArgOutPointerValid(aName); @@ -362,7 +362,7 @@ STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName) return S_OK; } -STDMETHODIMP Snapshot::COMGETTER(Description) (BSTR *aDescription) +STDMETHODIMP Snapshot::COMGETTER(Description)(BSTR *aDescription) { CheckComArgOutPointerValid(aDescription); @@ -375,7 +375,7 @@ STDMETHODIMP Snapshot::COMGETTER(Description) (BSTR *aDescription) return S_OK; } -STDMETHODIMP Snapshot::COMSETTER(Description) (IN_BSTR aDescription) +STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription) { CheckComArgNotNull(aDescription); @@ -398,7 +398,7 @@ STDMETHODIMP Snapshot::COMSETTER(Description) (IN_BSTR aDescription) return S_OK; } -STDMETHODIMP Snapshot::COMGETTER(TimeStamp) (LONG64 *aTimeStamp) +STDMETHODIMP Snapshot::COMGETTER(TimeStamp)(LONG64 *aTimeStamp) { CheckComArgOutPointerValid(aTimeStamp); @@ -424,7 +424,7 @@ STDMETHODIMP Snapshot::COMGETTER(Online)(BOOL *aOnline) return S_OK; } -STDMETHODIMP Snapshot::COMGETTER(Machine) (IMachine **aMachine) +STDMETHODIMP Snapshot::COMGETTER(Machine)(IMachine **aMachine) { CheckComArgOutPointerValid(aMachine); @@ -437,7 +437,7 @@ STDMETHODIMP Snapshot::COMGETTER(Machine) (IMachine **aMachine) return S_OK; } -STDMETHODIMP Snapshot::COMGETTER(Parent) (ISnapshot **aParent) +STDMETHODIMP Snapshot::COMGETTER(Parent)(ISnapshot **aParent) { CheckComArgOutPointerValid(aParent); @@ -450,7 +450,7 @@ STDMETHODIMP Snapshot::COMGETTER(Parent) (ISnapshot **aParent) return S_OK; } -STDMETHODIMP Snapshot::COMGETTER(Children) (ComSafeArrayOut(ISnapshot *, aChildren)) +STDMETHODIMP Snapshot::COMGETTER(Children)(ComSafeArrayOut(ISnapshot *, aChildren)) { CheckComArgOutSafeArrayPointerValid(aChildren); @@ -815,7 +815,7 @@ HRESULT SnapshotMachine::init(SessionMachine *aSessionMachine, LogFlowThisFuncEnter(); LogFlowThisFunc(("mName={%ls}\n", aSessionMachine->mUserData->mName.raw())); - AssertReturn(aSessionMachine && !Guid (aSnapshotId).isEmpty(), E_INVALIDARG); + AssertReturn(aSessionMachine && !Guid(aSnapshotId).isEmpty(), E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); @@ -831,13 +831,13 @@ HRESULT SnapshotMachine::init(SessionMachine *aSessionMachine, unconst(mParent) = mPeer->mParent; /* take the pointer to Data to share */ - mData.share (mPeer->mData); + mData.share(mPeer->mData); /* take the pointer to UserData to share (our UserData must always be the * same as Machine's data) */ - mUserData.share (mPeer->mUserData); + mUserData.share(mPeer->mUserData); /* make a private copy of all other data (recent changes from SessionMachine) */ - mHWData.attachCopy (aSessionMachine->mHWData); + mHWData.attachCopy(aSessionMachine->mHWData); mMediaData.attachCopy(aSessionMachine->mMediaData); /* SSData is always unique for SnapshotMachine */ @@ -854,7 +854,7 @@ HRESULT SnapshotMachine::init(SessionMachine *aSessionMachine, { ComObjPtr<SharedFolder> folder; folder.createObject(); - rc = folder->initCopy (this, *it); + rc = folder->initCopy(this, *it); if (FAILED(rc)) return rc; *it = folder; } @@ -884,42 +884,42 @@ HRESULT SnapshotMachine::init(SessionMachine *aSessionMachine, { ComObjPtr<StorageController> ctrl; ctrl.createObject(); - ctrl->initCopy (this, *it); + ctrl->initCopy(this, *it); mStorageControllers->push_back(ctrl); } /* create all other child objects that will be immutable private copies */ unconst(mBIOSSettings).createObject(); - mBIOSSettings->initCopy (this, mPeer->mBIOSSettings); + mBIOSSettings->initCopy(this, mPeer->mBIOSSettings); #ifdef VBOX_WITH_VRDP unconst(mVRDPServer).createObject(); - mVRDPServer->initCopy (this, mPeer->mVRDPServer); + mVRDPServer->initCopy(this, mPeer->mVRDPServer); #endif unconst(mAudioAdapter).createObject(); - mAudioAdapter->initCopy (this, mPeer->mAudioAdapter); + mAudioAdapter->initCopy(this, mPeer->mAudioAdapter); unconst(mUSBController).createObject(); mUSBController->initCopy(this, mPeer->mUSBController); - for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) { unconst(mNetworkAdapters[slot]).createObject(); - mNetworkAdapters[slot]->initCopy (this, mPeer->mNetworkAdapters [slot]); + mNetworkAdapters[slot]->initCopy(this, mPeer->mNetworkAdapters[slot]); } - for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) { - unconst(mSerialPorts [slot]).createObject(); - mSerialPorts[slot]->initCopy (this, mPeer->mSerialPorts[slot]); + unconst(mSerialPorts[slot]).createObject(); + mSerialPorts[slot]->initCopy(this, mPeer->mSerialPorts[slot]); } - for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot++) + for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) { unconst(mParallelPorts[slot]).createObject(); - mParallelPorts[slot]->initCopy (this, mPeer->mParallelPorts[slot]); + mParallelPorts[slot]->initCopy(this, mPeer->mParallelPorts[slot]); } /* Confirm a successful initialization when it's the case */ @@ -966,12 +966,12 @@ HRESULT SnapshotMachine::init(Machine *aMachine, unconst(mParent) = mPeer->mParent; /* take the pointer to Data to share */ - mData.share (mPeer->mData); + mData.share(mPeer->mData); /* * take the pointer to UserData to share * (our UserData must always be the same as Machine's data) */ - mUserData.share (mPeer->mUserData); + mUserData.share(mPeer->mUserData); /* allocate private copies of all other data (will be loaded from settings) */ mHWData.allocate(); mMediaData.allocate(); @@ -1078,7 +1078,7 @@ RWLockHandle *SnapshotMachine::lockHandle() const * * @note Locks this object for writing. */ -HRESULT SnapshotMachine::onSnapshotChange (Snapshot *aSnapshot) +HRESULT SnapshotMachine::onSnapshotChange(Snapshot *aSnapshot) { AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -1537,7 +1537,7 @@ STDMETHODIMP SessionMachine::RestoreSnapshot(IConsole *aInitiator, AssertReturn(aSnapshot && aMachineState && aProgress, E_POINTER); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -1951,7 +1951,7 @@ STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator, AssertReturn(aMachineState && aProgress, E_POINTER); AutoCaller autoCaller(this); - AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); /* saveSettings() needs mParent lock */ AutoMultiWriteLock2 alock(mParent, this COMMA_LOCKVAL_SRC_POS); @@ -2207,7 +2207,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask) /* The below assert would be nice but I don't want to move * Medium::MergeChain to the header just for that - * Assert (!chain->isForward()); */ + * Assert(!chain->isForward()); */ // prepareDiscard() should have raised an error already // if there was more than one child diff --git a/src/VBox/Main/StorageControllerImpl.cpp b/src/VBox/Main/StorageControllerImpl.cpp index e4218b543e4..35a8f517ad9 100644 --- a/src/VBox/Main/StorageControllerImpl.cpp +++ b/src/VBox/Main/StorageControllerImpl.cpp @@ -122,8 +122,8 @@ HRESULT StorageController::init(Machine *aParent, ComAssertRet(aParent && !aName.isEmpty(), E_INVALIDARG); if ( (aStorageBus <= StorageBus_Null) || (aStorageBus > StorageBus_SAS)) - return setError (E_INVALIDARG, - tr ("Invalid storage connection type")); + return setError(E_INVALIDARG, + tr("Invalid storage connection type")); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); @@ -136,7 +136,7 @@ HRESULT StorageController::init(Machine *aParent, /* register with parent early, since uninit() will unconditionally * unregister on failure */ - m->pParent->addDependentChild (this); + m->pParent->addDependentChild(this); m->bd.allocate(); @@ -210,7 +210,7 @@ HRESULT StorageController::init(Machine *aParent, /* register with parent early, since uninit() will unconditionally * unregister on failure */ - m->pParent->addDependentChild (this); + m->pParent->addDependentChild(this); /* sanity */ AutoCaller thatCaller (aThat); @@ -257,13 +257,13 @@ HRESULT StorageController::initCopy(Machine *aParent, StorageController *aThat) unconst(m->pParent) = aParent; /* m->pPeer is left null */ - m->pParent->addDependentChild (this); + m->pParent->addDependentChild(this); - AutoCaller thatCaller (aThat); + AutoCaller thatCaller(aThat); AssertComRCReturnRC(thatCaller.rc()); AutoReadLock thatlock(aThat COMMA_LOCKVAL_SRC_POS); - m->bd.attachCopy (aThat->m->bd); + m->bd.attachCopy(aThat->m->bd); /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); @@ -287,7 +287,7 @@ void StorageController::uninit() m->bd.free(); - m->pParent->removeDependentChild (this); + m->pParent->removeDependentChild(this); unconst(m->pPeer).setNull(); unconst(m->pParent).setNull(); @@ -493,9 +493,9 @@ STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount) { /* AHCI SATA supports a maximum of 30 ports. */ if ((aPortCount < 1) || (aPortCount > 30)) - return setError (E_INVALIDARG, - tr ("Invalid port count: %lu (must be in range [%lu, %lu])"), - aPortCount, 1, 30); + return setError(E_INVALIDARG, + tr("Invalid port count: %lu (must be in range [%lu, %lu])"), + aPortCount, 1, 30); break; } case StorageBus_SCSI: @@ -507,9 +507,9 @@ STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount) * tries to set a different value we return an error. */ if (aPortCount != 16) - return setError (E_INVALIDARG, - tr ("Invalid port count: %lu (must be in range [%lu, %lu])"), - aPortCount, 16, 16); + return setError(E_INVALIDARG, + tr("Invalid port count: %lu (must be in range [%lu, %lu])"), + aPortCount, 16, 16); break; } case StorageBus_IDE: @@ -518,9 +518,9 @@ STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount) * The port count is fixed to 2. */ if (aPortCount != 2) - return setError (E_INVALIDARG, - tr ("Invalid port count: %lu (must be in range [%lu, %lu])"), - aPortCount, 2, 2); + return setError(E_INVALIDARG, + tr("Invalid port count: %lu (must be in range [%lu, %lu])"), + aPortCount, 2, 2); break; } case StorageBus_Floppy: @@ -530,9 +530,9 @@ STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount) * The port count is fixed to 1. */ if (aPortCount != 1) - return setError (E_INVALIDARG, - tr ("Invalid port count: %lu (must be in range [%lu, %lu])"), - aPortCount, 1, 1); + return setError(E_INVALIDARG, + tr("Invalid port count: %lu (must be in range [%lu, %lu])"), + aPortCount, 1, 1); break; } case StorageBus_SAS: @@ -541,9 +541,9 @@ STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount) * The port count is fixed to 8. */ if (aPortCount != 8) - return setError (E_INVALIDARG, - tr ("Invalid port count: %lu (must be in range [%lu, %lu])"), - aPortCount, 8, 8); + return setError(E_INVALIDARG, + tr("Invalid port count: %lu (must be in range [%lu, %lu])"), + aPortCount, 8, 8); break; } default: @@ -616,8 +616,8 @@ STDMETHODIMP StorageController::GetIDEEmulationPort(LONG DevicePosition, LONG *a AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); if (m->bd->mStorageControllerType != StorageControllerType_IntelAhci) - return setError (E_NOTIMPL, - tr ("Invalid controller type")); + return setError(E_NOTIMPL, + tr("Invalid controller type")); switch (DevicePosition) { @@ -651,13 +651,13 @@ STDMETHODIMP StorageController::SetIDEEmulationPort(LONG DevicePosition, LONG aP AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (m->bd->mStorageControllerType != StorageControllerType_IntelAhci) - return setError (E_NOTIMPL, - tr ("Invalid controller type")); + return setError(E_NOTIMPL, + tr("Invalid controller type")); if ((aPortNumber < 0) || (aPortNumber >= 30)) - return setError (E_INVALIDARG, - tr ("Invalid port number: %l (must be in range [%lu, %lu])"), - aPortNumber, 0, 29); + return setError(E_INVALIDARG, + tr("Invalid port number: %l (must be in range [%lu, %lu])"), + aPortNumber, 0, 29); switch (DevicePosition) { diff --git a/src/VBox/Main/SystemPropertiesImpl.cpp b/src/VBox/Main/SystemPropertiesImpl.cpp index 793ae2dc843..5b9a63bfc28 100644 --- a/src/VBox/Main/SystemPropertiesImpl.cpp +++ b/src/VBox/Main/SystemPropertiesImpl.cpp @@ -96,10 +96,10 @@ HRESULT SystemProperties::init (VirtualBox *aParent) /// @todo We currently leak memory because it's not actually clear what to /// free in structures returned by VDBackendInfo. Must be fixed ASAP! - VDBACKENDINFO aVDInfo [100]; + VDBACKENDINFO aVDInfo[100]; unsigned cEntries; - int vrc = VDBackendInfo (RT_ELEMENTS (aVDInfo), aVDInfo, &cEntries); - AssertRC (vrc); + int vrc = VDBackendInfo(RT_ELEMENTS (aVDInfo), aVDInfo, &cEntries); + AssertRC(vrc); if (RT_SUCCESS(vrc)) { for (unsigned i = 0; i < cEntries; ++ i) @@ -108,10 +108,10 @@ HRESULT SystemProperties::init (VirtualBox *aParent) rc = hdf.createObject(); if (FAILED(rc)) break; - rc = hdf->init (&aVDInfo [i]); + rc = hdf->init(&aVDInfo[i]); if (FAILED(rc)) break; - mMediumFormats.push_back (hdf); + mMediumFormats.push_back(hdf); } } diff --git a/src/VBox/Main/USBControllerImpl.cpp b/src/VBox/Main/USBControllerImpl.cpp index e371e9c4553..6f448b2b3f5 100644 --- a/src/VBox/Main/USBControllerImpl.cpp +++ b/src/VBox/Main/USBControllerImpl.cpp @@ -559,13 +559,13 @@ STDMETHODIMP USBController::RemoveDeviceFilter(ULONG aPosition, AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (!m->llDeviceFilters->size()) - return setError (E_INVALIDARG, - tr ("The USB device filter list is empty")); + return setError(E_INVALIDARG, + tr("The USB device filter list is empty")); if (aPosition >= m->llDeviceFilters->size()) - return setError (E_INVALIDARG, - tr ("Invalid position: %lu (must be in range [0, %lu])"), - aPosition, m->llDeviceFilters->size() - 1); + return setError(E_INVALIDARG, + tr("Invalid position: %lu (must be in range [0, %lu])"), + aPosition, m->llDeviceFilters->size() - 1); /* backup the list before modification */ m->llDeviceFilters.backup(); diff --git a/src/VBox/Main/VirtualBoxBase.cpp b/src/VBox/Main/VirtualBoxBase.cpp index 4bb24804571..2a3ba2e38b3 100644 --- a/src/VBox/Main/VirtualBoxBase.cpp +++ b/src/VBox/Main/VirtualBoxBase.cpp @@ -62,8 +62,8 @@ VirtualBoxBase::~VirtualBoxBase() { if (mObjectLock) delete mObjectLock; - Assert (mInitUninitWaiters == 0); - Assert (mInitUninitSem == NIL_RTSEMEVENTMULTI); + Assert(mInitUninitWaiters == 0); + Assert(mInitUninitSem == NIL_RTSEMEVENTMULTI); if (mZeroCallersSem != NIL_RTSEMEVENT) RTSemEventDestroy (mZeroCallersSem); mCallers = 0; @@ -216,7 +216,7 @@ HRESULT VirtualBoxBase::addCaller(State *aState /* = NULL */, if (mInitUninitSem == NIL_RTSEMEVENTMULTI) { RTSemEventMultiCreate (&mInitUninitSem); - Assert (mInitUninitWaiters == 0); + Assert(mInitUninitWaiters == 0); } ++ mInitUninitWaiters; @@ -241,7 +241,7 @@ HRESULT VirtualBoxBase::addCaller(State *aState /* = NULL */, rc = S_OK; else { - Assert (mCallers != 0); + Assert(mCallers != 0); -- mCallers; if (mCallers == 0 && mState == InUninit) { @@ -271,8 +271,8 @@ void VirtualBoxBase::releaseCaller() if (mState == Ready || mState == Limited) { /* if Ready or Limited, decrease the number of callers */ - AssertMsgReturn (mCallers != 0, ("mCallers is ZERO!"), (void) 0); - -- mCallers; + AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0); + --mCallers; return; } @@ -290,14 +290,12 @@ void VirtualBoxBase::releaseCaller() { /* the caller is being released after AutoUninitSpan or * AutoMayUninitSpan has begun */ - AssertMsgReturn (mCallers != 0, ("mCallers is ZERO!"), (void) 0); - -- mCallers; + AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0); + --mCallers; if (mCallers == 0) - { /* inform the Auto*UninitSpan ctor there are no more callers */ - RTSemEventSignal (mZeroCallersSem); - } + RTSemEventSignal(mZeroCallersSem); return; } @@ -599,7 +597,7 @@ AutoMayUninitSpan::AutoMayUninitSpan(VirtualBoxBase *aObj) * should've filtered out all states where addCaller() would do * something else but set error info. */ mRC = mObj->addCaller(); - Assert(FAILED (mRC)); + Assert(FAILED(mRC)); return; } @@ -633,7 +631,7 @@ AutoMayUninitSpan::AutoMayUninitSpan(VirtualBoxBase *aObj) AutoMayUninitSpan::~AutoMayUninitSpan() { /* if we did nothing in the constructor, do nothing here */ - if (mAlreadyInProgress || FAILED (mRC)) + if (mAlreadyInProgress || FAILED(mRC)) return; AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS); @@ -729,7 +727,7 @@ const char *VirtualBoxBase::translate (const char * /* context */, const char *s */ bool VirtualBoxSupportTranslationBase::cutClassNameFrom__PRETTY_FUNCTION__ (char *fn) { - Assert (fn); + Assert(fn); if (!fn) return false; @@ -751,18 +749,18 @@ bool VirtualBoxSupportTranslationBase::cutClassNameFrom__PRETTY_FUNCTION__ (char #endif - char *start = strstr (fn, START); - Assert (start); + char *start = strstr(fn, START); + Assert(start); if (start) { - start += sizeof (START) - 1; - char *end = strstr (start, END); - Assert (end && (end > start)); + start += sizeof(START) - 1; + char *end = strstr(start, END); + Assert(end && (end > start)); if (end && (end > start)) { size_t len = end - start; - memmove (fn, start, len); - fn [len] = 0; + memmove(fn, start, len); + fn[len] = 0; return true; } } @@ -826,7 +824,7 @@ HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal ( preserve)); /* these are mandatory, others -- not */ - AssertReturn((!aWarning && FAILED (aResultCode)) || + AssertReturn((!aWarning && FAILED(aResultCode)) || (aWarning && aResultCode != S_OK), E_FAIL); AssertReturn(!aText.isEmpty(), E_FAIL); @@ -853,7 +851,7 @@ HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal ( rc = ::GetErrorInfo (0, err.asOutParam()); if (FAILED(rc)) break; rc = err.queryInterfaceTo(curInfo.asOutParam()); - if (FAILED (rc)) + if (FAILED(rc)) { /* create a IVirtualBoxErrorInfo wrapper for the native * IErrorInfo object */ @@ -868,7 +866,7 @@ HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal ( } } /* On failure, curInfo will stay null */ - Assert (SUCCEEDED(rc) || curInfo.isNull()); + Assert(SUCCEEDED(rc) || curInfo.isNull()); /* set the current error info and preserve the previous one if any */ rc = info->init (aResultCode, aIID, aComponent, aText, curInfo); @@ -912,7 +910,7 @@ HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal ( } } /* On failure, curInfo will stay null */ - Assert (SUCCEEDED(rc) || curInfo.isNull()); + Assert(SUCCEEDED(rc) || curInfo.isNull()); /* set the current error info and preserve the previous one if any */ rc = info->init (aResultCode, aIID, aComponent, aText, curInfo); @@ -990,7 +988,7 @@ void VirtualBoxBaseWithChildrenNEXT::uninitDependentChildren() * be deleted while we've released the lock */ DependentChildren::iterator it = mDependentChildren.begin(); ComPtr<IUnknown> unk = it->first; - Assert (!unk.isNull()); + Assert(!unk.isNull()); VirtualBoxBase *child = it->second; @@ -1002,7 +1000,7 @@ void VirtualBoxBaseWithChildrenNEXT::uninitDependentChildren() * thread right before us and is not yet finished, the second * uninit() call will wait until the first one has done so * (thanks to AutoUninitSpan). */ - Assert (child); + Assert(child); if (child) child->uninit(); @@ -1016,7 +1014,7 @@ void VirtualBoxBaseWithChildrenNEXT::uninitDependentChildren() if (count != mDependentChildren.size()) mDependentChildren.erase (it); - Assert (count == mDependentChildren.size()); + Assert(count == mDependentChildren.size()); } } diff --git a/src/VBox/Main/VirtualBoxImpl.cpp b/src/VBox/Main/VirtualBoxImpl.cpp index 7621a967f6a..9daaa510536 100644 --- a/src/VBox/Main/VirtualBoxImpl.cpp +++ b/src/VBox/Main/VirtualBoxImpl.cpp @@ -313,10 +313,9 @@ HRESULT VirtualBox::init() char szHomeDir[RTPATH_MAX]; int vrc = com::GetVBoxUserHomeDirectory(szHomeDir, sizeof(szHomeDir)); if (RT_FAILURE(vrc)) - return setError (E_FAIL, - tr ("Could not create the VirtualBox home directory '%s'" - "(%Rrc)"), - szHomeDir, vrc); + return setError(E_FAIL, + tr("Could not create the VirtualBox home directory '%s' (%Rrc)"), + szHomeDir, vrc); unconst(m->strHomeDir) = szHomeDir; } @@ -379,17 +378,17 @@ HRESULT VirtualBox::init() rc = guestOSTypeObj.createObject(); if (SUCCEEDED(rc)) { - rc = guestOSTypeObj->init(Global::sOSTypes [i].familyId, - Global::sOSTypes [i].familyDescription, - Global::sOSTypes [i].id, - Global::sOSTypes [i].description, - Global::sOSTypes [i].osType, - Global::sOSTypes [i].osHint, - Global::sOSTypes [i].recommendedRAM, - Global::sOSTypes [i].recommendedVRAM, - Global::sOSTypes [i].recommendedHDD, - Global::sOSTypes [i].networkAdapterType, - Global::sOSTypes [i].numSerialEnabled); + rc = guestOSTypeObj->init(Global::sOSTypes[i].familyId, + Global::sOSTypes[i].familyDescription, + Global::sOSTypes[i].id, + Global::sOSTypes[i].description, + Global::sOSTypes[i].osType, + Global::sOSTypes[i].osHint, + Global::sOSTypes[i].recommendedRAM, + Global::sOSTypes[i].recommendedVRAM, + Global::sOSTypes[i].recommendedHDD, + Global::sOSTypes[i].networkAdapterType, + Global::sOSTypes[i].numSerialEnabled); if (SUCCEEDED(rc)) m->ollGuestOSTypes.addChild(guestOSTypeObj); } @@ -455,7 +454,7 @@ HRESULT VirtualBox::init() RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, "Watcher"); - ComAssertRC (vrc); + ComAssertRC(vrc); if (RT_FAILURE(vrc)) rc = E_FAIL; } @@ -886,7 +885,7 @@ STDMETHODIMP VirtualBox::COMGETTER(SharedFolders) (ComSafeArrayOut(ISharedFolder AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - return setError (E_NOTIMPL, "Not yet implemented"); + return setError(E_NOTIMPL, "Not yet implemented"); } STDMETHODIMP @@ -1364,7 +1363,7 @@ STDMETHODIMP VirtualBox::OpenHardDisk(IN_BSTR aLocation, { imageId = Guid(aImageId); if (imageId.isEmpty()) - return setError (E_INVALIDARG, tr ("Argument %s is empty"), "aImageId"); + return setError(E_INVALIDARG, tr("Argument %s is empty"), "aImageId"); } if (aSetParentId) parentId = Guid(aParentId); @@ -1623,9 +1622,9 @@ STDMETHODIMP VirtualBox::GetGuestOSType (IN_BSTR aId, IGuestOSType **aType) Bstr id = aId; for (size_t i = 0; i < RT_ELEMENTS (kOldNewIDs) / 2; i += 2) { - if (id == kOldNewIDs [i]) + if (id == kOldNewIDs[i]) { - id = kOldNewIDs [i + 1]; + id = kOldNewIDs[i + 1]; break; } } @@ -1647,9 +1646,9 @@ STDMETHODIMP VirtualBox::GetGuestOSType (IN_BSTR aId, IGuestOSType **aType) } return (*aType) ? S_OK : - setError (E_INVALIDARG, - tr ("'%ls' is not a valid Guest OS type"), - aId); + setError(E_INVALIDARG, + tr("'%ls' is not a valid Guest OS type"), + aId); } STDMETHODIMP VirtualBox::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL /* aWritable */) @@ -1660,7 +1659,7 @@ STDMETHODIMP VirtualBox::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BO AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - return setError (E_NOTIMPL, "Not yet implemented"); + return setError(E_NOTIMPL, "Not yet implemented"); } STDMETHODIMP VirtualBox::RemoveSharedFolder(IN_BSTR aName) @@ -1670,7 +1669,7 @@ STDMETHODIMP VirtualBox::RemoveSharedFolder(IN_BSTR aName) AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - return setError (E_NOTIMPL, "Not yet implemented"); + return setError(E_NOTIMPL, "Not yet implemented"); } /** @@ -1829,8 +1828,8 @@ STDMETHODIMP VirtualBox::OpenSession (ISession *aSession, IN_BSTR aMachineId) if (FAILED(rc)) return rc; if (state != SessionState_Closed) - return setError (VBOX_E_INVALID_OBJECT_STATE, - tr ("The given session is already open or being opened")); + return setError(VBOX_E_INVALID_OBJECT_STATE, + tr("The given session is already open or being opened")); /* get the IInternalSessionControl interface */ ComPtr<IInternalSessionControl> control = aSession; @@ -1885,8 +1884,8 @@ STDMETHODIMP VirtualBox::OpenRemoteSession (ISession *aSession, if (FAILED(rc)) return rc; if (state != SessionState_Closed) - return setError (VBOX_E_INVALID_OBJECT_STATE, - tr ("The given session is already open or being opened")); + return setError(VBOX_E_INVALID_OBJECT_STATE, + tr("The given session is already open or being opened")); /* get the IInternalSessionControl interface */ ComPtr<IInternalSessionControl> control = aSession; @@ -1939,8 +1938,8 @@ STDMETHODIMP VirtualBox::OpenExistingSession (ISession *aSession, if (FAILED(rc)) return rc; if (state != SessionState_Closed) - return setError (VBOX_E_INVALID_OBJECT_STATE, - tr ("The given session is already open or being opened")); + return setError(VBOX_E_INVALID_OBJECT_STATE, + tr("The given session is already open or being opened")); /* get the IInternalSessionControl interface */ ComPtr<IInternalSessionControl> control = aSession; @@ -2270,7 +2269,7 @@ VirtualBox::SVCHelperClientThread (RTTHREAD aThread, void *aUser) } /* get the path to the executable */ - char exePathBuf [RTPATH_MAX]; + char exePathBuf[RTPATH_MAX]; char *exePath = RTProcGetExecutableName (exePathBuf, RTPATH_MAX); ComAssertBreak (exePath, E_FAIL); @@ -2306,12 +2305,12 @@ VirtualBox::SVCHelperClientThread (RTTHREAD aThread, void *aUser) /* hide excessive details in case of a frequent error * (pressing the Cancel button to close the Run As dialog) */ if (vrc2 == VERR_CANCELLED) - rc = setError (E_FAIL, - tr ("Operation cancelled by the user")); + rc = setError(E_FAIL, + tr("Operation cancelled by the user")); else - rc = setError (E_FAIL, - tr ("Could not launch a privileged process '%s' (%Rrc)"), - exePath, vrc2); + rc = setError(E_FAIL, + tr("Could not launch a privileged process '%s' (%Rrc)"), + exePath, vrc2); break; } } @@ -2321,8 +2320,8 @@ VirtualBox::SVCHelperClientThread (RTTHREAD aThread, void *aUser) vrc = RTProcCreate (exePath, args, RTENV_DEFAULT, 0, &pid); if (RT_FAILURE(vrc)) { - rc = setError (E_FAIL, - tr ("Could not launch a process '%s' (%Rrc)"), exePath, vrc); + rc = setError(E_FAIL, + tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc); break; } } @@ -2345,14 +2344,14 @@ VirtualBox::SVCHelperClientThread (RTTHREAD aThread, void *aUser) if (SUCCEEDED(rc) && RT_FAILURE(vrc)) { - rc = setError (E_FAIL, - tr ("Could not operate the communication channel (%Rrc)"), vrc); + rc = setError(E_FAIL, + tr("Could not operate the communication channel (%Rrc)"), vrc); break; } } while (0); - if (FAILED (rc) && !userFuncCalled) + if (FAILED(rc) && !userFuncCalled) { /* call the user function in the "cleanup only" mode * to let it free resources passed to in aUser */ @@ -2498,7 +2497,7 @@ BOOL VirtualBox::onExtraDataCanChange (const Guid &aId, IN_BSTR aKey, IN_BSTR aV { HRESULT rc = (*it++)->OnExtraDataCanChange (id, aKey, aValue, aError.asOutParam(), &allowChange); - if (FAILED (rc)) + if (FAILED(rc)) { /* if a call to this method fails for some reason (for ex., because * the other side is dead), we ensure allowChange stays true @@ -2977,9 +2976,9 @@ HRESULT VirtualBox::findFloppyImage(const Guid *aId, { int vrc = calculateFullPath(Utf8Str(aLocation), location); if (RT_FAILURE(vrc)) - return setError (VBOX_E_FILE_ERROR, - tr ("Invalid image file location '%ls' (%Rrc)"), - aLocation, vrc); + return setError(VBOX_E_FILE_ERROR, + tr("Invalid image file location '%ls' (%Rrc)"), + aLocation, vrc); } AutoReadLock alock(m->ollFloppyImages.getLockHandle() COMMA_LOCKVAL_SRC_POS); @@ -3868,7 +3867,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher(RTTHREAD /* thread */, void *pvUser) else if (rc > WAIT_OBJECT_0 + cnt && rc <= (WAIT_OBJECT_0 + cntSpawned)) { /* spawned VM process has terminated (normally or abnormally) */ - (spawnedMachines [rc - WAIT_OBJECT_0 - cnt - 1])-> + (spawnedMachines[rc - WAIT_OBJECT_0 - cnt - 1])-> checkForSpawnFailure(); update = true; } @@ -3944,7 +3943,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher(RTTHREAD /* thread */, void *pvUser) /* close old process handles */ for (size_t i = 1 + cnt; i < 1 + cnt + cntSpawned; ++ i) - CloseHandle (handles [i]); + CloseHandle (handles[i]); /* release sets of machines if any */ machines.clear(); @@ -3957,7 +3956,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher(RTTHREAD /* thread */, void *pvUser) /// @todo (dmik) processes reaping! /* according to PMREF, 64 is the maximum for the muxwait list */ - SEMRECORD handles [64]; + SEMRECORD handles[64]; HMUX muxSem = NULLHANDLE; @@ -4007,7 +4006,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher(RTTHREAD /* thread */, void *pvUser) if (arc == NO_ERROR) { /* machine mutex is normally released */ - Assert (semId >= 0 && semId < cnt); + Assert(semId >= 0 && semId < cnt); if (semId >= 0 && semId < cnt) { #ifdef DEBUG @@ -4030,14 +4029,13 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher(RTTHREAD /* thread */, void *pvUser) { PID pid; TID tid; unsigned long reqCnt; - arc = DosQueryMutexSem ((HMTX) handles [i].hsemCur, &pid, - &tid, &reqCnt); + arc = DosQueryMutexSem((HMTX)handles[i].hsemCur, &pid, &tid, &reqCnt); if (arc == ERROR_SEM_OWNER_DIED) { /* close the dead mutex as asked by PMREF */ - ::DosCloseMutexSem ((HMTX) handles [i].hsemCur); + ::DosCloseMutexSem((HMTX)handles[i].hsemCur); - Assert (i >= 0 && i < cnt); + Assert(i >= 0 && i < cnt); if (i >= 0 && i < cnt) { #ifdef DEBUG @@ -4062,7 +4060,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher(RTTHREAD /* thread */, void *pvUser) if (cntSpawned > 0) { for (size_t i = 0; i < cntSpawned; ++ i) - updateSpawned |= (spawnedMachines [i])-> + updateSpawned |= (spawnedMachines[i])-> checkForSpawnFailure(); } } @@ -4216,11 +4214,11 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher(RTTHREAD /* thread */, void *pvUser) update = false; for (size_t i = 0; i < cnt; ++ i) - update |= (machines [i])->checkForDeath(); + update |= (machines[i])->checkForDeath(); updateSpawned = false; for (size_t i = 0; i < cntSpawned; ++ i) - updateSpawned |= (spawnedMachines [i])->checkForSpawnFailure(); + updateSpawned |= (spawnedMachines[i])->checkForSpawnFailure(); /* reap child processes */ { @@ -4469,7 +4467,7 @@ HRESULT VirtualBox::registerDHCPServer(DHCPServer *aDHCPServer, if (aSaveRegistry) { rc = saveSettings(); - if (FAILED (rc)) + if (FAILED(rc)) unregisterDHCPServer(aDHCPServer, false /* aSaveRegistry */); } @@ -4511,7 +4509,7 @@ HRESULT VirtualBox::unregisterDHCPServer(DHCPServer *aDHCPServer, if (aSaveRegistry) { rc = saveSettings(); - if (FAILED (rc)) + if (FAILED(rc)) registerDHCPServer(aDHCPServer, false /* aSaveRegistry */); } diff --git a/src/VBox/Main/generic/NetIf-generic.cpp b/src/VBox/Main/generic/NetIf-generic.cpp index c9d2ab31eb5..a734809058c 100644 --- a/src/VBox/Main/generic/NetIf-generic.cpp +++ b/src/VBox/Main/generic/NetIf-generic.cpp @@ -230,9 +230,9 @@ int NetIfRemoveHostOnlyNetworkInterface (VirtualBox *pVBox, IN_GUID aId, { Bstr ifname; ComPtr<IHostNetworkInterface> iface; - if (FAILED (host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam()))) + if (FAILED(host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam()))) return VERR_INVALID_PARAMETER; - iface->COMGETTER (Name) (ifname.asOutParam()); + iface->COMGETTER(Name) (ifname.asOutParam()); if (ifname.isNull()) return VERR_INTERNAL_ERROR; diff --git a/src/VBox/Main/glue/ErrorInfo.cpp b/src/VBox/Main/glue/ErrorInfo.cpp index efaec6533fc..ff2c5ff5a85 100644 --- a/src/VBox/Main/glue/ErrorInfo.cpp +++ b/src/VBox/Main/glue/ErrorInfo.cpp @@ -144,7 +144,7 @@ void ErrorInfo::init (bool aKeepObj /* = false */) void ErrorInfo::init (IUnknown *aI, const GUID &aIID, bool aKeepObj /* = false */) { - Assert (aI); + Assert(aI); if (!aI) return; @@ -209,7 +209,7 @@ void ErrorInfo::init (IVirtualBoxErrorInfo *info) if (SUCCEEDED(rc) && !next.isNull()) { mNext.reset (new ErrorInfo (next)); - Assert (mNext.get()); + Assert(mNext.get()); if (!mNext.get()) rc = E_OUTOFMEMORY; } @@ -234,7 +234,7 @@ ErrorInfo::~ErrorInfo() ProgressErrorInfo::ProgressErrorInfo (IProgress *progress) : ErrorInfo (false /* aDummy */) { - Assert (progress); + Assert(progress); if (!progress) return; diff --git a/src/VBox/Main/glue/EventQueue.cpp b/src/VBox/Main/glue/EventQueue.cpp index d1b333f379f..ab368691c97 100644 --- a/src/VBox/Main/glue/EventQueue.cpp +++ b/src/VBox/Main/glue/EventQueue.cpp @@ -484,7 +484,7 @@ BOOL EventQueue::postEvent (Event *event) */ BOOL EventQueue::waitForEvent (Event **event) { - Assert (event); + Assert(event); if (!event) return FALSE; @@ -517,7 +517,7 @@ BOOL EventQueue::waitForEvent (Event **event) { rc = mEventQ->WaitForEvent (&ev); // check for error - if (FAILED (rc)) + if (FAILED(rc)) return FALSE; // check for EINTR signal if (!ev) @@ -544,7 +544,7 @@ BOOL EventQueue::waitForEvent (Event **event) */ BOOL EventQueue::handleEvent (Event *event) { - Assert (event); + Assert(event); if (!event) return FALSE; diff --git a/src/VBox/Main/glue/SupportErrorInfo.cpp b/src/VBox/Main/glue/SupportErrorInfo.cpp index ef3d09618ff..75c90e33dc0 100644 --- a/src/VBox/Main/glue/SupportErrorInfo.cpp +++ b/src/VBox/Main/glue/SupportErrorInfo.cpp @@ -49,21 +49,21 @@ void MultiResult::incCounter() if (sCounter == NIL_RTTLS) { sCounter = RTTlsAlloc(); - AssertReturnVoid (sCounter != NIL_RTTLS); + AssertReturnVoid(sCounter != NIL_RTTLS); } - uintptr_t counter = (uintptr_t) RTTlsGet (sCounter); - ++ counter; - RTTlsSet (sCounter, (void *) counter); + uintptr_t counter = (uintptr_t)RTTlsGet(sCounter); + ++counter; + RTTlsSet(sCounter, (void*)counter); } /*static*/ void MultiResult::decCounter() { - uintptr_t counter = (uintptr_t) RTTlsGet (sCounter); - AssertReturnVoid (counter != 0); - -- counter; - RTTlsSet (sCounter, (void *) counter); + uintptr_t counter = (uintptr_t)RTTlsGet(sCounter); + AssertReturnVoid(counter != 0); + --counter; + RTTlsSet(sCounter, (void*)counter); } // SupportErrorInfoBase methods @@ -105,7 +105,7 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, IVirtualBoxErrorInfo *aInfo /*= NULL*/) { /* whether multi-error mode is turned on */ - bool preserve = ((uintptr_t) RTTlsGet (MultiResult::sCounter)) > 0; + bool preserve = ((uintptr_t)RTTlsGet(MultiResult::sCounter)) > 0; LogRel(("ERROR [COM]: aRC=%#08x aIID={%RTuuid} aComponent={%s} aText={%s} aWarning=%RTbool, aInfo=%p, preserve=%RTbool\n", aResultCode, @@ -119,7 +119,7 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, if (aInfo == NULL) { /* these are mandatory, others -- not */ - AssertReturn((!aWarning && FAILED (aResultCode)) || + AssertReturn((!aWarning && FAILED(aResultCode)) || (aWarning && aResultCode != S_OK), E_FAIL); AssertReturn(!strText.isEmpty(), E_FAIL); @@ -142,10 +142,10 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, { /* get the current error info if any */ ComPtr<IErrorInfo> err; - rc = ::GetErrorInfo (0, err.asOutParam()); + rc = ::GetErrorInfo(0, err.asOutParam()); if (FAILED(rc)) break; rc = err.queryInterfaceTo(curInfo.asOutParam()); - if (FAILED (rc)) + if (FAILED(rc)) { /* create a IVirtualBoxErrorInfo wrapper for the native * IErrorInfo object */ @@ -153,7 +153,7 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, rc = wrapper.createObject(); if (SUCCEEDED(rc)) { - rc = wrapper->init (err); + rc = wrapper->init(err); if (SUCCEEDED(rc)) curInfo = wrapper; } @@ -175,14 +175,14 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, rc = infoObj.createObject(); if (FAILED(rc)) break; - rc = infoObj->init (aInfo, curInfo); + rc = infoObj->init(aInfo, curInfo); if (FAILED(rc)) break; info = infoObj; } /* we want to return the head's result code */ - rc = info->COMGETTER(ResultCode) (&aResultCode); + rc = info->COMGETTER(ResultCode)(&aResultCode); if (FAILED(rc)) break; } else @@ -191,7 +191,7 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, rc = infoObj.createObject(); if (FAILED(rc)) break; - rc = infoObj->init (aResultCode, aIID, aComponent, strText.c_str(), curInfo); + rc = infoObj->init(aResultCode, aIID, aComponent, strText.c_str(), curInfo); if (FAILED(rc)) break; info = infoObj; @@ -200,16 +200,16 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, ComPtr<IErrorInfo> err; rc = info.queryInterfaceTo(err.asOutParam()); if (SUCCEEDED(rc)) - rc = ::SetErrorInfo (0, err); + rc = ::SetErrorInfo(0, err); #else // !defined (VBOX_WITH_XPCOM) nsCOMPtr <nsIExceptionService> es; - es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); + es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc); if (NS_SUCCEEDED(rc)) { nsCOMPtr <nsIExceptionManager> em; - rc = es->GetCurrentExceptionManager (getter_AddRefs (em)); + rc = es->GetCurrentExceptionManager(getter_AddRefs(em)); if (FAILED(rc)) break; ComPtr<IVirtualBoxErrorInfo> curInfo; @@ -217,10 +217,10 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, { /* get the current error info if any */ ComPtr<nsIException> ex; - rc = em->GetCurrentException (ex.asOutParam()); + rc = em->GetCurrentException(ex.asOutParam()); if (FAILED(rc)) break; rc = ex.queryInterfaceTo(curInfo.asOutParam()); - if (FAILED (rc)) + if (FAILED(rc)) { /* create a IVirtualBoxErrorInfo wrapper for the native * nsIException object */ @@ -228,14 +228,14 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, rc = wrapper.createObject(); if (SUCCEEDED(rc)) { - rc = wrapper->init (ex); + rc = wrapper->init(ex); if (SUCCEEDED(rc)) curInfo = wrapper; } } } /* On failure, curInfo will stay null */ - Assert (SUCCEEDED(rc) || curInfo.isNull()); + Assert(SUCCEEDED(rc) || curInfo.isNull()); /* set the current error info and preserve the previous one if any */ if (aInfo != NULL) @@ -250,7 +250,7 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, rc = infoObj.createObject(); if (FAILED(rc)) break; - rc = infoObj->init (aInfo, curInfo); + rc = infoObj->init(aInfo, curInfo); if (FAILED(rc)) break; info = infoObj; @@ -258,7 +258,7 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, /* we want to return the head's result code */ PRInt32 lrc; - rc = info->COMGETTER(ResultCode) (&lrc); aResultCode = lrc; + rc = info->COMGETTER(ResultCode)(&lrc); aResultCode = lrc; if (FAILED(rc)) break; } else @@ -276,7 +276,7 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, ComPtr<nsIException> ex; rc = info.queryInterfaceTo(ex.asOutParam()); if (SUCCEEDED(rc)) - rc = em->SetCurrentException (ex); + rc = em->SetCurrentException(ex); } else if (rc == NS_ERROR_UNEXPECTED) { @@ -300,46 +300,46 @@ HRESULT SupportErrorInfoBase::setErrorInternal(HRESULT aResultCode, } while (0); - AssertComRC (rc); + AssertComRC(rc); return SUCCEEDED(rc) ? aResultCode : rc; } /* static */ -HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const GUID &aIID, - const char *aComponent, const char *aText, - ...) +HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const GUID &aIID, + const char *aComponent, const char *aText, + ...) { va_list args; - va_start (args, aText); - HRESULT rc = setErrorV (aResultCode, aIID, aComponent, aText, args); - va_end (args); + va_start(args, aText); + HRESULT rc = setErrorV(aResultCode, aIID, aComponent, aText, args); + va_end(args); return rc; } /* static */ -HRESULT SupportErrorInfoBase::setWarning (HRESULT aResultCode, const GUID &aIID, - const char *aComponent, const char *aText, - ...) +HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const GUID &aIID, + const char *aComponent, const char *aText, + ...) { va_list args; - va_start (args, aText); - HRESULT rc = setWarningV (aResultCode, aIID, aComponent, aText, args); - va_end (args); + va_start(args, aText); + HRESULT rc = setWarningV(aResultCode, aIID, aComponent, aText, args); + va_end(args); return rc; } -HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const char *aText, ...) +HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const char *aText, ...) { va_list args; - va_start (args, aText); - HRESULT rc = setErrorV (aResultCode, mainInterfaceID(), componentName(), - aText, args); - va_end (args); + va_start(args, aText); + HRESULT rc = setErrorV(aResultCode, mainInterfaceID(), componentName(), + aText, args); + va_end(args); return rc; } -HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const Utf8Str &strText) +HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const Utf8Str &strText) { HRESULT rc = setError(aResultCode, mainInterfaceID(), @@ -348,33 +348,33 @@ HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const Utf8Str &strT return rc; } -HRESULT SupportErrorInfoBase::setWarning (HRESULT aResultCode, const char *aText, ...) +HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const char *aText, ...) { va_list args; - va_start (args, aText); - HRESULT rc = setWarningV (aResultCode, mainInterfaceID(), componentName(), - aText, args); - va_end (args); + va_start(args, aText); + HRESULT rc = setWarningV(aResultCode, mainInterfaceID(), componentName(), + aText, args); + va_end(args); return rc; } -HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const GUID &aIID, - const char *aText, ...) +HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const GUID &aIID, + const char *aText, ...) { va_list args; - va_start (args, aText); - HRESULT rc = setErrorV (aResultCode, aIID, componentName(), aText, args); - va_end (args); + va_start(args, aText); + HRESULT rc = setErrorV(aResultCode, aIID, componentName(), aText, args); + va_end(args); return rc; } -HRESULT SupportErrorInfoBase::setWarning (HRESULT aResultCode, const GUID &aIID, - const char *aText, ...) +HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const GUID &aIID, + const char *aText, ...) { va_list args; - va_start (args, aText); - HRESULT rc = setWarningV (aResultCode, aIID, componentName(), aText, args); - va_end (args); + va_start(args, aText); + HRESULT rc = setWarningV(aResultCode, aIID, componentName(), aText, args); + va_end(args); return rc; } diff --git a/src/VBox/Main/glue/initterm.cpp b/src/VBox/Main/glue/initterm.cpp index f587748f5fa..2118dee72da 100644 --- a/src/VBox/Main/glue/initterm.cpp +++ b/src/VBox/Main/glue/initterm.cpp @@ -443,13 +443,13 @@ HRESULT Initialize() { /* Use RTPathAppPrivateArch() first */ vrc = RTPathAppPrivateArch(szAppHomeDir, sizeof(szAppHomeDir)); - AssertRC (vrc); + AssertRC(vrc); } else { /* Iterate over all other paths */ szAppHomeDir[RTPATH_MAX - 1] = '\0'; - strncpy(szAppHomeDir, kAppPathsToProbe [i], RTPATH_MAX - 1); + strncpy(szAppHomeDir, kAppPathsToProbe[i], RTPATH_MAX - 1); vrc = VINF_SUCCESS; } if (RT_FAILURE(vrc)) diff --git a/src/VBox/Main/glue/string.cpp b/src/VBox/Main/glue/string.cpp index 8cd6c4e63bd..0e9f4f31633 100644 --- a/src/VBox/Main/glue/string.cpp +++ b/src/VBox/Main/glue/string.cpp @@ -76,44 +76,43 @@ struct FormatData char *cache; }; -void Utf8StrFmt::init (const char *format, va_list args) +void Utf8StrFmt::init(const char *format, va_list args) { if (!format) return; // assume an extra byte for a terminating zero - size_t fmtlen = strlen (format) + 1; + size_t fmtlen = strlen(format) + 1; FormatData data; data.size = FormatData::CacheIncrement; if (fmtlen >= FormatData::CacheIncrement) data.size += fmtlen; data.pos = 0; - data.cache = (char *) ::RTMemTmpAllocZ (data.size); + data.cache = (char*)::RTMemTmpAllocZ(data.size); - size_t n = ::RTStrFormatV (strOutput, &data, NULL, NULL, format, args); + size_t n = ::RTStrFormatV(strOutput, &data, NULL, NULL, format, args); - AssertMsg (n == data.pos, - ("The number of bytes formatted doesn't match: %d and %d!", - n, data.pos)); - NOREF (n); + AssertMsg(n == data.pos, + ("The number of bytes formatted doesn't match: %d and %d!", n, data.pos)); + NOREF(n); // finalize formatting - data.cache [data.pos] = 0; - (*static_cast <Utf8Str *> (this)) = data.cache; - ::RTMemTmpFree (data.cache); + data.cache[data.pos] = 0; + (*static_cast<Utf8Str*>(this)) = data.cache; + ::RTMemTmpFree(data.cache); } // static -DECLCALLBACK(size_t) Utf8StrFmt::strOutput (void *pvArg, const char *pachChars, - size_t cbChars) +DECLCALLBACK(size_t) Utf8StrFmt::strOutput(void *pvArg, const char *pachChars, + size_t cbChars) { - Assert (pvArg); + Assert(pvArg); FormatData &data = *(FormatData *) pvArg; if (!(pachChars == NULL && cbChars == 0)) { - Assert (pachChars); + Assert(pachChars); // append to cache (always assume an extra byte for a terminating zero) size_t needed = cbChars + 1; @@ -122,9 +121,9 @@ DECLCALLBACK(size_t) Utf8StrFmt::strOutput (void *pvArg, const char *pachChars, data.size += FormatData::CacheIncrement; if (needed >= FormatData::CacheIncrement) data.size += needed; - data.cache = (char *) ::RTMemRealloc (data.cache, data.size); + data.cache = (char*)::RTMemRealloc(data.cache, data.size); } - strncpy (data.cache + data.pos, pachChars, cbChars); + strncpy(data.cache + data.pos, pachChars, cbChars); data.pos += cbChars; } diff --git a/src/VBox/Main/hgcm/HGCMThread.cpp b/src/VBox/Main/hgcm/HGCMThread.cpp index ae5b12f38b8..f0b1c440f38 100644 --- a/src/VBox/Main/hgcm/HGCMThread.cpp +++ b/src/VBox/Main/hgcm/HGCMThread.cpp @@ -193,7 +193,7 @@ static DECLCALLBACK(int) hgcmWorkerThreadFunc (RTTHREAD ThreadSelf, void *pvUser pThread->m_thread = ThreadSelf; pThread->m_fu32ThreadFlags &= ~HGCMMSG_TF_INITIALIZING; rc = RTThreadUserSignal (ThreadSelf); - AssertRC (rc); + AssertRC(rc); pThread->m_pfnThread (pThread->Handle (), pThread->m_pvUser); @@ -299,8 +299,8 @@ int HGCMThread::Initialize (HGCMTHREADHANDLE handle, const char *pszThreadName, { /* Wait until the thread is ready. */ rc = RTThreadUserWait (thread, 30000); - AssertRC (rc); - Assert (!(m_fu32ThreadFlags & HGCMMSG_TF_INITIALIZING) || RT_FAILURE(rc)); + AssertRC(rc); + Assert(!(m_fu32ThreadFlags & HGCMMSG_TF_INITIALIZING) || RT_FAILURE(rc)); } else { @@ -483,7 +483,7 @@ int HGCMThread::MsgGet (HGCMMsgCore **ppMsg) HGCMMsgCore *pMsg = m_pMsgInputQueueHead; /* Remove the message from the head of Queue list. */ - Assert (m_pMsgInputQueueHead->m_pPrev == NULL); + Assert(m_pMsgInputQueueHead->m_pPrev == NULL); if (m_pMsgInputQueueHead->m_pNext) { @@ -492,7 +492,7 @@ int HGCMThread::MsgGet (HGCMMsgCore **ppMsg) } else { - Assert (m_pMsgInputQueueHead == m_pMsgInputQueueTail); + Assert(m_pMsgInputQueueHead == m_pMsgInputQueueTail); m_pMsgInputQueueHead = NULL; m_pMsgInputQueueTail = NULL; diff --git a/src/VBox/Main/include/AutoCaller.h b/src/VBox/Main/include/AutoCaller.h index 79733fa7ac8..b1490ce187f 100644 --- a/src/VBox/Main/include/AutoCaller.h +++ b/src/VBox/Main/include/AutoCaller.h @@ -89,7 +89,7 @@ public: HRESULT rc() const { return mRC; } /** - * Returns |true| if |SUCCEEDED (rc())| is |true|, for convenience. + * Returns |true| if |SUCCEEDED(rc())| is |true|, for convenience. * |true| means the number of callers was successfully increased. */ bool isOk() const { return SUCCEEDED(mRC); } @@ -244,10 +244,10 @@ typedef AutoCallerBase<true> AutoLimitedCaller; * AutoInitSpan autoInitSpan (this); * AssertReturn (autoInitSpan.isOk(), E_FAIL); * ... - * if (FAILED (rc)) + * if (FAILED(rc)) * return rc; * ... - * if (SUCCEEDED (rc)) + * if (SUCCEEDED(rc)) * autoInitSpan.setSucceeded(); * return rc; * } @@ -340,10 +340,10 @@ private: * AutoReinitSpan autoReinitSpan (this); * AssertReturn (autoReinitSpan.isOk(), E_FAIL); * ... - * if (FAILED (rc)) + * if (FAILED(rc)) * return rc; * ... - * if (SUCCEEDED (rc)) + * if (SUCCEEDED(rc)) * autoReinitSpan.setSucceeded(); * return rc; * } @@ -477,10 +477,10 @@ private: * if (mayUninitSpan.alreadyInProgress()) * return S_OK; * ... - * if (FAILED (rc)) + * if (FAILED(rc)) * return rc; // will go back to Ready * ... - * if (SUCCEEDED (rc)) + * if (SUCCEEDED(rc)) * mayUninitSpan.acceptUninit(); // will call uninit() * return rc; * } diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h index a855b475283..0364e65183f 100644 --- a/src/VBox/Main/include/ConsoleImpl.h +++ b/src/VBox/Main/include/ConsoleImpl.h @@ -68,7 +68,7 @@ typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG; #define CHECK_CONSOLE_DRV(drv) \ do { \ if (!(drv)) \ - return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \ + return setError(E_ACCESSDENIED, tr("The console is not powered up")); \ } while (0) // Console @@ -216,9 +216,9 @@ public: static const PDMDRVREG DrvStatusReg; - void reportAuthLibraryError (const char *filename, int rc) + void reportAuthLibraryError(const char *filename, int rc) { - setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc); + setError(E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc); } static HRESULT handleUnexpectedExceptions(RT_SRC_POS_DECL); @@ -241,18 +241,18 @@ private: public: AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK) { - Assert (aThat); + Assert(aThat); mRC = aThat->addVMCaller (taQuiet, taAllowNullVM); } ~AutoVMCallerBase() { - if (SUCCEEDED (mRC)) + if (SUCCEEDED(mRC)) mThat->releaseVMCaller(); } /** Decreases the number of callers before the instance is destroyed. */ void release() { - AssertReturnVoid (SUCCEEDED (mRC)); + AssertReturnVoid(SUCCEEDED(mRC)); mThat->releaseVMCaller(); mRC = E_FAIL; } @@ -260,13 +260,13 @@ private: * rechecked to ensure the operation succeeded. */ void add() { - AssertReturnVoid (!SUCCEEDED (mRC)); + AssertReturnVoid(!SUCCEEDED(mRC)); mRC = mThat->addVMCaller (taQuiet, taAllowNullVM); } /** Returns the result of Console::addVMCaller() */ HRESULT rc() const { return mRC; } - /** Shortcut to SUCCEEDED (rc()) */ - bool isOk() const { return SUCCEEDED (mRC); } + /** Shortcut to SUCCEEDED(rc()) */ + bool isOk() const { return SUCCEEDED(mRC); } protected: Console *mThat; HRESULT mRC; @@ -327,7 +327,7 @@ private: public: SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL) { - if (SUCCEEDED (Base::mRC)) + if (SUCCEEDED(Base::mRC)) mpVM = aThat->mpVM; } /** Smart SaveVMPtr to PVM cast operator */ diff --git a/src/VBox/Main/include/ProgressCombinedImpl.h b/src/VBox/Main/include/ProgressCombinedImpl.h index 983242a07b0..879cb97e22a 100644 --- a/src/VBox/Main/include/ProgressCombinedImpl.h +++ b/src/VBox/Main/include/ProgressCombinedImpl.h @@ -130,7 +130,7 @@ public: aInitiator, aDescription, aId); /* Confirm a successful initialization when it's the case */ - if (SUCCEEDED (rc)) + if (SUCCEEDED(rc)) autoInitSpan.setSucceeded(); return rc; diff --git a/src/VBox/Main/include/VirtualBoxBase.h b/src/VBox/Main/include/VirtualBoxBase.h index 875b4870cec..728c4d61472 100644 --- a/src/VBox/Main/include/VirtualBoxBase.h +++ b/src/VBox/Main/include/VirtualBoxBase.h @@ -148,7 +148,7 @@ public: * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. * * In the debug build, this macro is equivalent to Assert. - * In the release build, this macro uses |setError (E_FAIL, ...)| to set the + * In the release build, this macro uses |setError(E_FAIL, ...)| to set the * error info from the asserted expression. * * @see VirtualBoxSupportErrorInfoImpl::setError @@ -959,7 +959,7 @@ protected: * * On all platforms, the template argument must also define the following * method: |public static const wchar_t *C::getComponentName()|. See - * #setError (HRESULT, const char *, ...) for a description on how it is + * #setError(HRESULT, const char *, ...) for a description on how it is * used. * * @param C @@ -1040,7 +1040,7 @@ protected: * This method is rarely needs to be used though. There are more convenient * overloaded versions, that automatically substitute some arguments * taking their values from the template parameters. See - * #setError (HRESULT, const char *, ...) for an example. + * #setError(HRESULT, const char *, ...) for an example. * * @param aResultCode result (error) code, must not be S_OK * @param aIID IID of the interface that defines the error @@ -1093,7 +1093,7 @@ protected: * ID (taken from the I template argument) and the component name * (a value of C::getComponentName()). * - * See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...) + * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) * for details. * * This method is the most common (and convenient) way to set error @@ -1101,11 +1101,11 @@ protected: * is looks like this: * * <code> - * return setError (E_FAIL, "Terrible Error"); + * return setError(E_FAIL, "Terrible Error"); * </code> * or * <code> - * HRESULT rc = setError (E_FAIL, "Terrible Error"); + * HRESULT rc = setError(E_FAIL, "Terrible Error"); * ... * return rc; * </code> @@ -1145,8 +1145,8 @@ protected: * ID (taken from the I template argument) and the component name * (a value of C::getComponentName()). * - * See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...) - * and #setError (HRESULT, const char *, ...) for details. + * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) + * and #setError(HRESULT, const char *, ...) for details. */ static HRESULT setErrorV(HRESULT aResultCode, const char *aText, va_list aArgs) @@ -1182,8 +1182,8 @@ protected: * This method is preferred if you have a ready (translated and formatted) * Bstr string, because it omits an extra conversion Utf8Str -> Bstr. * - * See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...) - * and #setError (HRESULT, const char *, ...) for details. + * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) + * and #setError(HRESULT, const char *, ...) for details. */ static HRESULT setErrorBstr(HRESULT aResultCode, const Bstr &aText) { @@ -1214,7 +1214,7 @@ protected: * (a value of C::getComponentName()), but allows to specify the interface * id manually. * - * See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...) + * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) * for details. */ static HRESULT setError(HRESULT aResultCode, const GUID &aIID, @@ -1253,7 +1253,7 @@ protected: * anything in the release log. This is very useful for avoiding * harmless error from causing confusion. * - * It is otherwise identical to #setError (HRESULT, const char *text, ...). + * It is otherwise identical to #setError(HRESULT, const char *text, ...). */ static HRESULT setErrorNoLog(HRESULT aResultCode, const char *aText, ...) { diff --git a/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h b/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h index 11fc7095080..d8f2984287c 100644 --- a/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h +++ b/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h @@ -77,10 +77,10 @@ private: // FIXME: declare these here until VBoxSupportsTranslation base // is available in this class. static const char *tr (const char *a) { return a; } - static HRESULT setError (HRESULT rc, - const char * /* a */, - const char * /* b */, - void * /* c */) { return rc; } + static HRESULT setError(HRESULT rc, + const char * /* a */, + const char * /* b */, + void * /* c */) { return rc; } HRESULT mResultCode; Bstr mText; diff --git a/src/VBox/Main/linux/HostHardwareLinux.cpp b/src/VBox/Main/linux/HostHardwareLinux.cpp index a4899edfdcf..d53f7feb7ea 100644 --- a/src/VBox/Main/linux/HostHardwareLinux.cpp +++ b/src/VBox/Main/linux/HostHardwareLinux.cpp @@ -1165,12 +1165,12 @@ public: DBusError &get () { return mError; } bool IsSet () { - Assert ((mError.name == NULL) == (mError.message == NULL)); + Assert((mError.name == NULL) == (mError.message == NULL)); return (mError.name != NULL); } bool HasName (const char *pcszName) { - Assert ((mError.name == NULL) == (mError.message == NULL)); + Assert((mError.name == NULL) == (mError.message == NULL)); return (RTStrCmp (mError.name, pcszName) == 0); } void FlowLog () @@ -1623,10 +1623,10 @@ int halGetPropertyStringsVector (DBusConnection *pConnection, *pfSuccess = halSuccess; if (RT_SUCCESS(rc) && halSuccess) { - Assert (pMatches->size() == cProps); - AssertForEach (j, size_t, 0, cProps, (pfMatches == NULL) - || (pfMatches[j] == true) - || ((pfMatches[j] == false) && (pMatches[j].size() == 0))); + Assert(pMatches->size() == cProps); + AssertForEach(j, size_t, 0, cProps, (pfMatches == NULL) + || (pfMatches[j] == true) + || ((pfMatches[j] == false) && (pMatches[j].size() == 0))); } LogFlowFunc (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); return rc; @@ -1653,8 +1653,8 @@ int getUSBDeviceInfoFromHal(USBDeviceInfoList *pList, bool *pfSuccess) bool halSuccess = true; /* We set this to false to abort the operation. */ autoDBusError dbusError; - RTMemAutoPtr <DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet; - RTMemAutoPtr <DBusConnection, VBoxHalShutdown> dbusConnection; + RTMemAutoPtr<DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet; + RTMemAutoPtr<DBusConnection, VBoxHalShutdown> dbusConnection; DBusMessageIter iterFind, iterUdis; /* Connect to hal */ @@ -1664,44 +1664,44 @@ int getUSBDeviceInfoFromHal(USBDeviceInfoList *pList, bool *pfSuccess) /* Get an array of all devices in the usb_device subsystem */ if (halSuccess && RT_SUCCESS(rc)) { - rc = halFindDeviceStringMatch (dbusConnection.get(), "info.subsystem", - "usb_device", &replyFind); + rc = halFindDeviceStringMatch(dbusConnection.get(), "info.subsystem", + "usb_device", &replyFind); if (!replyFind) halSuccess = false; } if (halSuccess && RT_SUCCESS(rc)) { - dbus_message_iter_init (replyFind.get(), &iterFind); + dbus_message_iter_init(replyFind.get(), &iterFind); if (dbus_message_iter_get_arg_type (&iterFind) != DBUS_TYPE_ARRAY) halSuccess = false; } /* Recurse down into the array and query interesting information about the * entries. */ if (halSuccess && RT_SUCCESS(rc)) - dbus_message_iter_recurse (&iterFind, &iterUdis); + dbus_message_iter_recurse(&iterFind, &iterUdis); for (; halSuccess && RT_SUCCESS(rc) - && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; + && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING; dbus_message_iter_next(&iterUdis)) { /* Get the device node and the sysfs path for the current entry. */ const char *pszUdi; dbus_message_iter_get_basic (&iterUdis, &pszUdi); static const char *papszKeys[] = { "linux.device_file", "linux.sysfs_path" }; - char *papszValues[RT_ELEMENTS (papszKeys)]; - rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys), - papszKeys, papszValues, &replyGet); + char *papszValues[RT_ELEMENTS(papszKeys)]; + rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys), + papszKeys, papszValues, &replyGet); const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1]; /* Get the interfaces. */ if (!!replyGet && pszDevice && pszSysfsPath) { - USBDeviceInfo info (pszDevice, pszSysfsPath); + USBDeviceInfo info(pszDevice, pszSysfsPath); bool ifaceSuccess = true; /* If we can't get the interfaces, just * skip this one device. */ - rc = getUSBInterfacesFromHal (&info.mInterfaces, pszUdi, &ifaceSuccess); + rc = getUSBInterfacesFromHal(&info.mInterfaces, pszUdi, &ifaceSuccess); if (RT_SUCCESS(rc) && halSuccess && ifaceSuccess) try { - pList->push_back (info); + pList->push_back(info); } catch(std::bad_alloc &e) { @@ -1713,7 +1713,7 @@ int getUSBDeviceInfoFromHal(USBDeviceInfoList *pList, bool *pfSuccess) rc = VERR_NO_MEMORY; if (pfSuccess != NULL) *pfSuccess = halSuccess; - LogFlow (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); + LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); dbusError.FlowLog(); return rc; } @@ -1738,56 +1738,56 @@ int getOldUSBDeviceInfoFromHal(USBDeviceInfoList *pList, bool *pfSuccess) bool halSuccess = true; /* We set this to false to abort the operation. */ autoDBusError dbusError; - RTMemAutoPtr <DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet; - RTMemAutoPtr <DBusConnection, VBoxHalShutdown> dbusConnection; + RTMemAutoPtr<DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet; + RTMemAutoPtr<DBusConnection, VBoxHalShutdown> dbusConnection; DBusMessageIter iterFind, iterUdis; /* Connect to hal */ - rc = halInit (&dbusConnection); + rc = halInit(&dbusConnection); if (!dbusConnection) halSuccess = false; /* Get an array of all devices in the usb_device subsystem */ if (halSuccess && RT_SUCCESS(rc)) { - rc = halFindDeviceStringMatch (dbusConnection.get(), "info.category", + rc = halFindDeviceStringMatch(dbusConnection.get(), "info.category", "usbraw", &replyFind); if (!replyFind) halSuccess = false; } if (halSuccess && RT_SUCCESS(rc)) { - dbus_message_iter_init (replyFind.get(), &iterFind); - if (dbus_message_iter_get_arg_type (&iterFind) != DBUS_TYPE_ARRAY) + dbus_message_iter_init(replyFind.get(), &iterFind); + if (dbus_message_iter_get_arg_type(&iterFind) != DBUS_TYPE_ARRAY) halSuccess = false; } /* Recurse down into the array and query interesting information about the * entries. */ if (halSuccess && RT_SUCCESS(rc)) - dbus_message_iter_recurse (&iterFind, &iterUdis); + dbus_message_iter_recurse(&iterFind, &iterUdis); for (; halSuccess && RT_SUCCESS(rc) - && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; + && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING; dbus_message_iter_next(&iterUdis)) { /* Get the device node and the sysfs path for the current entry. */ const char *pszUdi; - dbus_message_iter_get_basic (&iterUdis, &pszUdi); + dbus_message_iter_get_basic(&iterUdis, &pszUdi); static const char *papszKeys[] = { "linux.device_file", "info.parent" }; - char *papszValues[RT_ELEMENTS (papszKeys)]; - rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys), - papszKeys, papszValues, &replyGet); + char *papszValues[RT_ELEMENTS(papszKeys)]; + rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys), + papszKeys, papszValues, &replyGet); const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1]; /* Get the interfaces. */ if (!!replyGet && pszDevice && pszSysfsPath) { - USBDeviceInfo info (pszDevice, pszSysfsPath); + USBDeviceInfo info(pszDevice, pszSysfsPath); bool ifaceSuccess = false; /* If we can't get the interfaces, just * skip this one device. */ - rc = getUSBInterfacesFromHal (&info.mInterfaces, pszSysfsPath, - &ifaceSuccess); + rc = getUSBInterfacesFromHal(&info.mInterfaces, pszSysfsPath, + &ifaceSuccess); if (RT_SUCCESS(rc) && halSuccess && ifaceSuccess) try { - pList->push_back (info); + pList->push_back(info); } catch(std::bad_alloc &e) { @@ -1795,11 +1795,11 @@ int getOldUSBDeviceInfoFromHal(USBDeviceInfoList *pList, bool *pfSuccess) } } } - if (dbusError.HasName (DBUS_ERROR_NO_MEMORY)) + if (dbusError.HasName(DBUS_ERROR_NO_MEMORY)) rc = VERR_NO_MEMORY; if (pfSuccess != NULL) *pfSuccess = halSuccess; - LogFlow (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); + LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); dbusError.FlowLog(); return rc; } @@ -1821,11 +1821,11 @@ int getOldUSBDeviceInfoFromHal(USBDeviceInfoList *pList, bool *pfSuccess) int getUSBInterfacesFromHal(std::vector<iprt::MiniString> *pList, const char *pcszUdi, bool *pfSuccess) { - AssertReturn(VALID_PTR (pList) && VALID_PTR (pcszUdi) && + AssertReturn(VALID_PTR(pList) && VALID_PTR(pcszUdi) && (pfSuccess == NULL || VALID_PTR (pfSuccess)), VERR_INVALID_POINTER); - LogFlowFunc (("pList=%p, pcszUdi=%s, pfSuccess=%p\n", pList, pcszUdi, - pfSuccess)); + LogFlowFunc(("pList=%p, pcszUdi=%s, pfSuccess=%p\n", pList, pcszUdi, + pfSuccess)); int rc = VINF_SUCCESS; /* We set this to failure on fatal errors. */ bool halSuccess = true; /* We set this to false to abort the operation. */ autoDBusError dbusError; @@ -1834,37 +1834,37 @@ int getUSBInterfacesFromHal(std::vector<iprt::MiniString> *pList, RTMemAutoPtr <DBusConnection, VBoxHalShutdown> dbusConnection; DBusMessageIter iterFind, iterUdis; - rc = halInit (&dbusConnection); + rc = halInit(&dbusConnection); if (!dbusConnection) halSuccess = false; if (halSuccess && RT_SUCCESS(rc)) { /* Look for children of the current UDI. */ - rc = halFindDeviceStringMatch (dbusConnection.get(), "info.parent", - pcszUdi, &replyFind); + rc = halFindDeviceStringMatch(dbusConnection.get(), "info.parent", + pcszUdi, &replyFind); if (!replyFind) halSuccess = false; } if (halSuccess && RT_SUCCESS(rc)) { - dbus_message_iter_init (replyFind.get(), &iterFind); - if (dbus_message_iter_get_arg_type (&iterFind) != DBUS_TYPE_ARRAY) + dbus_message_iter_init(replyFind.get(), &iterFind); + if (dbus_message_iter_get_arg_type(&iterFind) != DBUS_TYPE_ARRAY) halSuccess = false; } if (halSuccess && RT_SUCCESS(rc)) - dbus_message_iter_recurse (&iterFind, &iterUdis); + dbus_message_iter_recurse(&iterFind, &iterUdis); for (; halSuccess && RT_SUCCESS(rc) - && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; + && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING; dbus_message_iter_next(&iterUdis)) { /* Now get the sysfs path and the subsystem from the iterator */ const char *pszUdi; - dbus_message_iter_get_basic (&iterUdis, &pszUdi); + dbus_message_iter_get_basic(&iterUdis, &pszUdi); static const char *papszKeys[] = { "linux.sysfs_path", "info.subsystem", "linux.subsystem" }; - char *papszValues[RT_ELEMENTS (papszKeys)]; - rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys), - papszKeys, papszValues, &replyGet); + char *papszValues[RT_ELEMENTS(papszKeys)]; + rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys), + papszKeys, papszValues, &replyGet); const char *pszSysfsPath = papszValues[0], *pszInfoSubsystem = papszValues[1], *pszLinuxSubsystem = papszValues[2]; if (!replyGet) @@ -1876,18 +1876,18 @@ int getUSBInterfacesFromHal(std::vector<iprt::MiniString> *pList, && RTStrCmp (pszLinuxSubsystem, "usb_device") != 0) try { - pList->push_back (pszSysfsPath); + pList->push_back(pszSysfsPath); } catch(std::bad_alloc &e) { rc = VERR_NO_MEMORY; } } - if (dbusError.HasName (DBUS_ERROR_NO_MEMORY)) + if (dbusError.HasName(DBUS_ERROR_NO_MEMORY)) rc = VERR_NO_MEMORY; if (pfSuccess != NULL) *pfSuccess = halSuccess; - LogFlow (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); + LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); dbusError.FlowLog(); return rc; } @@ -1905,14 +1905,14 @@ int getUSBInterfacesFromHal(std::vector<iprt::MiniString> *pList, * @param pvUser A pointer to the flag variable we are to set. */ /* static */ -DBusHandlerResult dbusFilterFunction (DBusConnection * /* pConnection */, - DBusMessage *pMessage, void *pvUser) +DBusHandlerResult dbusFilterFunction(DBusConnection * /* pConnection */, + DBusMessage *pMessage, void *pvUser) { - volatile bool *pTriggered = reinterpret_cast<volatile bool *> (pvUser); - if ( dbus_message_is_signal (pMessage, "org.freedesktop.Hal.Manager", - "DeviceAdded") - || dbus_message_is_signal (pMessage, "org.freedesktop.Hal.Manager", - "DeviceRemoved")) + volatile bool *pTriggered = reinterpret_cast<volatile bool *>(pvUser); + if ( dbus_message_is_signal(pMessage, "org.freedesktop.Hal.Manager", + "DeviceAdded") + || dbus_message_is_signal(pMessage, "org.freedesktop.Hal.Manager", + "DeviceRemoved")) { *pTriggered = true; } diff --git a/src/VBox/Main/testcase/tstVBoxAPILinux.cpp b/src/VBox/Main/testcase/tstVBoxAPILinux.cpp index 89d0dacef7f..8e4b4c5c46a 100644 --- a/src/VBox/Main/testcase/tstVBoxAPILinux.cpp +++ b/src/VBox/Main/testcase/tstVBoxAPILinux.cpp @@ -123,11 +123,11 @@ void listVMs(IVirtualBox *virtualBox) */ for (PRUint32 i = 0; i < machineCnt; ++ i) { - IMachine *machine = machines [i]; + IMachine *machine = machines[i]; if (machine) { PRBool isAccessible = PR_FALSE; - machine->GetAccessible (&isAccessible); + machine->GetAccessible(&isAccessible); if (isAccessible) { diff --git a/src/VBox/Main/win/NetIf-win.cpp b/src/VBox/Main/win/NetIf-win.cpp index b31e6ebe902..a422bf352ed 100644 --- a/src/VBox/Main/win/NetIf-win.cpp +++ b/src/VBox/Main/win/NetIf-win.cpp @@ -876,7 +876,7 @@ static BOOL IsUACEnabled() "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_QUERY_VALUE, &hKey); - Assert (rc == ERROR_SUCCESS || rc == ERROR_PATH_NOT_FOUND); + Assert(rc == ERROR_SUCCESS || rc == ERROR_PATH_NOT_FOUND); if (rc == ERROR_SUCCESS) { @@ -886,7 +886,7 @@ static BOOL IsUACEnabled() RegCloseKey (hKey); - Assert (rc == ERROR_SUCCESS || rc == ERROR_FILE_NOT_FOUND); + Assert(rc == ERROR_SUCCESS || rc == ERROR_FILE_NOT_FOUND); } LogFlowFunc (("rc=%d, dwEnableLUA=%d\n", rc, dwEnableLUA)); diff --git a/src/VBox/Main/win/svchlp.cpp b/src/VBox/Main/win/svchlp.cpp index 9dbf61b319a..78e730ddcf9 100644 --- a/src/VBox/Main/win/svchlp.cpp +++ b/src/VBox/Main/win/svchlp.cpp @@ -234,7 +234,7 @@ int SVCHlpClient::read (Utf8Str &aVal) } aVal.reserve(len + 1); - aVal.mutableRaw() [len] = 0; + aVal.mutableRaw()[len] = 0; /* read string data */ vrc = read (aVal.mutableRaw(), len); @@ -282,14 +282,13 @@ int SVCHlpServer::run() case SVCHlpMsg::DhcpRediscover: { #ifdef VBOX_WITH_NETFLT - vrc = netIfNetworkInterfaceHelperServer (this, msgCode); + vrc = netIfNetworkInterfaceHelperServer(this, msgCode); #endif break; } default: - AssertMsgFailedReturn (( - "Invalid message code %d (%08lX)\n", msgCode, msgCode), - VERR_GENERAL_FAILURE); + AssertMsgFailedReturn(("Invalid message code %d (%08lX)\n", msgCode, msgCode), + VERR_GENERAL_FAILURE); } if (RT_FAILURE(vrc)) diff --git a/src/VBox/Main/win/svcmain.cpp b/src/VBox/Main/win/svcmain.cpp index 68cde5055cf..693c0124624 100644 --- a/src/VBox/Main/win/svcmain.cpp +++ b/src/VBox/Main/win/svcmain.cpp @@ -232,9 +232,9 @@ extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, if (*lpszToken != NULL) { Bstr str (lpszToken); - LPCTSTR lpszToken2 = FindOneOf (lpszToken, szTokens); + LPCTSTR lpszToken2 = FindOneOf(lpszToken, szTokens); if (lpszToken2) - str.mutableRaw() [lpszToken2 - lpszToken] = '\0'; + str.mutableRaw()[lpszToken2 - lpszToken] = '\0'; pipeName = Utf8Str(lpszToken); } } diff --git a/src/VBox/Main/xpcom/server.cpp b/src/VBox/Main/xpcom/server.cpp index 4324ec6b54e..15c43523b24 100644 --- a/src/VBox/Main/xpcom/server.cpp +++ b/src/VBox/Main/xpcom/server.cpp @@ -977,7 +977,7 @@ int main(int argc, char **argv) } nsCOMPtr<ipcIService> ipcServ (do_GetService(IPC_SERVICE_CONTRACTID, &rc)); - if (NS_FAILED (rc)) + if (NS_FAILED(rc)) { RTMsgError("Failed to get IPC service! (rc=%Rhrc)", rc); break; diff --git a/src/VBox/Main/xpcom/server_module.cpp b/src/VBox/Main/xpcom/server_module.cpp index 395f6eedb1a..1679e45bb03 100644 --- a/src/VBox/Main/xpcom/server_module.cpp +++ b/src/VBox/Main/xpcom/server_module.cpp @@ -83,7 +83,7 @@ enum /** * Full path to the VBoxSVC executable. */ -static char VBoxSVCPath [RTPATH_MAX]; +static char VBoxSVCPath[RTPATH_MAX]; static bool IsVBoxSVCPathSet = false; /* @@ -159,12 +159,12 @@ VirtualBoxConstructor (nsISupports *aOuter, REFNSIID aIID, #endif } } - if (NS_FAILED (rc)) + if (NS_FAILED(rc)) break; } nsCOMPtr <ipcIService> ipcServ = do_GetService (IPC_SERVICE_CONTRACTID, &rc); - if (NS_FAILED (rc)) + if (NS_FAILED(rc)) break; /* connect to the VBoxSVC server process */ @@ -178,7 +178,7 @@ VirtualBoxConstructor (nsISupports *aOuter, REFNSIID aIID, PRUint32 serverID = 0; rc = ipcServ->ResolveClientName (VBOXSVC_IPC_NAME, &serverID); - if (NS_FAILED (rc)) + if (NS_FAILED(rc)) { LogFlowFunc (("Starting server \"%s\"...\n", VBoxSVCPath)); @@ -240,7 +240,7 @@ VirtualBoxConstructor (nsISupports *aOuter, REFNSIID aIID, nsCOMPtr <ipcIDConnectService> dconServ = do_GetService (IPC_DCONNECTSERVICE_CONTRACTID, &rc); - if (NS_FAILED (rc)) + if (NS_FAILED(rc)) break; rc = dconServ->CreateInstance (serverID, |