VirtualBox

Changeset 26186 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Feb 3, 2010 1:07:12 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57205
Message:

Main: coding style fixes

Location:
trunk/src/VBox/Main
Files:
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r26118 r26186  
    10351035        {
    10361036            ComPtr<IMedium> medium;
    1037             hrc = atts [j]->COMGETTER(Medium)(medium.asOutParam());                             H();
     1037            hrc = atts[j]->COMGETTER(Medium)(medium.asOutParam());                              H();
    10381038            LONG lDev;
    10391039            hrc = atts[j]->COMGETTER(Device)(&lDev);                                            H();
     
    20962096    /* Register VM state change handler */
    20972097    int rc2 = VMR3AtStateRegister (pVM, Console::vmstateChangeCallback, pConsole);
    2098     AssertRC (rc2);
     2098    AssertRC(rc2);
    20992099    if (RT_SUCCESS(rc))
    21002100        rc = rc2;
     
    21022102    /* Register VM runtime error handler */
    21032103    rc2 = VMR3AtRuntimeErrorRegister (pVM, Console::setVMRuntimeErrorCallback, pConsole);
    2104     AssertRC (rc2);
     2104    AssertRC(rc2);
    21052105    if (RT_SUCCESS(rc))
    21062106        rc = rc2;
     
    23062306            }
    23072307
    2308             Assert ((int)pThis->maTapFD[uInstance] >= 0);
     2308            Assert((int)pThis->maTapFD[uInstance] >= 0);
    23092309            if ((int)pThis->maTapFD[uInstance] >= 0)
    23102310            {
     
    25142514                }
    25152515
    2516                 Assert ((int)pThis->maTapFD[uInstance] >= 0);
     2516                Assert((int)pThis->maTapFD[uInstance] >= 0);
    25172517                if ((int)pThis->maTapFD[uInstance] >= 0)
    25182518                {
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r25901 r26186  
    4646{
    4747public:
    48     VRDPConsoleCallback (ConsoleVRDPServer *server) :
    49         m_server(server)
     48    VRDPConsoleCallback(ConsoleVRDPServer *server)
     49        : m_server(server)
    5050    {
    5151#ifndef VBOX_WITH_XPCOM
     
    6060#ifndef VBOX_WITH_XPCOM
    6161    STDMETHOD_(ULONG, AddRef)() {
    62         return ::InterlockedIncrement (&refcnt);
     62        return ::InterlockedIncrement(&refcnt);
    6363    }
    6464    STDMETHOD_(ULONG, Release)()
    6565    {
    66         long cnt = ::InterlockedDecrement (&refcnt);
     66        long cnt = ::InterlockedDecrement(&refcnt);
    6767        if (cnt == 0)
    6868            delete this;
    6969        return cnt;
    7070    }
    71     STDMETHOD(QueryInterface) (REFIID riid , void **ppObj)
     71    STDMETHOD(QueryInterface)(REFIID riid , void **ppObj)
    7272    {
    7373        if (riid == IID_IUnknown) {
     
    103103        if (m_server)
    104104        {
    105             m_server->NotifyKeyboardLedsChange (fNumLock, fCapsLock, fScrollLock);
     105            m_server->NotifyKeyboardLedsChange(fNumLock, fCapsLock, fScrollLock);
    106106        }
    107107        return S_OK;
     
    128128    }
    129129
    130     STDMETHOD(OnNetworkAdapterChange) (INetworkAdapter *aNetworkAdapter)
     130    STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *aNetworkAdapter)
    131131    {
    132132        return S_OK;
    133133    }
    134134
    135     STDMETHOD(OnSerialPortChange) (ISerialPort *aSerialPort)
     135    STDMETHOD(OnSerialPortChange)(ISerialPort *aSerialPort)
    136136    {
    137137        return S_OK;
    138138    }
    139139
    140     STDMETHOD(OnParallelPortChange) (IParallelPort *aParallelPort)
     140    STDMETHOD(OnParallelPortChange)(IParallelPort *aParallelPort)
    141141    {
    142142        return S_OK;
    143143    }
    144144
    145     STDMETHOD(OnStorageControllerChange) ()
     145    STDMETHOD(OnStorageControllerChange)()
    146146    {
    147147        return S_OK;
     
    169169    }
    170170
    171     STDMETHOD(OnSharedFolderChange) (Scope_T aScope)
     171    STDMETHOD(OnSharedFolderChange)(Scope_T aScope)
    172172    {
    173173        return S_OK;
     
    188188    }
    189189
    190     STDMETHOD(OnShowWindow) (ULONG64 *winId)
     190    STDMETHOD(OnShowWindow)(ULONG64 *winId)
    191191    {
    192192        if (!winId)
     
    212212#ifdef DEBUG_sunlover
    213213#define LOGDUMPPTR Log
    214 void dumpPointer (const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool fXorMaskRGB32)
     214void dumpPointer(const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool fXorMaskRGB32)
    215215{
    216216    unsigned i;
     
    237237    if (fXorMaskRGB32)
    238238    {
    239         uint32_t *pu32Xor = (uint32_t *)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3));
     239        uint32_t *pu32Xor = (uint32_t*)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3));
    240240
    241241        for (i = 0; i < height; i++)
     
    253253    {
    254254        /* RDP 24 bit RGB mask. */
    255         uint8_t *pu8Xor = (uint8_t *)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3));
     255        uint8_t *pu8Xor = (uint8_t*)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3));
    256256        for (i = 0; i < height; i++)
    257257        {
     
    271271#endif /* DEBUG_sunlover */
    272272
    273 static void findTopLeftBorder (const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width, uint32_t height, uint32_t *pxSkip, uint32_t *pySkip)
     273static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width, uint32_t height, uint32_t *pxSkip, uint32_t *pySkip)
    274274{
    275275    /*
     
    391391    }
    392392
    393     *pxSkip = RT_MIN (xSkipAnd, xSkipXor);
    394     *pySkip = RT_MIN (ySkipAnd, ySkipXor);
     393    *pxSkip = RT_MIN(xSkipAnd, xSkipXor);
     394    *pySkip = RT_MIN(ySkipAnd, ySkipXor);
    395395}
    396396
     
    401401 * necessary, which we try to avoid.
    402402 */
    403 static void mousePointerGenerateANDMask (uint8_t *pu8DstAndMask, int cbDstAndMask, const uint8_t *pu8SrcAlpha, int w, int h)
    404 {
    405     memset (pu8DstAndMask, 0xFF, cbDstAndMask);
     403static void mousePointerGenerateANDMask(uint8_t *pu8DstAndMask, int cbDstAndMask, const uint8_t *pu8SrcAlpha, int w, int h)
     404{
     405    memset(pu8DstAndMask, 0xFF, cbDstAndMask);
    406406
    407407    int y;
     
    431431}
    432432
    433 STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange (
    434     BOOL visible,
    435     BOOL alpha,
    436     ULONG xHot,
    437     ULONG yHot,
    438     ULONG width,
    439     ULONG height,
    440     BYTE *shape)
     433STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange(BOOL visible,
     434                                                            BOOL alpha,
     435                                                            ULONG xHot,
     436                                                            ULONG yHot,
     437                                                            ULONG width,
     438                                                            ULONG height,
     439                                                            BYTE *shape)
    441440{
    442441    LogSunlover(("VRDPConsoleCallback::OnMousePointerShapeChange: %d, %d, %lux%lu, @%lu,%lu\n", visible, alpha, width, height, xHot, yHot));
     
    448447            if (!visible)
    449448            {
    450                 m_server->MousePointerHide ();
     449                m_server->MousePointerHide();
    451450            }
    452451        }
     
    470469             */
    471470
    472             dumpPointer (shape, width, height, true);
     471            dumpPointer(shape, width, height, true);
    473472
    474473            int cbDstAndMask = (((width + 7) / 8) * height + 3) & ~3;
     
    479478            if (alpha)
    480479            {
    481                 pu8AndMask = (uint8_t *)alloca (cbDstAndMask);
    482 
    483                 mousePointerGenerateANDMask (pu8AndMask, cbDstAndMask, pu8XorMask, width, height);
     480                pu8AndMask = (uint8_t*)alloca(cbDstAndMask);
     481
     482                mousePointerGenerateANDMask(pu8AndMask, cbDstAndMask, pu8XorMask, width, height);
    484483            }
    485484
     
    493492            uint32_t xSkip = 0; /* How many columns to skip at the left. */
    494493
    495             findTopLeftBorder (pu8AndMask, pu8XorMask, width, height, &xSkip, &ySkip);
     494            findTopLeftBorder(pu8AndMask, pu8XorMask, width, height, &xSkip, &ySkip);
    496495
    497496            /* Must not skip the hot spot. */
    498             xSkip = RT_MIN (xSkip, xHot);
    499             ySkip = RT_MIN (ySkip, yHot);
     497            xSkip = RT_MIN(xSkip, xHot);
     498            ySkip = RT_MIN(ySkip, yHot);
    500499
    501500            /*
     
    515514            uint32_t rdpdatalen = dstheight * rdpdatawidth;
    516515
    517             pointer = (VRDPCOLORPOINTER *)RTMemTmpAlloc (sizeof (VRDPCOLORPOINTER) + rdpmasklen + rdpdatalen);
     516            pointer = (VRDPCOLORPOINTER *)RTMemTmpAlloc(sizeof(VRDPCOLORPOINTER) + rdpmasklen + rdpdatalen);
    518517
    519518            if (pointer)
    520519            {
    521                 uint8_t *maskarray = (uint8_t *)pointer + sizeof (VRDPCOLORPOINTER);
     520                uint8_t *maskarray = (uint8_t*)pointer + sizeof(VRDPCOLORPOINTER);
    522521                uint8_t *dataarray = maskarray + rdpmasklen;
    523522
    524                 memset (maskarray, 0xFF, rdpmasklen);
    525                 memset (dataarray, 0x00, rdpdatalen);
     523                memset(maskarray, 0xFF, rdpmasklen);
     524                memset(dataarray, 0x00, rdpdatalen);
    526525
    527526                uint32_t srcmaskwidth = (width + 7) / 8;
     
    532531                uint8_t *dst = maskarray + (dstheight - 1) * rdpmaskwidth;
    533532
    534                 uint32_t minheight = RT_MIN (height - ySkip, dstheight);
    535                 uint32_t minwidth = RT_MIN (width - xSkip, dstwidth);
     533                uint32_t minheight = RT_MIN(height - ySkip, dstheight);
     534                uint32_t minwidth = RT_MIN(width - xSkip, dstwidth);
    536535
    537536                unsigned x, y;
     
    567566                    for (x = 0; x < minwidth; x++)
    568567                    {
    569                         memcpy (dst + x * 3, &src[4 * (x + xSkip)], 3);
     568                        memcpy(dst + x * 3, &src[4 * (x + xSkip)], 3);
    570569                    }
    571570
     
    583582                pointer->u16DataLen = (uint16_t)rdpdatalen;
    584583
    585                 dumpPointer ((uint8_t *)pointer + sizeof (*pointer), dstwidth, dstheight, false);
    586 
    587                 m_server->MousePointerUpdate (pointer);
    588 
    589                 RTMemTmpFree (pointer);
     584                dumpPointer((uint8_t*)pointer + sizeof(*pointer), dstwidth, dstheight, false);
     585
     586                m_server->MousePointerUpdate(pointer);
     587
     588                RTMemTmpFree(pointer);
    590589            }
    591590        }
     
    608607VRDPCALLBACKS_1 ConsoleVRDPServer::mCallbacks =
    609608{
    610     { VRDP_INTERFACE_VERSION_1, sizeof (VRDPCALLBACKS_1) },
     609    { VRDP_INTERFACE_VERSION_1, sizeof(VRDPCALLBACKS_1) },
    611610    ConsoleVRDPServer::VRDPCallbackQueryProperty,
    612611    ConsoleVRDPServer::VRDPCallbackClientLogon,
     
    623622};
    624623
    625 DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty (void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut)
    626 {
    627     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     624DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut)
     625{
     626    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    628627
    629628    int rc = VERR_NOT_SUPPORTED;
     
    636635            ULONG port = 0;
    637636
    638             if (cbBuffer >= sizeof (uint32_t))
     637            if (cbBuffer >= sizeof(uint32_t))
    639638            {
    640639                *(uint32_t *)pvBuffer = (uint32_t)port;
     
    646645            }
    647646
    648             *pcbOut = sizeof (uint32_t);
     647            *pcbOut = sizeof(uint32_t);
    649648        } break;
    650649
     
    652651        {
    653652            com::Bstr bstr;
    654             server->mConsole->getVRDPServer ()->COMGETTER(NetAddress) (bstr.asOutParam());
     653            server->mConsole->getVRDPServer()->COMGETTER(NetAddress)(bstr.asOutParam());
    655654
    656655            /* The server expects UTF8. */
    657656            com::Utf8Str address = bstr;
    658657
    659             size_t cbAddress = address.length () + 1;
     658            size_t cbAddress = address.length() + 1;
    660659
    661660            if (cbAddress >= 0x10000)
     
    672671                    if (address.raw())
    673672                    {
    674                         memcpy (pvBuffer, address.raw(), cbAddress);
     673                        memcpy(pvBuffer, address.raw(), cbAddress);
    675674                    }
    676675                    else
     
    695694            ULONG cMonitors = 1;
    696695
    697             server->mConsole->machine ()->COMGETTER(MonitorCount)(&cMonitors);
    698 
    699             if (cbBuffer >= sizeof (uint32_t))
     696            server->mConsole->machine()->COMGETTER(MonitorCount)(&cMonitors);
     697
     698            if (cbBuffer >= sizeof(uint32_t))
    700699            {
    701700                *(uint32_t *)pvBuffer = (uint32_t)cMonitors;
     
    707706            }
    708707
    709             *pcbOut = sizeof (uint32_t);
     708            *pcbOut = sizeof(uint32_t);
    710709        } break;
    711710
     
    713712        {
    714713            com::Bstr bstr;
    715             HRESULT hrc = server->mConsole->getVRDPServer ()->COMGETTER(Ports) (bstr.asOutParam());
     714            HRESULT hrc = server->mConsole->getVRDPServer()->COMGETTER(Ports)(bstr.asOutParam());
    716715
    717716            if (hrc != S_OK)
     
    743742                    if (portRange.raw())
    744743                    {
    745                         memcpy (pvBuffer, portRange.raw(), cbPortRange);
     744                        memcpy(pvBuffer, portRange.raw(), cbPortRange);
    746745                    }
    747746                    else
     
    764763        case VRDP_SP_NETWORK_BIND_PORT:
    765764        {
    766             if (cbBuffer != sizeof (uint32_t))
     765            if (cbBuffer != sizeof(uint32_t))
    767766            {
    768767                rc = VERR_INVALID_PARAMETER;
     
    778777            if (pcbOut)
    779778            {
    780                 *pcbOut = sizeof (uint32_t);
    781             }
    782 
    783             server->mConsole->onRemoteDisplayInfoChange ();
     779                *pcbOut = sizeof(uint32_t);
     780            }
     781
     782            server->mConsole->onRemoteDisplayInfoChange();
    784783        } break;
    785784
     
    791790}
    792791
    793 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon (void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain)
    794 {
    795     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     792DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon(void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain)
     793{
     794    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    796795
    797796    return server->mConsole->VRDPClientLogon (u32ClientId, pszUser, pszPassword, pszDomain);
     
    800799DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect (void *pvCallback, uint32_t u32ClientId)
    801800{
    802     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     801    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    803802
    804803    server->mConsole->VRDPClientConnect (u32ClientId);
     
    807806DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercepted)
    808807{
    809     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     808    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    810809
    811810    server->mConsole->VRDPClientDisconnect (u32ClientId, fu32Intercepted);
     
    814813DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackIntercept (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept, void **ppvIntercept)
    815814{
    816     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     815    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    817816
    818817    LogFlowFunc(("%x\n", fu32Intercept));
     
    871870DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery (void *pvCallback, unsigned uScreenId, VRDPFRAMEBUFFERINFO *pInfo)
    872871{
    873     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     872    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    874873
    875874    bool fAvailable = false;
     
    926925DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock (void *pvCallback, unsigned uScreenId)
    927926{
    928     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     927    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    929928
    930929    if (server->maFramebuffers[uScreenId])
     
    936935DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock (void *pvCallback, unsigned uScreenId)
    937936{
    938     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     937    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    939938
    940939    if (server->maFramebuffers[uScreenId])
     
    964963DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput (void *pvCallback, int type, const void *pvInput, unsigned cbInput)
    965964{
    966     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
     965    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
    967966    Console *pConsole = server->mConsole;
    968967
     
    10931092DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint (void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId)
    10941093{
    1095     ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *> (pvCallback);
    1096 
    1097     server->mConsole->getDisplay ()->SetVideoModeHint(cWidth, cHeight, cBitsPerPixel, uScreenId);
     1094    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
     1095
     1096    server->mConsole->getDisplay()->SetVideoModeHint(cWidth, cHeight, cBitsPerPixel, uScreenId);
    10981097}
    10991098#endif /* VBOX_WITH_VRDP */
     
    11031102    mConsole = console;
    11041103
    1105     int rc = RTCritSectInit (&mCritSect);
    1106     AssertRC (rc);
     1104    int rc = RTCritSectInit(&mCritSect);
     1105    AssertRC(rc);
    11071106
    11081107    mcClipboardRefs = 0;
     
    13381337    mUSBBackends.fThreadRunning = true;
    13391338    int rc = RTThreadUserSignal (thread);
    1340     AssertRC (rc);
     1339    AssertRC(rc);
    13411340}
    13421341
     
    13781377        /* Wait until the thread is ready. */
    13791378        rc = RTThreadUserWait (mUSBBackends.thread, 60000);
    1380         AssertRC (rc);
     1379        AssertRC(rc);
    13811380        Assert (mUSBBackends.fThreadRunning || RT_FAILURE(rc));
    13821381    }
     
    13941393
    13951394        int rc = RTThreadWait (mUSBBackends.thread, 60000, NULL);
    1396         AssertRC (rc);
     1395        AssertRC(rc);
    13971396
    13981397        mUSBBackends.thread = NIL_RTTHREAD;
     
    14861485        if (RT_FAILURE(rc))
    14871486        {
    1488             mConsole->reportAuthLibraryError (filename.raw(), rc);
     1487            mConsole->reportAuthLibraryError(filename.raw(), rc);
    14891488
    14901489            mpfnAuthEntry = NULL;
     
    15461545{
    15471546    int rc = RTCritSectEnter (&mCritSect);
    1548     AssertRC (rc);
     1547    AssertRC(rc);
    15491548    return rc;
    15501549}
     
    19411940#ifdef VBOX_WITH_USB
    19421941    int rc = lockConsoleVRDPServer ();
    1943     AssertRC (rc);
     1942    AssertRC(rc);
    19441943
    19451944    /* Exclude the found instance from the list. */
  • trunk/src/VBox/Main/DHCPServerRunner.cpp

    r26163 r26186  
    8686
    8787    /* get the path to the executable */
    88     char exePathBuf [RTPATH_MAX];
    89     const char *exePath = RTProcGetExecutableName (exePathBuf, RTPATH_MAX);
     88    char exePathBuf[RTPATH_MAX];
     89    const char *exePath = RTProcGetExecutableName(exePathBuf, RTPATH_MAX);
    9090    char *substrSl = strrchr(exePathBuf, '/');
    9191    char *substrBs = strrchr(exePathBuf, '\\');
     
    121121    args[index++] = NULL;
    122122
    123     int rc = RTProcCreate (exePath, args, RTENV_DEFAULT, 0, &mProcess);
     123    int rc = RTProcCreate(exePath, args, RTENV_DEFAULT, 0, &mProcess);
    124124    if (RT_FAILURE(rc))
    125125        mProcess = NIL_RTPROCESS;
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r26173 r26186  
    105105
    106106#ifdef VBOX_WITH_OLD_VBVA_LOCK
    107     int rc = RTCritSectInit (&mVBVALock);
    108     AssertRC (rc);
     107    int rc = RTCritSectInit(&mVBVALock);
     108    AssertRC(rc);
    109109    mfu32PendingVideoAccelDisable = false;
    110110#endif /* VBOX_WITH_OLD_VBVA_LOCK */
     
    22472247
    22482248    if (vrc == VERR_NOT_IMPLEMENTED)
    2249         rc = setError (E_NOTIMPL,
    2250                        tr ("This feature is not implemented"));
     2249        rc = setError(E_NOTIMPL,
     2250                      tr("This feature is not implemented"));
    22512251    else if (RT_FAILURE(vrc))
    2252         rc = setError (VBOX_E_IPRT_ERROR,
    2253                        tr ("Could not take a screenshot (%Rrc)"), vrc);
     2252        rc = setError(VBOX_E_IPRT_ERROR,
     2253                      tr("Could not take a screenshot (%Rrc)"), vrc);
    22542254
    22552255    LogFlowFunc (("rc=%08X\n", rc));
     
    23232323    }
    23242324    else if (vrc == VERR_NOT_IMPLEMENTED)
    2325         rc = setError (E_NOTIMPL,
    2326                        tr ("This feature is not implemented"));
     2325        rc = setError(E_NOTIMPL,
     2326                      tr("This feature is not implemented"));
    23272327    else
    2328         rc = setError (VBOX_E_IPRT_ERROR,
    2329                        tr ("Could not take a screenshot (%Rrc)"), vrc);
     2328        rc = setError(VBOX_E_IPRT_ERROR,
     2329                      tr("Could not take a screenshot (%Rrc)"), vrc);
    23302330
    23312331    LogFlowFunc (("rc=%08X\n", rc));
     
    23952395    }
    23962396    else if (RT_FAILURE(rcVBox))
    2397         rc = setError (VBOX_E_IPRT_ERROR,
    2398             tr ("Could not draw to the screen (%Rrc)"), rcVBox);
     2397        rc = setError(VBOX_E_IPRT_ERROR,
     2398                      tr("Could not draw to the screen (%Rrc)"), rcVBox);
    23992399//@todo
    24002400//    else
     
    24562456
    24572457    if (RT_FAILURE(rcVBox))
    2458         rc = setError (VBOX_E_IPRT_ERROR,
    2459             tr ("Could not invalidate and update the screen (%Rrc)"), rcVBox);
     2458        rc = setError(VBOX_E_IPRT_ERROR,
     2459                      tr("Could not invalidate and update the screen (%Rrc)"), rcVBox);
    24602460
    24612461    LogFlowFunc (("rc=%08X\n", rc));
     
    24872487    /* this is only valid for external framebuffers */
    24882488    if (maFramebuffers[aScreenId].pFramebuffer == NULL)
    2489         return setError (VBOX_E_NOT_SUPPORTED,
    2490             tr ("Resize completed notification is valid only "
    2491                 "for external framebuffers"));
     2489        return setError(VBOX_E_NOT_SUPPORTED,
     2490                        tr("Resize completed notification is valid only for external framebuffers"));
    24922491
    24932492    /* Set the flag indicating that the resize has completed and display
     
    25232522    /* this is only valid for external framebuffers */
    25242523    if (maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer == NULL)
    2525         return setError (VBOX_E_NOT_SUPPORTED,
    2526             tr ("Resize completed notification is valid only "
    2527                 "for external framebuffers"));
     2524        return setError(VBOX_E_NOT_SUPPORTED,
     2525                        tr("Resize completed notification is valid only for external framebuffers"));
    25282526
    25292527    return S_OK;
  • trunk/src/VBox/Main/GuestImpl.cpp

    r25860 r26186  
    283283    }
    284284
    285     return setError (VBOX_E_VM_ERROR,
    286         tr ("VMM device is not available (is the VM running?)"));
     285    return setError(VBOX_E_VM_ERROR,
     286                    tr("VMM device is not available (is the VM running?)"));
    287287}
    288288
  • trunk/src/VBox/Main/HostImpl.cpp

    r26177 r26186  
    225225     */
    226226# if defined (RT_OS_DARWIN)
    227     m->pUSBProxyService = new USBProxyServiceDarwin (this);
     227    m->pUSBProxyService = new USBProxyServiceDarwin(this);
    228228# elif defined (RT_OS_LINUX)
    229     m->pUSBProxyService = new USBProxyServiceLinux (this);
     229    m->pUSBProxyService = new USBProxyServiceLinux(this);
    230230# elif defined (RT_OS_OS2)
    231231    m->pUSBProxyService = new USBProxyServiceOs2 (this);
    232232# elif defined (RT_OS_SOLARIS)
    233     m->pUSBProxyService = new USBProxyServiceSolaris (this);
     233    m->pUSBProxyService = new USBProxyServiceSolaris(this);
    234234# elif defined (RT_OS_WINDOWS)
    235     m->pUSBProxyService = new USBProxyServiceWindows (this);
     235    m->pUSBProxyService = new USBProxyServiceWindows(this);
    236236# elif defined (RT_OS_FREEBSD)
    237     m->pUSBProxyService = new USBProxyServiceFreeBSD (this);
     237    m->pUSBProxyService = new USBProxyServiceFreeBSD(this);
    238238# else
    239     m->pUSBProxyService = new USBProxyService (this);
     239    m->pUSBProxyService = new USBProxyService(this);
    240240# endif
    241241    HRESULT hrc = m->pUSBProxyService->init();
     
    248248
    249249#if defined (RT_OS_WINDOWS)
    250     m->pHostPowerService = new HostPowerServiceWin (m->pParent);
     250    m->pHostPowerService = new HostPowerServiceWin(m->pParent);
    251251#elif defined (RT_OS_DARWIN)
    252     m->pHostPowerService = new HostPowerServiceDarwin (m->pParent);
     252    m->pHostPowerService = new HostPowerServiceDarwin(m->pParent);
    253253#else
    254     m->pHostPowerService = new HostPowerService (m->pParent);
     254    m->pHostPowerService = new HostPowerService(m->pParent);
    255255#endif
    256256
     
    11571157    ComObjPtr<HostUSBDeviceFilter> filter;
    11581158    filter.createObject();
    1159     HRESULT rc = filter->init (this, aName);
     1159    HRESULT rc = filter->init(this, aName);
    11601160    ComAssertComRCRet (rc, rc);
    11611161    rc = filter.queryInterfaceTo(aFilter);
     
    12031203
    12041204    if (pFilter->mInList)
    1205         return setError (E_INVALIDARG,
    1206             tr ("The given USB device filter is already in the list"));
     1205        return setError(E_INVALIDARG,
     1206                        tr("The given USB device filter is already in the list"));
    12071207
    12081208    /* iterate to the position... */
     
    12481248
    12491249    if (!m->llUSBDeviceFilters.size())
    1250         return setError (E_INVALIDARG,
    1251             tr ("The USB device filter list is empty"));
     1250        return setError(E_INVALIDARG,
     1251                        tr("The USB device filter list is empty"));
    12521252
    12531253    if (aPosition >= m->llUSBDeviceFilters.size())
    1254         return setError (E_INVALIDARG,
    1255             tr ("Invalid position: %lu (must be in range [0, %lu])"),
    1256             aPosition, m->llUSBDeviceFilters.size() - 1);
     1254        return setError(E_INVALIDARG,
     1255                        tr("Invalid position: %lu (must be in range [0, %lu])"),
     1256                        aPosition, m->llUSBDeviceFilters.size() - 1);
    12571257
    12581258    ComObjPtr<HostUSBDeviceFilter> filter;
     
    13691369
    13701370    if (!found)
    1371         return setError (E_INVALIDARG, HostNetworkInterface::tr (
    1372                              "The host network interface with the given name could not be found"));
     1371        return setError(E_INVALIDARG,
     1372                        HostNetworkInterface::tr("The host network interface with the given name could not be found"));
    13731373
    13741374    found->setVirtualBox(m->pParent);
     
    14071407
    14081408    if (!found)
    1409         return setError (E_INVALIDARG, HostNetworkInterface::tr (
    1410                              "The host network interface with the given GUID could not be found"));
     1409        return setError(E_INVALIDARG,
     1410                        HostNetworkInterface::tr("The host network interface with the given GUID could not be found"));
    14111411
    14121412    found->setVirtualBox(m->pParent);
     
    14481448
    14491449STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress,
    1450                                          IHostUSBDevice **aDevice)
     1450                                          IHostUSBDevice **aDevice)
    14511451{
    14521452#ifdef VBOX_WITH_USB
     
    24022402
    24032403#ifdef VBOX_WITH_RESOURCE_USAGE_API
    2404 void Host::registerMetrics (PerformanceCollector *aCollector)
     2404void Host::registerMetrics(PerformanceCollector *aCollector)
    24052405{
    24062406    pm::CollectorHAL *hal = aCollector->getHAL();
    24072407    /* Create sub metrics */
    2408     pm::SubMetric *cpuLoadUser   = new pm::SubMetric ("CPU/Load/User",
     2408    pm::SubMetric *cpuLoadUser   = new pm::SubMetric("CPU/Load/User",
    24092409        "Percentage of processor time spent in user mode.");
    2410     pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel",
     2410    pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel",
    24112411        "Percentage of processor time spent in kernel mode.");
    2412     pm::SubMetric *cpuLoadIdle   = new pm::SubMetric ("CPU/Load/Idle",
     2412    pm::SubMetric *cpuLoadIdle   = new pm::SubMetric("CPU/Load/Idle",
    24132413        "Percentage of processor time spent idling.");
    2414     pm::SubMetric *cpuMhzSM      = new pm::SubMetric ("CPU/MHz",
     2414    pm::SubMetric *cpuMhzSM      = new pm::SubMetric("CPU/MHz",
    24152415        "Average of current frequency of all processors.");
    2416     pm::SubMetric *ramUsageTotal = new pm::SubMetric ("RAM/Usage/Total",
     2416    pm::SubMetric *ramUsageTotal = new pm::SubMetric("RAM/Usage/Total",
    24172417        "Total physical memory installed.");
    2418     pm::SubMetric *ramUsageUsed  = new pm::SubMetric ("RAM/Usage/Used",
     2418    pm::SubMetric *ramUsageUsed  = new pm::SubMetric("RAM/Usage/Used",
    24192419        "Physical memory currently occupied.");
    2420     pm::SubMetric *ramUsageFree  = new pm::SubMetric ("RAM/Usage/Free",
     2420    pm::SubMetric *ramUsageFree  = new pm::SubMetric("RAM/Usage/Free",
    24212421        "Physical memory currently available to applications.");
    24222422    /* Create and register base metrics */
     
    24242424    ComObjPtr<Host> tmp = this;
    24252425    tmp.queryInterfaceTo(&objptr);
    2426     pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw (hal, objptr, cpuLoadUser, cpuLoadKernel,
     2426    pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw(hal, objptr, cpuLoadUser, cpuLoadKernel,
    24272427                                          cpuLoadIdle);
    24282428    aCollector->registerBaseMetric (cpuLoad);
    2429     pm::BaseMetric *cpuMhz = new pm::HostCpuMhz (hal, objptr, cpuMhzSM);
     2429    pm::BaseMetric *cpuMhz = new pm::HostCpuMhz(hal, objptr, cpuMhzSM);
    24302430    aCollector->registerBaseMetric (cpuMhz);
    2431     pm::BaseMetric *ramUsage = new pm::HostRamUsage (hal, objptr, ramUsageTotal, ramUsageUsed,
     2431    pm::BaseMetric *ramUsage = new pm::HostRamUsage(hal, objptr, ramUsageTotal, ramUsageUsed,
    24322432                                           ramUsageFree);
    24332433    aCollector->registerBaseMetric (ramUsage);
    24342434
    2435     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, 0));
    2436     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
    2437                                                new pm::AggregateAvg()));
    2438     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
    2439                                                new pm::AggregateMin()));
    2440     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
    2441                                                new pm::AggregateMax()));
    2442 
    2443     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, 0));
    2444     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
    2445                                                new pm::AggregateAvg()));
    2446     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
    2447                                                new pm::AggregateMin()));
    2448     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
    2449                                                new pm::AggregateMax()));
    2450 
    2451     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle, 0));
    2452     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle,
    2453                                                new pm::AggregateAvg()));
    2454     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle,
    2455                                                new pm::AggregateMin()));
    2456     aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle,
    2457                                                new pm::AggregateMax()));
    2458 
    2459     aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, 0));
    2460     aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM,
    2461                                                new pm::AggregateAvg()));
    2462     aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM,
    2463                                                new pm::AggregateMin()));
    2464     aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM,
    2465                                                new pm::AggregateMax()));
    2466 
    2467     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal, 0));
    2468     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal,
    2469                                                new pm::AggregateAvg()));
    2470     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal,
    2471                                                new pm::AggregateMin()));
    2472     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageTotal,
    2473                                                new pm::AggregateMax()));
    2474 
    2475     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed, 0));
    2476     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed,
    2477                                                new pm::AggregateAvg()));
    2478     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed,
    2479                                                new pm::AggregateMin()));
    2480     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed,
    2481                                                new pm::AggregateMax()));
    2482 
    2483     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree, 0));
    2484     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree,
    2485                                                new pm::AggregateAvg()));
    2486     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree,
    2487                                                new pm::AggregateMin()));
    2488     aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageFree,
    2489                                                new pm::AggregateMax()));
     2435    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0));
     2436    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser,
     2437                                              new pm::AggregateAvg()));
     2438    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser,
     2439                                              new pm::AggregateMin()));
     2440    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser,
     2441                                              new pm::AggregateMax()));
     2442
     2443    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0));
     2444    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel,
     2445                                              new pm::AggregateAvg()));
     2446    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel,
     2447                                              new pm::AggregateMin()));
     2448    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel,
     2449                                              new pm::AggregateMax()));
     2450
     2451    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 0));
     2452    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle,
     2453                                              new pm::AggregateAvg()));
     2454    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle,
     2455                                              new pm::AggregateMin()));
     2456    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle,
     2457                                              new pm::AggregateMax()));
     2458
     2459    aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 0));
     2460    aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM,
     2461                                              new pm::AggregateAvg()));
     2462    aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM,
     2463                                              new pm::AggregateMin()));
     2464    aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM,
     2465                                              new pm::AggregateMax()));
     2466
     2467    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 0));
     2468    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal,
     2469                                              new pm::AggregateAvg()));
     2470    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal,
     2471                                              new pm::AggregateMin()));
     2472    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal,
     2473                                              new pm::AggregateMax()));
     2474
     2475    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 0));
     2476    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed,
     2477                                              new pm::AggregateAvg()));
     2478    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed,
     2479                                              new pm::AggregateMin()));
     2480    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed,
     2481                                              new pm::AggregateMax()));
     2482
     2483    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 0));
     2484    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree,
     2485                                              new pm::AggregateAvg()));
     2486    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree,
     2487                                              new pm::AggregateMin()));
     2488    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree,
     2489                                              new pm::AggregateMax()));
    24902490};
    24912491
    24922492void Host::unregisterMetrics (PerformanceCollector *aCollector)
    24932493{
    2494     aCollector->unregisterMetricsFor (this);
    2495     aCollector->unregisterBaseMetricsFor (this);
     2494    aCollector->unregisterMetricsFor(this);
     2495    aCollector->unregisterBaseMetricsFor(this);
    24962496};
    24972497#endif /* VBOX_WITH_RESOURCE_USAGE_API */
  • trunk/src/VBox/Main/HostPower.cpp

    r23327 r26186  
    3636HostPowerService::HostPowerService (VirtualBox *aVirtualBox)
    3737{
    38     Assert (aVirtualBox != NULL);
     38    Assert(aVirtualBox != NULL);
    3939    mVirtualBox = aVirtualBox;
    4040}
     
    7575                /* get the remote console */
    7676                ComPtr<IConsole> console;
    77                 rc = pControl->GetRemoteConsole (console.asOutParam());
     77                rc = pControl->GetRemoteConsole(console.asOutParam());
    7878                /* the VM could have been powered down and closed or whatever */
    79                 if (FAILED (rc))
     79                if (FAILED(rc))
    8080                    continue;
    8181
     
    8383                 * in an inappropriate state */
    8484                rc = console->Pause();
    85                 if (FAILED (rc))
     85                if (FAILED(rc))
    8686                    continue;
    8787
     
    102102
    103103            /* go through VMs we paused on Suspend */
    104             for (size_t i = 0; i < mConsoles.size(); ++ i)
     104            for (size_t i = 0; i < mConsoles.size(); ++i)
    105105            {
    106106                /* note that Resume() will simply return a failure if the VM is
     
    108108                 * been somehow closed by this time already so that the
    109109                 * console reference we have is dead) */
    110                 rc = mConsoles [i]->Resume();
    111                 if (FAILED (rc))
     110                rc = mConsoles[i]->Resume();
     111                if (FAILED(rc))
    112112                    continue;
    113113
     
    148148                rc = pControl->GetRemoteConsole (console.asOutParam());
    149149                /* the VM could have been powered down and closed or whatever */
    150                 if (FAILED (rc))
     150                if (FAILED(rc))
    151151                    continue;
    152152
     
    156156                 * is in an inappropriate state */
    157157                rc = console->SaveState (progress.asOutParam());
    158                 if (FAILED (rc))
     158                if (FAILED(rc))
    159159                    continue;
    160160
  • trunk/src/VBox/Main/KeyboardImpl.cpp

    r26173 r26186  
    138138    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    139139
    140     CHECK_CONSOLE_DRV (mpDrv);
    141 
    142     int vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)scancode);
     140    CHECK_CONSOLE_DRV(mpDrv);
     141
     142    int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)scancode);
    143143
    144144    if (RT_FAILURE(vrc))
    145         rc = setError (VBOX_E_IPRT_ERROR,
    146             tr ("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"),
    147                 scancode, vrc);
     145        rc = setError(VBOX_E_IPRT_ERROR,
     146                      tr("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"),
     147                      scancode, vrc);
    148148
    149149    return rc;
     
    179179
    180180    for (uint32_t i = 0; (i < keys.size()) && RT_SUCCESS(vrc); i++)
    181         vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)keys [i]);
     181        vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)keys[i]);
    182182
    183183    if (RT_FAILURE(vrc))
    184         return setError (VBOX_E_IPRT_ERROR,
    185             tr ("Could not send all scan codes to the virtual keyboard (%Rrc)"),
    186                 vrc);
     184        return setError(VBOX_E_IPRT_ERROR,
     185                        tr("Could not send all scan codes to the virtual keyboard (%Rrc)"),
     186                        vrc);
    187187
    188188    /// @todo is it actually possible that not all scancodes can be transmitted?
     
    202202STDMETHODIMP Keyboard::PutCAD()
    203203{
    204     static com::SafeArray<LONG> cadSequence (6);
    205 
    206     cadSequence [0] = 0x1d; // Ctrl down
    207     cadSequence [1] = 0x38; // Alt down
    208     cadSequence [2] = 0x53; // Del down
    209     cadSequence [3] = 0xd3; // Del up
    210     cadSequence [4] = 0xb8; // Alt up
    211     cadSequence [5] = 0x9d; // Ctrl up
    212 
    213     return PutScancodes (ComSafeArrayAsInParam (cadSequence), NULL);
     204    static com::SafeArray<LONG> cadSequence(6);
     205
     206    cadSequence[0] = 0x1d; // Ctrl down
     207    cadSequence[1] = 0x38; // Alt down
     208    cadSequence[2] = 0x53; // Del down
     209    cadSequence[3] = 0xd3; // Del up
     210    cadSequence[4] = 0xb8; // Alt up
     211    cadSequence[5] = 0x9d; // Ctrl up
     212
     213    return PutScancodes(ComSafeArrayAsInParam(cadSequence), NULL);
    214214}
    215215
  • trunk/src/VBox/Main/MachineImpl.cpp

    r26171 r26186  
    179179
    180180    /* default boot order: floppy - DVD - HDD */
    181     mBootOrder [0] = DeviceType_Floppy;
    182     mBootOrder [1] = DeviceType_DVD;
    183     mBootOrder [2] = DeviceType_HardDisk;
    184     for (size_t i = 3; i < RT_ELEMENTS (mBootOrder); ++i)
    185         mBootOrder [i] = DeviceType_Null;
     181    mBootOrder[0] = DeviceType_Floppy;
     182    mBootOrder[1] = DeviceType_DVD;
     183    mBootOrder[2] = DeviceType_HardDisk;
     184    for (size_t i = 3; i < RT_ELEMENTS(mBootOrder); ++i)
     185        mBootOrder[i] = DeviceType_Null;
    186186
    187187    mClipboardMode = ClipboardMode_Bidirectional;
     
    509509    LogFlowThisFuncEnter();
    510510
    511     Assert (!isWriteLockOnCurrentThread());
     511    Assert(!isWriteLockOnCurrentThread());
    512512
    513513    /* Enclose the state transition Ready->InUninit->NotReady */
     
    17301730    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    17311731
    1732     Assert (!!mVRDPServer);
     1732    Assert(!!mVRDPServer);
    17331733    mVRDPServer.queryInterfaceTo(vrdpServer);
    17341734
     
    22782278    setModified(IsModified_MachineData);
    22792279    mHWData.backup();
    2280     mHWData->mBootOrder [aPosition - 1] = aDevice;
     2280    mHWData->mBootOrder[aPosition - 1] = aDevice;
    22812281
    22822282    return S_OK;
     
    22952295    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    22962296
    2297     *aDevice = mHWData->mBootOrder [aPosition - 1];
     2297    *aDevice = mHWData->mBootOrder[aPosition - 1];
    22982298
    22992299    return S_OK;
     
    30353035}
    30363036
    3037 STDMETHODIMP Machine::GetSerialPort (ULONG slot, ISerialPort **port)
     3037STDMETHODIMP Machine::GetSerialPort(ULONG slot, ISerialPort **port)
    30383038{
    30393039    CheckComArgOutPointerValid(port);
    3040     CheckComArgExpr (slot, slot < RT_ELEMENTS (mSerialPorts));
     3040    CheckComArgExpr(slot, slot < RT_ELEMENTS(mSerialPorts));
    30413041
    30423042    AutoCaller autoCaller(this);
     
    30453045    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    30463046
    3047     mSerialPorts [slot].queryInterfaceTo(port);
    3048 
    3049     return S_OK;
    3050 }
    3051 
    3052 STDMETHODIMP Machine::GetParallelPort (ULONG slot, IParallelPort **port)
     3047    mSerialPorts[slot].queryInterfaceTo(port);
     3048
     3049    return S_OK;
     3050}
     3051
     3052STDMETHODIMP Machine::GetParallelPort(ULONG slot, IParallelPort **port)
    30533053{
    30543054    CheckComArgOutPointerValid(port);
    3055     CheckComArgExpr (slot, slot < RT_ELEMENTS (mParallelPorts));
     3055    CheckComArgExpr(slot, slot < RT_ELEMENTS(mParallelPorts));
    30563056
    30573057    AutoCaller autoCaller(this);
     
    30603060    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    30613061
    3062     mParallelPorts [slot].queryInterfaceTo(port);
    3063 
    3064     return S_OK;
    3065 }
    3066 
    3067 STDMETHODIMP Machine::GetNetworkAdapter (ULONG slot, INetworkAdapter **adapter)
     3062    mParallelPorts[slot].queryInterfaceTo(port);
     3063
     3064    return S_OK;
     3065}
     3066
     3067STDMETHODIMP Machine::GetNetworkAdapter(ULONG slot, INetworkAdapter **adapter)
    30683068{
    30693069    CheckComArgOutPointerValid(adapter);
    3070     CheckComArgExpr (slot, slot < RT_ELEMENTS (mNetworkAdapters));
     3070    CheckComArgExpr(slot, slot < RT_ELEMENTS(mNetworkAdapters));
    30713071
    30723072    AutoCaller autoCaller(this);
     
    32513251     *  been actually changed
    32523252     */
    3253     rollback (true /* aNotify */);
     3253    rollback(true /* aNotify */);
    32543254
    32553255    return S_OK;
     
    33813381    //  mData->mCurrentStateModified to FALSE
    33823382
    3383     return setError (E_NOTIMPL, "Not implemented");
     3383    return setError(E_NOTIMPL, "Not implemented");
    33843384}
    33853385
     
    38673867    if (   (aConnectionType <= StorageBus_Null)
    38683868        || (aConnectionType >  StorageBus_SAS))
    3869         return setError (E_INVALIDARG,
    3870             tr ("Invalid connection type: %d"),
    3871                 aConnectionType);
     3869        return setError(E_INVALIDARG,
     3870                        tr("Invalid connection type: %d"),
     3871                        aConnectionType);
    38723872
    38733873    AutoCaller autoCaller(this);
     
    38843884    rc = getStorageControllerByName (aName, ctrl, false /* aSetError */);
    38853885    if (SUCCEEDED(rc))
    3886         return setError (VBOX_E_OBJECT_IN_USE,
    3887             tr ("Storage controller named '%ls' already exists"), aName);
     3886        return setError(VBOX_E_OBJECT_IN_USE,
     3887                        tr("Storage controller named '%ls' already exists"),
     3888                        aName);
    38883889
    38893890    ctrl.createObject();
     
    41464147
    41474148    if (RT_FAILURE(vrc))
    4148         return setError (VBOX_E_IPRT_ERROR,
    4149                          tr("Saved screenshot data is not available (%Rrc)"), vrc);
     4149        return setError(VBOX_E_IPRT_ERROR,
     4150                        tr("Saved screenshot data is not available (%Rrc)"),
     4151                        vrc);
    41504152
    41514153    *aSize = cbData;
     
    41794181
    41804182    if (RT_FAILURE(vrc))
    4181         return setError (VBOX_E_IPRT_ERROR,
    4182                          tr("Saved screenshot data is not available (%Rrc)"), vrc);
     4183        return setError(VBOX_E_IPRT_ERROR,
     4184                        tr("Saved screenshot data is not available (%Rrc)"),
     4185                        vrc);
    41834186
    41844187    *aWidth = u32Width;
     
    42374240
    42384241    if (RT_FAILURE(vrc))
    4239         return setError (VBOX_E_IPRT_ERROR,
    4240                          tr("Saved screenshot data is not available (%Rrc)"), vrc);
     4242        return setError(VBOX_E_IPRT_ERROR,
     4243                        tr("Saved screenshot data is not available (%Rrc)"),
     4244                        vrc);
    42414245
    42424246    *aSize = cbData;
     
    42704274
    42714275    if (RT_FAILURE(vrc))
    4272         return setError (VBOX_E_IPRT_ERROR,
    4273                          tr("Saved screenshot data is not available (%Rrc)"), vrc);
     4276        return setError(VBOX_E_IPRT_ERROR,
     4277                        tr("Saved screenshot data is not available (%Rrc)"),
     4278                        vrc);
    42744279
    42754280    *aWidth = u32Width;
     
    45084513    {
    45094514        /* Log folder is <Machines>/<VM_SnapshotFolder>/Logs */
    4510         Assert (!mUserData->mSnapshotFolderFull.isEmpty());
     4515        Assert(!mUserData->mSnapshotFolderFull.isEmpty());
    45114516        aLogFolder = Utf8StrFmt ("%ls%cLogs", mUserData->mSnapshotFolderFull.raw(),
    45124517                                 RTPATH_DELIMITER);
     
    46874692             * with the relevant part in openSession()). */
    46884693
    4689             Assert (mData->mSession.mRemoteControls.size() == 1);
     4694            Assert(mData->mSession.mRemoteControls.size() == 1);
    46904695            if (mData->mSession.mRemoteControls.size() == 1)
    46914696            {
     
    48504855        const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE;
    48514856# endif
    4852         Assert (sz >= sizeof (VirtualBox_exe));
     4857        Assert(sz >= sizeof (VirtualBox_exe));
    48534858        strcpy (cmd, VirtualBox_exe);
    48544859
     
    48734878    {
    48744879        const char VBoxSDL_exe[] = "VBoxSDL" HOSTSUFF_EXE;
    4875         Assert (sz >= sizeof (VBoxSDL_exe));
     4880        Assert(sz >= sizeof (VBoxSDL_exe));
    48764881        strcpy (cmd, VBoxSDL_exe);
    48774882
     
    49014906    {
    49024907        const char VBoxHeadless_exe[] = "VBoxHeadless" HOSTSUFF_EXE;
    4903         Assert (sz >= sizeof (VBoxHeadless_exe));
     4908        Assert(sz >= sizeof (VBoxHeadless_exe));
    49044909        strcpy (cmd, VBoxHeadless_exe);
    49054910
     
    49724977
    49734978    /* attach launch data to the machine */
    4974     Assert (mData->mSession.mPid == NIL_RTPROCESS);
     4979    Assert(mData->mSession.mPid == NIL_RTPROCESS);
    49754980    mData->mSession.mRemoteControls.push_back (aControl);
    49764981    mData->mSession.mProgress = aProgress;
     
    49995004
    50005005    if (!mData->mRegistered)
    5001         return setError (E_UNEXPECTED,
    5002             tr ("The machine '%ls' is not registered"), mUserData->mName.raw());
     5006        return setError(E_UNEXPECTED,
     5007                        tr("The machine '%ls' is not registered"),
     5008                        mUserData->mName.raw());
    50035009
    50045010    LogFlowThisFunc(("mSession.state=%s\n", Global::stringifySessionState(mData->mSession.mState)));
    50055011
    50065012    if (mData->mSession.mState != SessionState_Open)
    5007         return setError (VBOX_E_INVALID_SESSION_STATE,
    5008             tr ("The machine '%ls' does not have an open session"),
    5009             mUserData->mName.raw());
     5013        return setError(VBOX_E_INVALID_SESSION_STATE,
     5014                        tr("The machine '%ls' does not have an open session"),
     5015                        mUserData->mName.raw());
    50105016
    50115017    ComAssertRet (!mData->mSession.mDirectControl.isNull(), E_FAIL);
     
    50185024    HRESULT rc = mData->mSession.mDirectControl->
    50195025                     GetRemoteConsole (console.asOutParam());
    5020     if (FAILED (rc))
     5026    if (FAILED(rc))
    50215027    {
    50225028        /* The failure may occur w/o any error info (from RPC), so provide one */
    5023         return setError (VBOX_E_VM_ERROR,
    5024             tr ("Failed to get a console object from the direct session (%Rrc)"), rc);
     5029        return setError(VBOX_E_VM_ERROR,
     5030                        tr("Failed to get a console object from the direct session (%Rrc)"),
     5031                        rc);
    50255032    }
    50265033
     
    54275434
    54285435        ++mData->mMachineStateDeps;
    5429         Assert (mData->mMachineStateDeps != 0 /* overflow */);
     5436        Assert(mData->mMachineStateDeps != 0 /* overflow */);
    54305437    }
    54315438
     
    54595466        if (mData->mMachineStateChangePending != 0)
    54605467        {
    5461             Assert (mData->mMachineStateDepsSem != NIL_RTSEMEVENTMULTI);
     5468            Assert(mData->mMachineStateDepsSem != NIL_RTSEMEVENTMULTI);
    54625469            RTSemEventMultiSignal (mData->mMachineStateDepsSem);
    54635470        }
     
    55745581    /* create associated BIOS settings object */
    55755582    unconst(mBIOSSettings).createObject();
    5576     mBIOSSettings->init (this);
     5583    mBIOSSettings->init(this);
    55775584
    55785585#ifdef VBOX_WITH_VRDP
    55795586    /* create an associated VRDPServer object (default is disabled) */
    55805587    unconst(mVRDPServer).createObject();
    5581     mVRDPServer->init (this);
     5588    mVRDPServer->init(this);
    55825589#endif
    55835590
    55845591    /* create associated serial port objects */
    5585     for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++)
    5586     {
    5587         unconst(mSerialPorts [slot]).createObject();
    5588         mSerialPorts [slot]->init (this, slot);
     5592    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
     5593    {
     5594        unconst(mSerialPorts[slot]).createObject();
     5595        mSerialPorts[slot]->init(this, slot);
    55895596    }
    55905597
    55915598    /* create associated parallel port objects */
    5592     for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++)
    5593     {
    5594         unconst(mParallelPorts [slot]).createObject();
    5595         mParallelPorts [slot]->init (this, slot);
     5599    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
     5600    {
     5601        unconst(mParallelPorts[slot]).createObject();
     5602        mParallelPorts[slot]->init(this, slot);
    55965603    }
    55975604
    55985605    /* create the audio adapter object (always present, default is disabled) */
    55995606    unconst(mAudioAdapter).createObject();
    5600     mAudioAdapter->init (this);
     5607    mAudioAdapter->init(this);
    56015608
    56025609    /* create the USB controller object (always present, default is disabled) */
    56035610    unconst(mUSBController).createObject();
    5604     mUSBController->init (this);
     5611    mUSBController->init(this);
    56055612
    56065613    /* create associated network adapter objects */
    5607     for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++)
    5608     {
    5609         unconst(mNetworkAdapters [slot]).createObject();
    5610         mNetworkAdapters [slot]->init (this, slot);
     5614    for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot ++)
     5615    {
     5616        unconst(mNetworkAdapters[slot]).createObject();
     5617        mNetworkAdapters[slot]->init(this, slot);
    56115618    }
    56125619
     
    67706777                /* new dir and old dir cannot be equal here because of 'if'
    67716778                 * above and because name != newName */
    6772                 Assert (configDir != newConfigDir);
     6779                Assert(configDir != newConfigDir);
    67736780                if (!aNew)
    67746781                {
     
    80218028                rc = pMedium->UnlockWrite(&state);
    80228029                /* the disk may be alredy relocked for reading above */
    8023                 Assert (SUCCEEDED(rc) || state == MediumState_LockedRead);
     8030                Assert(SUCCEEDED(rc) || state == MediumState_LockedRead);
    80248031            }
    80258032        }
     
    83008307    mUSBController->commit();
    83018308
    8302     for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++)
    8303         mNetworkAdapters [slot]->commit();
    8304     for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++)
    8305         mSerialPorts [slot]->commit();
    8306     for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++)
    8307         mParallelPorts [slot]->commit();
     8309    for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++)
     8310        mNetworkAdapters[slot]->commit();
     8311    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
     8312        mSerialPorts[slot]->commit();
     8313    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
     8314        mParallelPorts[slot]->commit();
    83088315
    83098316    bool commitStorageControllers = false;
     
    83328339                     * create a peer owning data this device share it with */
    83338340                    peer.createObject();
    8334                     peer->init (mPeer, *it, true /* aReshare */);
     8341                    peer->init(mPeer, *it, true /* aReshare */);
    83358342                }
    83368343                else
    83378344                {
    83388345                    /* remove peer from the old list */
    8339                     mPeer->mStorageControllers->remove (peer);
     8346                    mPeer->mStorageControllers->remove(peer);
    83408347                }
    83418348                /* and add it to the new list */
     
    83548361
    83558362            /* attach new list of controllers to our peer */
    8356             mPeer->mStorageControllers.attach (newList);
     8363            mPeer->mStorageControllers.attach(newList);
    83578364        }
    83588365        else
     
    83838390    {
    83848391        /* attach new data to the primary machine and reshare it */
    8385         mPeer->mUserData.attach (mUserData);
    8386         mPeer->mHWData.attach (mHWData);
     8392        mPeer->mUserData.attach(mUserData);
     8393        mPeer->mHWData.attach(mHWData);
    83878394        /* mMediaData is reshared by fixupMedia */
    83888395        // mPeer->mMediaData.attach(mMediaData);
     
    84088415    AssertReturnVoid(aThat->getClassID() == clsidSnapshotMachine);
    84098416
    8410     AssertReturnVoid(!Global::IsOnline (mData->mMachineState));
     8417    AssertReturnVoid(!Global::IsOnline(mData->mMachineState));
    84118418
    84128419    mHWData.assignCopy(aThat->mHWData);
     
    84218428        folder.createObject();
    84228429        HRESULT rc = folder->initCopy(getMachine(), *it);
    8423         AssertComRC (rc);
     8430        AssertComRC(rc);
    84248431        *it = folder;
    84258432    }
     
    84418448        ComObjPtr<StorageController> ctrl;
    84428449        ctrl.createObject();
    8443         ctrl->initCopy (this, *it);
     8450        ctrl->initCopy(this, *it);
    84448451        mStorageControllers->push_back(ctrl);
    84458452    }
    84468453
    8447     for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++)
    8448         mNetworkAdapters[slot]->copyFrom (aThat->mNetworkAdapters [slot]);
    8449     for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++)
    8450         mSerialPorts[slot]->copyFrom (aThat->mSerialPorts [slot]);
    8451     for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++)
    8452         mParallelPorts[slot]->copyFrom (aThat->mParallelPorts [slot]);
     8454    for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++)
     8455        mNetworkAdapters[slot]->copyFrom(aThat->mNetworkAdapters[slot]);
     8456    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
     8457        mSerialPorts[slot]->copyFrom(aThat->mSerialPorts[slot]);
     8458    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
     8459        mParallelPorts[slot]->copyFrom(aThat->mParallelPorts[slot]);
    84538460}
    84548461
    84558462#ifdef VBOX_WITH_RESOURCE_USAGE_API
    8456 void Machine::registerMetrics (PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid)
     8463void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid)
    84578464{
    84588465    pm::CollectorHAL *hal = aCollector->getHAL();
    84598466    /* Create sub metrics */
    8460     pm::SubMetric *cpuLoadUser = new pm::SubMetric ("CPU/Load/User",
     8467    pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User",
    84618468        "Percentage of processor time spent in user mode by VM process.");
    8462     pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel",
     8469    pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel",
    84638470        "Percentage of processor time spent in kernel mode by VM process.");
    8464     pm::SubMetric *ramUsageUsed  = new pm::SubMetric ("RAM/Usage/Used",
     8471    pm::SubMetric *ramUsageUsed  = new pm::SubMetric("RAM/Usage/Used",
    84658472        "Size of resident portion of VM process in memory.");
    84668473    /* Create and register base metrics */
    8467     pm::BaseMetric *cpuLoad = new pm::MachineCpuLoadRaw (hal, aMachine, pid,
    8468                                                          cpuLoadUser, cpuLoadKernel);
    8469     aCollector->registerBaseMetric (cpuLoad);
    8470     pm::BaseMetric *ramUsage = new pm::MachineRamUsage (hal, aMachine, pid,
    8471                                                         ramUsageUsed);
    8472     aCollector->registerBaseMetric (ramUsage);
    8473 
    8474     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser, 0));
    8475     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser,
     8474    pm::BaseMetric *cpuLoad = new pm::MachineCpuLoadRaw(hal, aMachine, pid,
     8475                                                        cpuLoadUser, cpuLoadKernel);
     8476    aCollector->registerBaseMetric(cpuLoad);
     8477    pm::BaseMetric *ramUsage = new pm::MachineRamUsage(hal, aMachine, pid,
     8478                                                       ramUsageUsed);
     8479    aCollector->registerBaseMetric(ramUsage);
     8480
     8481    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0));
     8482    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser,
    84768483                                                new pm::AggregateAvg()));
    8477     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser,
    8478                                                 new pm::AggregateMin()));
    8479     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadUser,
    8480                                                 new pm::AggregateMax()));
    8481     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel, 0));
    8482     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel,
    8483                                                 new pm::AggregateAvg()));
    8484     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel,
    8485                                                 new pm::AggregateMin()));
    8486     aCollector->registerMetric (new pm::Metric (cpuLoad, cpuLoadKernel,
    8487                                                 new pm::AggregateMax()));
    8488 
    8489     aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed, 0));
    8490     aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed,
    8491                                                 new pm::AggregateAvg()));
    8492     aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed,
    8493                                                 new pm::AggregateMin()));
    8494     aCollector->registerMetric (new pm::Metric (ramUsage, ramUsageUsed,
    8495                                                 new pm::AggregateMax()));
     8484    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser,
     8485                                              new pm::AggregateMin()));
     8486    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser,
     8487                                              new pm::AggregateMax()));
     8488    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0));
     8489    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel,
     8490                                              new pm::AggregateAvg()));
     8491    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel,
     8492                                              new pm::AggregateMin()));
     8493    aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel,
     8494                                              new pm::AggregateMax()));
     8495
     8496    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 0));
     8497    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed,
     8498                                              new pm::AggregateAvg()));
     8499    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed,
     8500                                              new pm::AggregateMin()));
     8501    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed,
     8502                                              new pm::AggregateMax()));
    84968503};
    84978504
    8498 void Machine::unregisterMetrics (PerformanceCollector *aCollector, Machine *aMachine)
    8499 {
    8500     aCollector->unregisterMetricsFor (aMachine);
    8501     aCollector->unregisterBaseMetricsFor (aMachine);
     8505void Machine::unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine)
     8506{
     8507    aCollector->unregisterMetricsFor(aMachine);
     8508    aCollector->unregisterBaseMetricsFor(aMachine);
    85028509};
    85038510#endif /* VBOX_WITH_RESOURCE_USAGE_API */
     
    85298536    LogFlowThisFunc(("\n"));
    85308537
    8531     uninit (Uninit::Unexpected);
     8538    uninit(Uninit::Unexpected);
    85328539}
    85338540
     
    85358542 *  @note Must be called only by Machine::openSession() from its own write lock.
    85368543 */
    8537 HRESULT SessionMachine::init (Machine *aMachine)
     8544HRESULT SessionMachine::init(Machine *aMachine)
    85388545{
    85398546    LogFlowThisFuncEnter();
     
    85548561        if (mIPCSemName[i] == '\\')
    85558562            mIPCSemName[i] = '/';
    8556     mIPCSem = ::CreateMutex (NULL, FALSE, mIPCSemName);
    8557     ComAssertMsgRet (mIPCSem,
    8558                      ("Cannot create IPC mutex '%ls', err=%d",
    8559                       mIPCSemName.raw(), ::GetLastError()),
    8560                      E_FAIL);
     8563    mIPCSem = ::CreateMutex(NULL, FALSE, mIPCSemName);
     8564    ComAssertMsgRet(mIPCSem,
     8565                    ("Cannot create IPC mutex '%ls', err=%d",
     8566                     mIPCSemName.raw(), ::GetLastError()),
     8567                    E_FAIL);
    85618568#elif defined(RT_OS_OS2)
    8562     Utf8Str ipcSem = Utf8StrFmt ("\\SEM32\\VBOX\\VM\\{%RTuuid}",
    8563                                  aMachine->mData->mUuid.raw());
     8569    Utf8Str ipcSem = Utf8StrFmt("\\SEM32\\VBOX\\VM\\{%RTuuid}",
     8570                                aMachine->mData->mUuid.raw());
    85648571    mIPCSemName = ipcSem;
    8565     APIRET arc = ::DosCreateMutexSem ((PSZ) ipcSem.raw(), &mIPCSem, 0, FALSE);
    8566     ComAssertMsgRet (arc == NO_ERROR,
    8567                      ("Cannot create IPC mutex '%s', arc=%ld",
    8568                       ipcSem.raw(), arc),
    8569                      E_FAIL);
     8572    APIRET arc = ::DosCreateMutexSem((PSZ)ipcSem.raw(), &mIPCSem, 0, FALSE);
     8573    ComAssertMsgRet(arc == NO_ERROR,
     8574                    ("Cannot create IPC mutex '%s', arc=%ld",
     8575                     ipcSem.raw(), arc),
     8576                    E_FAIL);
    85708577#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    85718578# ifdef VBOX_WITH_NEW_SYS_V_KEYGEN
     
    85828589    {
    85838590        key = ((uint32_t)'V' << 24) | i;
    8584         int sem = ::semget (key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL);
     8591        int sem = ::semget(key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL);
    85858592        if (sem >= 0 || (errno != EEXIST && errno != EACCES))
    85868593        {
    85878594            mIPCSem = sem;
    85888595            if (sem >= 0)
    8589                 mIPCKey = BstrFmt ("%u", key);
     8596                mIPCKey = BstrFmt("%u", key);
    85908597            break;
    85918598        }
     
    85948601    Utf8Str semName = aMachine->mData->m_strConfigFileFull;
    85958602    char *pszSemName = NULL;
    8596     RTStrUtf8ToCurrentCP (&pszSemName, semName);
    8597     key_t key = ::ftok (pszSemName, 'V');
    8598     RTStrFree (pszSemName);
    8599 
    8600     mIPCSem = ::semget (key, 1, S_IRWXU | S_IRWXG | S_IRWXO | IPC_CREAT);
     8603    RTStrUtf8ToCurrentCP(&pszSemName, semName);
     8604    key_t key = ::ftok(pszSemName, 'V');
     8605    RTStrFree(pszSemName);
     8606
     8607    mIPCSem = ::semget(key, 1, S_IRWXU | S_IRWXG | S_IRWXO | IPC_CREAT);
    86018608# endif /* !VBOX_WITH_NEW_SYS_V_KEYGEN */
    86028609
     
    86298636        return E_FAIL;
    86308637    }
    8631     ComAssertMsgRet (mIPCSem >= 0, ("Cannot create IPC semaphore, errno=%d", errnoSave),
    8632                      E_FAIL);
     8638    ComAssertMsgRet(mIPCSem >= 0, ("Cannot create IPC semaphore, errno=%d", errnoSave),
     8639                    E_FAIL);
    86338640    /* set the initial value to 1 */
    8634     int rv = ::semctl (mIPCSem, 0, SETVAL, 1);
    8635     ComAssertMsgRet (rv == 0, ("Cannot init IPC semaphore, errno=%d", errno),
    8636                      E_FAIL);
     8641    int rv = ::semctl(mIPCSem, 0, SETVAL, 1);
     8642    ComAssertMsgRet(rv == 0, ("Cannot init IPC semaphore, errno=%d", errno),
     8643                    E_FAIL);
    86378644#else
    86388645# error "Port me!"
     
    86458652
    86468653    /* take the pointers to data to share */
    8647     mData.share (aMachine->mData);
    8648     mSSData.share (aMachine->mSSData);
    8649 
    8650     mUserData.share (aMachine->mUserData);
    8651     mHWData.share (aMachine->mHWData);
     8654    mData.share(aMachine->mData);
     8655    mSSData.share(aMachine->mSSData);
     8656
     8657    mUserData.share(aMachine->mUserData);
     8658    mHWData.share(aMachine->mHWData);
    86528659    mMediaData.share(aMachine->mMediaData);
    86538660
     
    86608667        ctl.createObject();
    86618668        ctl->init(this, *it);
    8662         mStorageControllers->push_back (ctl);
     8669        mStorageControllers->push_back(ctl);
    86638670    }
    86648671
    86658672    unconst(mBIOSSettings).createObject();
    8666     mBIOSSettings->init (this, aMachine->mBIOSSettings);
     8673    mBIOSSettings->init(this, aMachine->mBIOSSettings);
    86678674#ifdef VBOX_WITH_VRDP
    86688675    /* create another VRDPServer object that will be mutable */
    86698676    unconst(mVRDPServer).createObject();
    8670     mVRDPServer->init (this, aMachine->mVRDPServer);
     8677    mVRDPServer->init(this, aMachine->mVRDPServer);
    86718678#endif
    86728679    /* create another audio adapter object that will be mutable */
    86738680    unconst(mAudioAdapter).createObject();
    8674     mAudioAdapter->init (this, aMachine->mAudioAdapter);
     8681    mAudioAdapter->init(this, aMachine->mAudioAdapter);
    86758682    /* create a list of serial ports that will be mutable */
    8676     for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++)
    8677     {
    8678         unconst(mSerialPorts [slot]).createObject();
    8679         mSerialPorts [slot]->init (this, aMachine->mSerialPorts [slot]);
     8683    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
     8684    {
     8685        unconst(mSerialPorts[slot]).createObject();
     8686        mSerialPorts[slot]->init(this, aMachine->mSerialPorts[slot]);
    86808687    }
    86818688    /* create a list of parallel ports that will be mutable */
    8682     for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++)
    8683     {
    8684         unconst(mParallelPorts [slot]).createObject();
    8685         mParallelPorts [slot]->init (this, aMachine->mParallelPorts [slot]);
     8689    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
     8690    {
     8691        unconst(mParallelPorts[slot]).createObject();
     8692        mParallelPorts[slot]->init(this, aMachine->mParallelPorts[slot]);
    86868693    }
    86878694    /* create another USB controller object that will be mutable */
     
    86928699    for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++)
    86938700    {
    8694         unconst(mNetworkAdapters [slot]).createObject();
    8695         mNetworkAdapters[slot]->init (this, aMachine->mNetworkAdapters [slot]);
     8701        unconst(mNetworkAdapters[slot]).createObject();
     8702        mNetworkAdapters[slot]->init(this, aMachine->mNetworkAdapters[slot]);
    86968703    }
    86978704
     
    87148721 *  @note Locks mParent + this object for writing.
    87158722 */
    8716 void SessionMachine::uninit (Uninit::Reason aReason)
     8723void SessionMachine::uninit(Uninit::Reason aReason)
    87178724{
    87188725    LogFlowThisFuncEnter();
     
    87468753#if defined(RT_OS_WINDOWS)
    87478754        if (mIPCSem)
    8748             ::CloseHandle (mIPCSem);
     8755            ::CloseHandle(mIPCSem);
    87498756        mIPCSem = NULL;
    87508757#elif defined(RT_OS_OS2)
    87518758        if (mIPCSem != NULLHANDLE)
    8752             ::DosCloseMutexSem (mIPCSem);
     8759            ::DosCloseMutexSem(mIPCSem);
    87538760        mIPCSem = NULLHANDLE;
    87548761#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    87558762        if (mIPCSem >= 0)
    8756             ::semctl (mIPCSem, 0, IPC_RMID);
     8763            ::semctl(mIPCSem, 0, IPC_RMID);
    87578764        mIPCSem = -1;
    87588765# ifdef VBOX_WITH_NEW_SYS_V_KEYGEN
     
    87858792    {
    87868793        LogWarningThisFunc(("ABNORMAL client termination! (wasBusy=%d)\n",
    8787                              Global::IsOnlineOrTransient (lastState)));
     8794                             Global::IsOnlineOrTransient(lastState)));
    87888795
    87898796        /* reset the state to Aborted */
     
    87968803    {
    87978804        LogWarningThisFunc(("Discarding unsaved settings changes!\n"));
    8798         rollback (false /* aNotify */);
     8805        rollback(false /* aNotify */);
    87998806    }
    88008807
     
    88218828#ifdef VBOX_WITH_USB
    88228829    /* release all captured USB devices */
    8823     if (aReason == Uninit::Abnormal && Global::IsOnline (lastState))
     8830    if (aReason == Uninit::Abnormal && Global::IsOnline(lastState))
    88248831    {
    88258832        /* Console::captureUSBDevices() is called in the VM process only after
     
    88318838         * This is identical to SessionMachine::DetachAllUSBDevices except
    88328839         * for the aAbnormal argument. */
    8833         HRESULT rc = mUSBController->notifyProxy (false /* aInsertFilters */);
     8840        HRESULT rc = mUSBController->notifyProxy(false /* aInsertFilters */);
    88348841        AssertComRC(rc);
    8835         NOREF (rc);
     8842        NOREF(rc);
    88368843
    88378844        USBProxyService *service = mParent->host()->usbProxyService();
    88388845        if (service)
    8839             service->detachAllDevicesFromVM (this, true /* aDone */, true /* aAbnormal */);
     8846            service->detachAllDevicesFromVM(this, true /* aDone */, true /* aAbnormal */);
    88408847    }
    88418848#endif /* VBOX_WITH_USB */
     
    88478854         * need to queue the PID to reap the process (and avoid zombies on
    88488855         * Linux). */
    8849         Assert (mData->mSession.mPid != NIL_RTPROCESS);
    8850         mParent->addProcessToReap (mData->mSession.mPid);
     8856        Assert(mData->mSession.mPid != NIL_RTPROCESS);
     8857        mParent->addProcessToReap(mData->mSession.mPid);
    88518858    }
    88528859
     
    88748881            HRESULT rc = (*it)->Uninitialize();
    88758882            LogFlowThisFunc(("  remoteControl->Uninitialize() returned %08X\n", rc));
    8876             if (FAILED (rc))
     8883            if (FAILED(rc))
    88778884                LogWarningThisFunc(("Forgot to close the remote session?\n"));
    88788885            ++it;
     
    89038910    {
    89048911        /* this must be null here (see #OnSessionEnd()) */
    8905         Assert (mData->mSession.mDirectControl.isNull());
    8906         Assert (mData->mSession.mState == SessionState_Closing);
    8907         Assert (!mData->mSession.mProgress.isNull());
     8912        Assert(mData->mSession.mDirectControl.isNull());
     8913        Assert(mData->mSession.mState == SessionState_Closing);
     8914        Assert(!mData->mSession.mProgress.isNull());
    89088915
    89098916        mData->mSession.mProgress->notifyComplete (S_OK);
     
    89128919
    89138920    /* remove the association between the peer machine and this session machine */
    8914     Assert (mData->mSession.mMachine == this ||
    8915             aReason == Uninit::Unexpected);
     8921    Assert(mData->mSession.mMachine == this ||
     8922           aReason == Uninit::Unexpected);
    89168923
    89178924    /* reset the rest of session data */
     
    91929199        /* go to the closing state (essential for all open*Session() calls and
    91939200         * for #checkForDeath()) */
    9194         Assert (mData->mSession.mState == SessionState_Open);
     9201        Assert(mData->mSession.mState == SessionState_Open);
    91959202        mData->mSession.mState = SessionState_Closing;
    91969203
     
    1019710204         * Machine::fixupMedia(). The last can happen when e.g a DVD/Floppy
    1019810205         * image was unmounted at runtime. */
    10199         Assert (SUCCEEDED(rc) || state == MediumState_LockedRead || state == MediumState_Created);
     10206        Assert(SUCCEEDED(rc) || state == MediumState_LockedRead || state == MediumState_Created);
    1020010207    }
    1020110208
  • trunk/src/VBox/Main/Matching.cpp

    r21878 r26186  
    5555    do
    5656    {
    57         end = strcspn (aFilter + start, ",-");
     57        end = strcspn(aFilter + start, ",-");
    5858        end += start;
    5959
    60         char delim = aFilter [end];
     60        char delim = aFilter[end];
    6161
    6262        if (delim == '-')
     
    7373        // skip spaces around numbers
    7474        size_t s = start;
    75         while (s < end && aFilter [s] == ' ') ++ s;
     75        while (s < end && aFilter[s] == ' ') ++s;
    7676        size_t e = end - 1;
    77         while (e > s && aFilter [e] == ' ') -- e;
    78         ++ e;
    79 
    80         that->parseValue (aFilter, s, e, mode);
     77        while (e > s && aFilter[e] == ' ') --e;
     78        ++e;
     79
     80        that->parseValue(aFilter, s, e, mode);
    8181        if (!that->mValid)
    8282            return;
  • trunk/src/VBox/Main/MediumFormatImpl.cpp

    r25860 r26186  
    198198}
    199199
    200 STDMETHODIMP MediumFormat::
    201 COMGETTER(FileExtensions)(ComSafeArrayOut (BSTR, aFileExtensions))
    202 {
    203     if (ComSafeArrayOutIsNull (aFileExtensions))
     200STDMETHODIMP MediumFormat::COMGETTER(FileExtensions)(ComSafeArrayOut(BSTR, aFileExtensions))
     201{
     202    if (ComSafeArrayOutIsNull(aFileExtensions))
    204203        return E_POINTER;
    205204
     
    208207
    209208    /* this is const, no need to lock */
    210     com::SafeArray <BSTR> fileExtentions (m.fileExtensions.size());
     209    com::SafeArray<BSTR> fileExtentions(m.fileExtensions.size());
    211210    int i = 0;
    212211    for (BstrList::const_iterator it = m.fileExtensions.begin();
    213         it != m.fileExtensions.end(); ++ it, ++ i)
    214         (*it).cloneTo (&fileExtentions [i]);
    215     fileExtentions.detachTo (ComSafeArrayOutArg (aFileExtensions));
     212         it != m.fileExtensions.end();
     213         ++it, ++i)
     214        (*it).cloneTo(&fileExtentions[i]);
     215    fileExtentions.detachTo(ComSafeArrayOutArg(aFileExtensions));
    216216
    217217    return S_OK;
     
    254254
    255255    /* this is const, no need to lock */
    256     com::SafeArray <BSTR> propertyNames (m.properties.size());
    257     com::SafeArray <BSTR> propertyDescriptions (m.properties.size());
    258     com::SafeArray <DataType_T> propertyTypes (m.properties.size());
    259     com::SafeArray <ULONG> propertyFlags (m.properties.size());
    260     com::SafeArray <BSTR> propertyDefaults (m.properties.size());
     256    com::SafeArray<BSTR>        propertyNames(m.properties.size());
     257    com::SafeArray<BSTR>        propertyDescriptions (m.properties.size());
     258    com::SafeArray<DataType_T>  propertyTypes(m.properties.size());
     259    com::SafeArray<ULONG>       propertyFlags(m.properties.size());
     260    com::SafeArray<BSTR>        propertyDefaults(m.properties.size());
    261261
    262262    int i = 0;
    263263    for (PropertyList::const_iterator it = m.properties.begin();
    264          it != m.properties.end(); ++ it, ++ i)
     264         it != m.properties.end();
     265         ++it, ++i)
    265266    {
    266267        const Property &prop = (*it);
    267         prop.name.cloneTo (&propertyNames [i]);
    268         prop.description.cloneTo (&propertyDescriptions [i]);
    269         propertyTypes [i] = prop.type;
    270         propertyFlags [i] = prop.flags;
    271         prop.defaultValue.cloneTo (&propertyDefaults [i]);
     268        prop.name.cloneTo(&propertyNames[i]);
     269        prop.description.cloneTo(&propertyDescriptions[i]);
     270        propertyTypes[i] = prop.type;
     271        propertyFlags[i] = prop.flags;
     272        prop.defaultValue.cloneTo(&propertyDefaults[i]);
    272273    }
    273274
    274     propertyNames.detachTo (ComSafeArrayOutArg (aNames));
    275     propertyDescriptions.detachTo (ComSafeArrayOutArg (aDescriptions));
    276     propertyTypes.detachTo (ComSafeArrayOutArg (aTypes));
    277     propertyFlags.detachTo (ComSafeArrayOutArg (aFlags));
    278     propertyDefaults.detachTo (ComSafeArrayOutArg (aDefaults));
     275    propertyNames.detachTo(ComSafeArrayOutArg(aNames));
     276    propertyDescriptions.detachTo(ComSafeArrayOutArg(aDescriptions));
     277    propertyTypes.detachTo(ComSafeArrayOutArg(aTypes));
     278    propertyFlags.detachTo(ComSafeArrayOutArg(aFlags));
     279    propertyDefaults.detachTo(ComSafeArrayOutArg(aDefaults));
    279280
    280281    return S_OK;
  • trunk/src/VBox/Main/MediumImpl.cpp

    r25930 r26186  
    17531753             it != m->backRefs.end(); ++ it, ++ i)
    17541754        {
    1755              it->machineId.toUtf16().detachTo(&machineIds [i]);
     1755             it->machineId.toUtf16().detachTo(&machineIds[i]);
    17561756        }
    17571757    }
     
    21702170        it->first.cloneTo(&names[i]);
    21712171        if (it->second.isEmpty())
    2172             Bstr("").cloneTo(&values [i]);
     2172            Bstr("").cloneTo(&values[i]);
    21732173        else
    2174             it->second.cloneTo(&values [i]);
     2174            it->second.cloneTo(&values[i]);
    21752175        ++ i;
    21762176    }
     
    22182218            it->second = (const char *)NULL;
    22192219        else
    2220             it->second = values [i];
     2220            it->second = values[i];
    22212221    }
    22222222
     
    26082608    }
    26092609
    2610     if (FAILED (rc))
     2610    if (FAILED(rc))
    26112611    {
    26122612        HRESULT rc2 = UnlockWrite(NULL);
  • trunk/src/VBox/Main/MouseImpl.cpp

    r26173 r26186  
    240240    int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, dx, dy, dz, dw, fButtons);
    241241    if (RT_FAILURE(vrc))
    242         rc = setError (VBOX_E_IPRT_ERROR,
    243             tr ("Could not send the mouse event to the virtual mouse (%Rrc)"),
    244                 vrc);
     242        rc = setError(VBOX_E_IPRT_ERROR,
     243                      tr("Could not send the mouse event to the virtual mouse (%Rrc)"),
     244                      vrc);
    245245
    246246    return rc;
     
    342342        mLastAbsY = mouseYAbs;
    343343        if (RT_FAILURE(vrc))
    344             rc = setError (VBOX_E_IPRT_ERROR,
    345                 tr ("Could not send the mouse event to the virtual mouse (%Rrc)"),
    346                     vrc);
     344            rc = setError(VBOX_E_IPRT_ERROR,
     345                          tr("Could not send the mouse event to the virtual mouse (%Rrc)"),
     346                          vrc);
    347347    }
    348348
  • trunk/src/VBox/Main/NetworkAdapterImpl.cpp

    r26171 r26186  
    221221            break;
    222222        default:
    223             return setError (E_FAIL,
    224                 tr("Invalid network adapter type '%d'"),
    225                 aAdapterType);
     223            return setError(E_FAIL,
     224                            tr("Invalid network adapter type '%d'"),
     225                            aAdapterType);
    226226    }
    227227
     
    239239        mlock.release();
    240240
    241         mParent->onNetworkAdapterChange (this, FALSE);
     241        mParent->onNetworkAdapterChange(this, FALSE);
    242242    }
    243243
     
    297297        mlock.release();
    298298
    299         mParent->onNetworkAdapterChange (this, FALSE);
     299        mParent->onNetworkAdapterChange(this, FALSE);
    300300    }
    301301
     
    408408
    409409    if (emitChangeEvent)
    410         mParent->onNetworkAdapterChange (this, FALSE);
     410        mParent->onNetworkAdapterChange(this, FALSE);
    411411
    412412    return rc;
     
    508508            && mData->mAttachmentType == NetworkAttachmentType_Internal)
    509509        {
    510             return setError (E_FAIL,
    511                 tr ("Empty or null internal network name is not valid"));
     510            return setError(E_FAIL,
     511                            tr("Empty or null internal network name is not valid"));
    512512        }
    513513
     
    784784        mlock.release();
    785785
    786         HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE);
    787         if (FAILED (rc))
     786        HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE);
     787        if (FAILED(rc))
    788788        {
    789789            /* If changing the attachment failed then we can't assume
     
    831831        mlock.release();
    832832
    833         HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE);
    834         if (FAILED (rc))
     833        HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE);
     834        if (FAILED(rc))
    835835        {
    836836            /* If changing the attachment failed then we can't assume
     
    886886        mlock.release();
    887887
    888         HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE);
    889         if (FAILED (rc))
     888        HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE);
     889        if (FAILED(rc))
    890890        {
    891891            /* If changing the attachment failed then we can't assume
     
    933933        mlock.release();
    934934
    935         HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE);
    936         if (FAILED (rc))
     935        HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE);
     936        if (FAILED(rc))
    937937        {
    938938            /* If changing the attachment failed then we can't assume
     
    974974        mlock.release();
    975975
    976         mParent->onNetworkAdapterChange (this, TRUE);
     976        mParent->onNetworkAdapterChange(this, TRUE);
    977977    }
    978978
  • trunk/src/VBox/Main/ParallelPortImpl.cpp

    r26171 r26186  
    227227        if (aEnabled &&
    228228            m->bd->strPath.isEmpty())
    229             return setError (E_INVALIDARG,
    230                         tr ("Cannot enable the parallel port %d "
    231                             "because the port path is empty or null"),
    232                         m->bd->ulSlot);
     229            return setError(E_INVALIDARG,
     230                            tr("Cannot enable the parallel port %d because the port path is empty or null"),
     231                            m->bd->ulSlot);
    233232
    234233        m->bd.backup();
     
    282281     * (when changing this, make sure it corresponds to XML schema */
    283282    if (aIRQ > 255)
    284         return setError (E_INVALIDARG,
    285             tr ("Invalid IRQ number of the parallel port %d: "
    286                 "%lu (must be in range [0, %lu])"),
    287             m->bd->ulSlot, aIRQ, 255);
     283        return setError(E_INVALIDARG,
     284                        tr("Invalid IRQ number of the parallel port %d: %lu (must be in range [0, %lu])"),
     285                        m->bd->ulSlot, aIRQ, 255);
    288286
    289287    AutoCaller autoCaller(this);
     
    334332     * (when changing this, make sure it corresponds to XML schema */
    335333    if (aIOBase > 0xFFFF)
    336         return setError (E_INVALIDARG,
    337             tr ("Invalid I/O port base address of the parallel port %d: "
    338                 "%lu (must be in range [0, 0x%X])"),
    339             m->bd->ulSlot, aIOBase, 0, 0xFFFF);
     334        return setError(E_INVALIDARG,
     335                        tr("Invalid I/O port base address of the parallel port %d: %lu (must be in range [0, 0x%X])"),
     336                        m->bd->ulSlot, aIOBase, 0, 0xFFFF);
    340337
    341338    AutoCaller autoCaller(this);
  • trunk/src/VBox/Main/PerformanceImpl.cpp

    r25860 r26186  
    168168////////////////////////////////////////////////////////////////////////////////
    169169
    170 STDMETHODIMP
    171 PerformanceCollector::COMGETTER(MetricNames) (ComSafeArrayOut(BSTR, theMetricNames))
     170STDMETHODIMP PerformanceCollector::COMGETTER(MetricNames)(ComSafeArrayOut(BSTR, theMetricNames))
    172171{
    173172    if (ComSafeArrayOutIsNull(theMetricNames))
     
    216215}
    217216
    218 STDMETHODIMP
    219 PerformanceCollector::GetMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
    220                                   ComSafeArrayIn (IUnknown *, objects),
    221                                   ComSafeArrayOut(IPerformanceMetric *, outMetrics))
     217STDMETHODIMP PerformanceCollector::GetMetrics(ComSafeArrayIn(IN_BSTR, metricNames),
     218                                              ComSafeArrayIn(IUnknown *, objects),
     219                                              ComSafeArrayOut(IPerformanceMetric *, outMetrics))
    222220{
    223221    LogFlowThisFuncEnter();
     
    251249        LogFlow (("PerformanceCollector::GetMetrics() store a metric at "
    252250                  "retMetrics[%d]...\n", i));
    253         metric.queryInterfaceTo(&retMetrics [i++]);
     251        metric.queryInterfaceTo(&retMetrics[i++]);
    254252    }
    255253    retMetrics.detachTo(ComSafeArrayOutArg(outMetrics));
     
    258256}
    259257
    260 STDMETHODIMP
    261 PerformanceCollector::SetupMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
    262                                     ComSafeArrayIn (IUnknown *, objects),
    263                                     ULONG aPeriod, ULONG aCount,
    264                                     ComSafeArrayOut(IPerformanceMetric *,
    265                                                      outMetrics))
     258STDMETHODIMP PerformanceCollector::SetupMetrics(ComSafeArrayIn(IN_BSTR, metricNames),
     259                                                ComSafeArrayIn(IUnknown *, objects),
     260                                                ULONG aPeriod,
     261                                                ULONG aCount,
     262                                                ComSafeArrayOut(IPerformanceMetric *, outMetrics))
    266263{
    267264    AutoCaller autoCaller(this);
    268265    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    269266
    270     pm::Filter filter (ComSafeArrayInArg (metricNames),
    271                        ComSafeArrayInArg (objects));
     267    pm::Filter filter(ComSafeArrayInArg (metricNames),
     268                      ComSafeArrayInArg (objects));
    272269
    273270    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    297294        }
    298295
    299     com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size());
     296    com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size());
    300297    int i = 0;
    301298    for (it = filteredMetrics.begin();
    302299         it != filteredMetrics.end() && SUCCEEDED(rc); ++it)
    303         rc = toIPerformanceMetric(*it, &retMetrics [i++]);
     300        rc = toIPerformanceMetric(*it, &retMetrics[i++]);
    304301    retMetrics.detachTo(ComSafeArrayOutArg(outMetrics));
    305302
     
    308305}
    309306
    310 STDMETHODIMP
    311 PerformanceCollector::EnableMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
    312                                      ComSafeArrayIn (IUnknown *, objects),
    313                                      ComSafeArrayOut(IPerformanceMetric *,
    314                                                       outMetrics))
     307STDMETHODIMP PerformanceCollector::EnableMetrics(ComSafeArrayIn(IN_BSTR, metricNames),
     308                                                 ComSafeArrayIn(IUnknown *, objects),
     309                                                 ComSafeArrayOut(IPerformanceMetric *, outMetrics))
    315310{
    316311    AutoCaller autoCaller(this);
    317312    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    318313
    319     pm::Filter filter (ComSafeArrayInArg (metricNames),
    320                        ComSafeArrayInArg (objects));
     314    pm::Filter filter(ComSafeArrayInArg(metricNames),
     315                      ComSafeArrayInArg(objects));
    321316
    322317    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Write lock is not needed atm since we are */
     
    334329        }
    335330
    336     com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size());
     331    com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size());
    337332    int i = 0;
    338333    for (it = filteredMetrics.begin();
    339334         it != filteredMetrics.end() && SUCCEEDED(rc); ++it)
    340         rc = toIPerformanceMetric(*it, &retMetrics [i++]);
     335        rc = toIPerformanceMetric(*it, &retMetrics[i++]);
    341336    retMetrics.detachTo(ComSafeArrayOutArg(outMetrics));
    342337
     
    345340}
    346341
    347 STDMETHODIMP
    348 PerformanceCollector::DisableMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
    349                                       ComSafeArrayIn (IUnknown *, objects),
    350                                       ComSafeArrayOut(IPerformanceMetric *,
    351                                                        outMetrics))
     342STDMETHODIMP PerformanceCollector::DisableMetrics(ComSafeArrayIn(IN_BSTR, metricNames),
     343                                                  ComSafeArrayIn(IUnknown *, objects),
     344                                                  ComSafeArrayOut(IPerformanceMetric *, outMetrics))
    352345{
    353346    AutoCaller autoCaller(this);
    354347    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    355348
    356     pm::Filter filter (ComSafeArrayInArg (metricNames),
    357                        ComSafeArrayInArg (objects));
     349    pm::Filter filter(ComSafeArrayInArg(metricNames),
     350                      ComSafeArrayInArg(objects));
    358351
    359352    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Write lock is not needed atm since we are */
     
    371364        }
    372365
    373     com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size());
     366    com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size());
    374367    int i = 0;
    375368    for (it = filteredMetrics.begin();
    376369         it != filteredMetrics.end() && SUCCEEDED(rc); ++it)
    377         rc = toIPerformanceMetric(*it, &retMetrics [i++]);
     370        rc = toIPerformanceMetric(*it, &retMetrics[i++]);
    378371    retMetrics.detachTo(ComSafeArrayOutArg(outMetrics));
    379372
     
    382375}
    383376
    384 STDMETHODIMP
    385 PerformanceCollector::QueryMetricsData (ComSafeArrayIn (IN_BSTR, metricNames),
    386                                         ComSafeArrayIn (IUnknown *, objects),
    387                                         ComSafeArrayOut(BSTR, outMetricNames),
    388                                         ComSafeArrayOut(IUnknown *, outObjects),
    389                                         ComSafeArrayOut(BSTR, outUnits),
    390                                         ComSafeArrayOut(ULONG, outScales),
    391                                         ComSafeArrayOut(ULONG, outSequenceNumbers),
    392                                         ComSafeArrayOut(ULONG, outDataIndices),
    393                                         ComSafeArrayOut(ULONG, outDataLengths),
    394                                         ComSafeArrayOut(LONG, outData))
     377STDMETHODIMP PerformanceCollector::QueryMetricsData(ComSafeArrayIn (IN_BSTR, metricNames),
     378                                                    ComSafeArrayIn (IUnknown *, objects),
     379                                                    ComSafeArrayOut(BSTR, outMetricNames),
     380                                                    ComSafeArrayOut(IUnknown *, outObjects),
     381                                                    ComSafeArrayOut(BSTR, outUnits),
     382                                                    ComSafeArrayOut(ULONG, outScales),
     383                                                    ComSafeArrayOut(ULONG, outSequenceNumbers),
     384                                                    ComSafeArrayOut(ULONG, outDataIndices),
     385                                                    ComSafeArrayOut(ULONG, outDataLengths),
     386                                                    ComSafeArrayOut(LONG, outData))
    395387{
    396388    AutoCaller autoCaller(this);
    397389    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    398390
    399     pm::Filter filter (ComSafeArrayInArg (metricNames),
    400                        ComSafeArrayInArg (objects));
     391    pm::Filter filter(ComSafeArrayInArg(metricNames),
     392                      ComSafeArrayInArg(objects));
    401393
    402394    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    416408    size_t flatIndex = 0;
    417409    size_t numberOfMetrics = filteredMetrics.size();
    418     com::SafeArray<BSTR> retNames (numberOfMetrics);
    419     com::SafeIfaceArray<IUnknown> retObjects (numberOfMetrics);
    420     com::SafeArray<BSTR> retUnits (numberOfMetrics);
    421     com::SafeArray<ULONG> retScales (numberOfMetrics);
    422     com::SafeArray<ULONG> retSequenceNumbers (numberOfMetrics);
    423     com::SafeArray<ULONG> retIndices (numberOfMetrics);
    424     com::SafeArray<ULONG> retLengths (numberOfMetrics);
    425     com::SafeArray<LONG> retData (flatSize);
     410    com::SafeArray<BSTR> retNames(numberOfMetrics);
     411    com::SafeIfaceArray<IUnknown> retObjects(numberOfMetrics);
     412    com::SafeArray<BSTR> retUnits(numberOfMetrics);
     413    com::SafeArray<ULONG> retScales(numberOfMetrics);
     414    com::SafeArray<ULONG> retSequenceNumbers(numberOfMetrics);
     415    com::SafeArray<ULONG> retIndices(numberOfMetrics);
     416    com::SafeArray<ULONG> retLengths(numberOfMetrics);
     417    com::SafeArray<LONG> retData(flatSize);
    426418
    427419    for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it, ++i)
     
    459451///////////////////////////////////////////////////////////////////////////////
    460452
    461 void PerformanceCollector::registerBaseMetric (pm::BaseMetric *baseMetric)
     453void PerformanceCollector::registerBaseMetric(pm::BaseMetric *baseMetric)
    462454{
    463455    //LogFlowThisFuncEnter();
     
    471463}
    472464
    473 void PerformanceCollector::registerMetric (pm::Metric *metric)
     465void PerformanceCollector::registerMetric(pm::Metric *metric)
    474466{
    475467    //LogFlowThisFuncEnter();
     
    483475}
    484476
    485 void PerformanceCollector::unregisterBaseMetricsFor (const ComPtr<IUnknown> &aObject)
     477void PerformanceCollector::unregisterBaseMetricsFor(const ComPtr<IUnknown> &aObject)
    486478{
    487479    //LogFlowThisFuncEnter();
     
    504496}
    505497
    506 void PerformanceCollector::unregisterMetricsFor (const ComPtr<IUnknown> &aObject)
     498void PerformanceCollector::unregisterMetricsFor(const ComPtr<IUnknown> &aObject)
    507499{
    508500    //LogFlowThisFuncEnter();
     
    547539
    548540/* static */
    549 void PerformanceCollector::staticSamplerCallback (RTTIMERLR hTimerLR, void *pvUser,
    550                                                   uint64_t /* iTick */)
     541void PerformanceCollector::staticSamplerCallback(RTTIMERLR hTimerLR, void *pvUser,
     542                                                 uint64_t /* iTick */)
    551543{
    552544    AssertReturnVoid (pvUser != NULL);
    553545    PerformanceCollector *collector = static_cast <PerformanceCollector *> (pvUser);
    554     Assert (collector->mMagic == MAGIC);
     546    Assert(collector->mMagic == MAGIC);
    555547    if (collector->mMagic == MAGIC)
    556548    {
     
    621613////////////////////////////////////////////////////////////////////////////////
    622614
    623 HRESULT PerformanceMetric::init (pm::Metric *aMetric)
     615HRESULT PerformanceMetric::init(pm::Metric *aMetric)
    624616{
    625617    m.name        = aMetric->getName();
     
    634626}
    635627
    636 HRESULT PerformanceMetric::init (pm::BaseMetric *aMetric)
     628HRESULT PerformanceMetric::init(pm::BaseMetric *aMetric)
    637629{
    638630    m.name        = aMetric->getName();
     
    651643}
    652644
    653 STDMETHODIMP PerformanceMetric::COMGETTER(MetricName) (BSTR *aMetricName)
     645STDMETHODIMP PerformanceMetric::COMGETTER(MetricName)(BSTR *aMetricName)
    654646{
    655647    /// @todo (r=dmik) why do all these getters not do AutoCaller and
     
    660652}
    661653
    662 STDMETHODIMP PerformanceMetric::COMGETTER(Object) (IUnknown **anObject)
     654STDMETHODIMP PerformanceMetric::COMGETTER(Object)(IUnknown **anObject)
    663655{
    664656    m.object.queryInterfaceTo(anObject);
     
    666658}
    667659
    668 STDMETHODIMP PerformanceMetric::COMGETTER(Description) (BSTR *aDescription)
     660STDMETHODIMP PerformanceMetric::COMGETTER(Description)(BSTR *aDescription)
    669661{
    670662    m.description.cloneTo(aDescription);
     
    672664}
    673665
    674 STDMETHODIMP PerformanceMetric::COMGETTER(Period) (ULONG *aPeriod)
     666STDMETHODIMP PerformanceMetric::COMGETTER(Period)(ULONG *aPeriod)
    675667{
    676668    *aPeriod = m.period;
     
    678670}
    679671
    680 STDMETHODIMP PerformanceMetric::COMGETTER(Count) (ULONG *aCount)
     672STDMETHODIMP PerformanceMetric::COMGETTER(Count)(ULONG *aCount)
    681673{
    682674    *aCount = m.count;
     
    684676}
    685677
    686 STDMETHODIMP PerformanceMetric::COMGETTER(Unit) (BSTR *aUnit)
     678STDMETHODIMP PerformanceMetric::COMGETTER(Unit)(BSTR *aUnit)
    687679{
    688680    m.unit.cloneTo(aUnit);
     
    690682}
    691683
    692 STDMETHODIMP PerformanceMetric::COMGETTER(MinimumValue) (LONG *aMinValue)
     684STDMETHODIMP PerformanceMetric::COMGETTER(MinimumValue)(LONG *aMinValue)
    693685{
    694686    *aMinValue = m.min;
     
    696688}
    697689
    698 STDMETHODIMP PerformanceMetric::COMGETTER(MaximumValue) (LONG *aMaxValue)
     690STDMETHODIMP PerformanceMetric::COMGETTER(MaximumValue)(LONG *aMaxValue)
    699691{
    700692    *aMaxValue = m.max;
  • trunk/src/VBox/Main/ProgressImpl.cpp

    r25860 r26186  
    140140    /* add to the global collection of progress operations (note: after
    141141     * creating mId) */
    142     mParent->addProgress (this);
     142    mParent->addProgress(this);
    143143#endif
    144144
     
    402402
    403403    if (!mCompleted)
    404         return setError (E_FAIL,
    405             tr ("Result code is not available, operation is still in progress"));
     404        return setError(E_FAIL,
     405                        tr("Result code is not available, operation is still in progress"));
    406406
    407407    *aResultCode = mResultCode;
     
    420420
    421421    if (!mCompleted)
    422         return setError (E_FAIL,
    423             tr ("Error info is not available, operation is still in progress"));
     422        return setError(E_FAIL,
     423                        tr("Error info is not available, operation is still in progress"));
    424424
    425425    mErrorInfo.queryInterfaceTo(aErrorInfo);
     
    10871087 * Marks the whole task as complete and sets the result code.
    10881088 *
    1089  * If the result code indicates a failure (|FAILED (@a aResultCode)|) then this
     1089 * If the result code indicates a failure (|FAILED(@a aResultCode)|) then this
    10901090 * method will import the error info from the current thread and assign it to
    10911091 * the errorInfo attribute (it will return an error if no info is available in
     
    11721172    mResultCode = aResultCode;
    11731173
    1174     AssertReturn(FAILED (aResultCode), E_FAIL);
     1174    AssertReturn(FAILED(aResultCode), E_FAIL);
    11751175
    11761176    ComObjPtr<VirtualBoxErrorInfo> errorInfo;
     
    12861286
    12871287    m_ulCurrentOperation = 0;
    1288     rc = mProgresses [0]->COMGETTER(OperationDescription) (
    1289         m_bstrOperationDescription.asOutParam());
     1288    rc = mProgresses[0]->COMGETTER(OperationDescription)(m_bstrOperationDescription.asOutParam());
    12901289    if (FAILED(rc)) return rc;
    12911290
     
    12951294        {
    12961295            BOOL cancelable = FALSE;
    1297             rc = mProgresses [i]->COMGETTER(Cancelable) (&cancelable);
     1296            rc = mProgresses[i]->COMGETTER(Cancelable)(&cancelable);
    12981297            if (FAILED(rc)) return rc;
    12991298
     
    13041303        {
    13051304            ULONG opCount = 0;
    1306             rc = mProgresses [i]->COMGETTER(OperationCount) (&opCount);
     1305            rc = mProgresses[i]->COMGETTER(OperationCount)(&opCount);
    13071306            if (FAILED(rc)) return rc;
    13081307
     
    13281327 * @param aId           See ProgressBase::init().
    13291328 */
    1330 HRESULT CombinedProgress::init (
     1329HRESULT CombinedProgress::init(
    13311330#if !defined (VBOX_COM_INPROC)
    1332                                 VirtualBox *aParent,
     1331                               VirtualBox *aParent,
    13331332#endif
    1334                                 IUnknown *aInitiator,
    1335                                 CBSTR aDescription,
    1336                                 IProgress *aProgress1, IProgress *aProgress2,
    1337                                 OUT_GUID aId /* = NULL */)
     1333                               IUnknown *aInitiator,
     1334                               CBSTR aDescription,
     1335                               IProgress *aProgress1,
     1336                               IProgress *aProgress2,
     1337                               OUT_GUID aId /* = NULL */)
    13381338{
    13391339    /* Enclose the state transition NotReady->InInit->Ready */
     
    13411341    AssertReturn(autoInitSpan.isOk(), E_FAIL);
    13421342
    1343     mProgresses.resize (2);
    1344     mProgresses [0] = aProgress1;
    1345     mProgresses [1] = aProgress2;
    1346 
    1347     HRESULT rc =  protectedInit (autoInitSpan,
     1343    mProgresses.resize(2);
     1344    mProgresses[0] = aProgress1;
     1345    mProgresses[1] = aProgress2;
     1346
     1347    HRESULT rc =  protectedInit(autoInitSpan,
    13481348#if !defined (VBOX_COM_INPROC)
    1349                                  aParent,
     1349                                aParent,
    13501350#endif
    1351                                  aInitiator, aDescription, aId);
     1351                                aInitiator,
     1352                                aDescription,
     1353                                aId);
    13521354
    13531355    /* Confirm a successful initialization when it's the case */
     
    16081610
    16091611    if (aOperation >= m_cOperations)
    1610         return setError (E_FAIL,
    1611             tr ("Operation number must be in range [0, %d]"), m_ulCurrentOperation - 1);
     1612        return setError(E_FAIL,
     1613                        tr("Operation number must be in range [0, %d]"), m_ulCurrentOperation - 1);
    16121614
    16131615    /* if we're already completed or if the given operation is already done,
     
    16231625        {
    16241626            ULONG opCount = 0;
    1625             rc = mProgresses [progress]->COMGETTER(OperationCount) (&opCount);
    1626             if (FAILED (rc))
     1627            rc = mProgresses[progress]->COMGETTER(OperationCount)(&opCount);
     1628            if (FAILED(rc))
    16271629                return rc;
    16281630
     
    16881690
    16891691    if (!mCancelable)
    1690         return setError (E_FAIL, tr ("Operation cannot be canceled"));
     1692        return setError(E_FAIL, tr("Operation cannot be canceled"));
    16911693
    16921694    if (!mCanceled)
     
    17311733    {
    17321734        rc = progress->COMGETTER(Completed)(&fCompleted);
    1733         if (FAILED (rc))
     1735        if (FAILED(rc))
    17341736            return rc;
    17351737
     
    17371739        {
    17381740            rc = progress->COMGETTER(Canceled)(&mCanceled);
    1739             if (FAILED (rc))
     1741            if (FAILED(rc))
    17401742                return rc;
    17411743
    17421744            LONG iRc;
    17431745            rc = progress->COMGETTER(ResultCode)(&iRc);
    1744             if (FAILED (rc))
     1746            if (FAILED(rc))
    17451747                return rc;
    17461748            mResultCode = iRc;
    17471749
    1748             if (FAILED (mResultCode))
     1750            if (FAILED(mResultCode))
    17491751            {
    17501752                rc = progress->COMGETTER(ErrorInfo) (mErrorInfo.asOutParam());
    1751                 if (FAILED (rc))
     1753                if (FAILED(rc))
    17521754                    return rc;
    17531755            }
    17541756
    1755             if (FAILED (mResultCode) || mCanceled)
     1757            if (FAILED(mResultCode) || mCanceled)
    17561758            {
    17571759                mCompleted = TRUE;
     
    17611763                ULONG opCount = 0;
    17621764                rc = progress->COMGETTER(OperationCount) (&opCount);
    1763                 if (FAILED (rc))
     1765                if (FAILED(rc))
    17641766                    return rc;
    17651767
     
    17681770
    17691771                if (mProgress < mProgresses.size())
    1770                     progress = mProgresses [mProgress];
     1772                    progress = mProgresses[mProgress];
    17711773                else
    17721774                    mCompleted = TRUE;
  • trunk/src/VBox/Main/SerialPortImpl.cpp

    r26171 r26186  
    349349     * (when changing this, make sure it corresponds to XML schema */
    350350    if (aIRQ > 255)
    351         return setError (E_INVALIDARG,
    352             tr ("Invalid IRQ number of the serial port %d: "
    353                 "%lu (must be in range [0, %lu])"),
    354             m->bd->ulSlot, aIRQ, 255);
     351        return setError(E_INVALIDARG,
     352                        tr("Invalid IRQ number of the serial port %d: %lu (must be in range [0, %lu])"),
     353                        m->bd->ulSlot, aIRQ, 255);
    355354
    356355    AutoCaller autoCaller(this);
     
    401400     * (when changing this, make sure it corresponds to XML schema */
    402401    if (aIOBase > 0xFFFF)
    403         return setError (E_INVALIDARG,
    404             tr ("Invalid I/O port base address of the serial port %d: "
    405                 "%lu (must be in range [0, 0x%X])"),
    406             m->bd->ulSlot, aIOBase, 0, 0xFFFF);
     402        return setError(E_INVALIDARG,
     403                        tr("Invalid I/O port base address of the serial port %d: %lu (must be in range [0, 0x%X])"),
     404                        m->bd->ulSlot, aIOBase, 0, 0xFFFF);
    407405
    408406    AutoCaller autoCaller(this);
  • trunk/src/VBox/Main/SessionImpl.cpp

    r26068 r26186  
    4040#if defined(RT_OS_WINDOWS) || defined (RT_OS_OS2)
    4141/** VM IPC mutex holder thread */
    42 static DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser);
     42static DECLCALLBACK(int) IPCMutexHolderThread(RTTHREAD Thread, void *pvUser);
    4343#endif
    4444
     
    5151    do { \
    5252        if (mState != SessionState_Open) \
    53             return setError (E_UNEXPECTED, \
    54                 tr ("The session is not open (session state: %s)"), \
    55                 Global::stringifySessionState(mState)); \
     53            return setError(E_UNEXPECTED, tr ("The session is not open (session state: %s)"), Global::stringifySessionState(mState)); \
    5654    } while (0)
    5755
     
    7068    LogFlowThisFunc(("\n"));
    7169
    72     uninit (true /* aFinalRelease */);
     70    uninit(true /* aFinalRelease */);
    7371}
    7472
     
    115113 *  @note Locks this object for writing.
    116114 */
    117 void Session::uninit (bool aFinalRelease)
     115void Session::uninit(bool aFinalRelease)
    118116{
    119117    LogFlowThisFuncEnter();
     
    134132    if (mState != SessionState_Closed)
    135133    {
    136         Assert (mState == SessionState_Open ||
    137                 mState == SessionState_Spawning);
    138 
    139         HRESULT rc = close (aFinalRelease, false /* aFromServer */);
    140         AssertComRC (rc);
     134        Assert(mState == SessionState_Open ||
     135               mState == SessionState_Spawning);
     136
     137        HRESULT rc = close(aFinalRelease, false /* aFromServer */);
     138        AssertComRC(rc);
    141139    }
    142140
     
    147145/////////////////////////////////////////////////////////////////////////////
    148146
    149 STDMETHODIMP Session::COMGETTER(State) (SessionState_T *aState)
     147STDMETHODIMP Session::COMGETTER(State)(SessionState_T *aState)
    150148{
    151149    CheckComArgOutPointerValid(aState);
     
    161159}
    162160
    163 STDMETHODIMP Session::COMGETTER(Type) (SessionType_T *aType)
     161STDMETHODIMP Session::COMGETTER(Type)(SessionType_T *aType)
    164162{
    165163    CheckComArgOutPointerValid(aType);
     
    176174}
    177175
    178 STDMETHODIMP Session::COMGETTER(Machine) (IMachine **aMachine)
     176STDMETHODIMP Session::COMGETTER(Machine)(IMachine **aMachine)
    179177{
    180178    CheckComArgOutPointerValid(aMachine);
     
    193191    else
    194192        rc = mRemoteMachine.queryInterfaceTo(aMachine);
    195     ComAssertComRC (rc);
     193    ComAssertComRC(rc);
    196194
    197195    return rc;
    198196}
    199197
    200 STDMETHODIMP Session::COMGETTER(Console) (IConsole **aConsole)
     198STDMETHODIMP Session::COMGETTER(Console)(IConsole **aConsole)
    201199{
    202200    CheckComArgOutPointerValid(aConsole);
     
    215213    else
    216214        rc = mRemoteConsole.queryInterfaceTo(aConsole);
    217     ComAssertComRC (rc);
     215    ComAssertComRC(rc);
    218216
    219217    return rc;
     
    235233    CHECK_OPEN();
    236234
    237     return close (false /* aFinalRelease */, false /* aFromServer */);
     235    return close(false /* aFinalRelease */, false /* aFromServer */);
    238236}
    239237
     
    241239/////////////////////////////////////////////////////////////////////////////
    242240
    243 STDMETHODIMP Session::GetPID (ULONG *aPid)
     241STDMETHODIMP Session::GetPID(ULONG *aPid)
    244242{
    245243    AssertReturn(aPid, E_POINTER);
    246244
    247245    AutoCaller autoCaller(this);
    248     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    249 
    250     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    251 
    252     *aPid = (ULONG) RTProcSelf();
    253     AssertCompile (sizeof (*aPid) == sizeof (RTPROCESS));
     246    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
     247
     248    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     249
     250    *aPid = (ULONG)RTProcSelf();
     251    AssertCompile(sizeof(*aPid) == sizeof(RTPROCESS));
    254252
    255253    return S_OK;
    256254}
    257255
    258 STDMETHODIMP Session::GetRemoteConsole (IConsole **aConsole)
     256STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole)
    259257{
    260258    LogFlowThisFuncEnter();
     
    262260
    263261    AutoCaller autoCaller(this);
    264     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     262    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    265263
    266264    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    268266    AssertReturn(mState != SessionState_Closed, VBOX_E_INVALID_VM_STATE);
    269267
    270     AssertMsgReturn (mType == SessionType_Direct && !!mConsole,
    271       ("This is not a direct session!\n"), VBOX_E_INVALID_OBJECT_STATE);
     268    AssertMsgReturn(mType == SessionType_Direct && !!mConsole,
     269                    ("This is not a direct session!\n"),
     270                    VBOX_E_INVALID_OBJECT_STATE);
    272271
    273272    /* return a failure if the session already transitioned to Closing
     
    283282}
    284283
    285 STDMETHODIMP Session::AssignMachine (IMachine *aMachine)
     284STDMETHODIMP Session::AssignMachine(IMachine *aMachine)
    286285{
    287286    LogFlowThisFuncEnter();
     
    289288
    290289    AutoCaller autoCaller(this);
    291     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     290    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    292291
    293292    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    319318
    320319    rc = mConsole.createObject();
    321     AssertComRCReturn (rc, rc);
    322 
    323     rc = mConsole->init (aMachine, mControl);
    324     AssertComRCReturn (rc, rc);
     320    AssertComRCReturn(rc, rc);
     321
     322    rc = mConsole->init(aMachine, mControl);
     323    AssertComRCReturn(rc, rc);
    325324
    326325    rc = grabIPCSemaphore();
     
    331330     */
    332331    if (SUCCEEDED(rc))
    333        rc = aMachine->COMGETTER(Parent) (mVirtualBox.asOutParam());
     332       rc = aMachine->COMGETTER(Parent)(mVirtualBox.asOutParam());
    334333
    335334    if (SUCCEEDED(rc))
     
    352351}
    353352
    354 STDMETHODIMP Session::AssignRemoteMachine (IMachine *aMachine, IConsole *aConsole)
     353STDMETHODIMP Session::AssignRemoteMachine(IMachine *aMachine, IConsole *aConsole)
    355354{
    356355    LogFlowThisFuncEnter();
     
    360359
    361360    AutoCaller autoCaller(this);
    362     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     361    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    363362
    364363    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    396395     *  until the session is closed
    397396     */
    398     rc = aMachine->COMGETTER(Parent) (mVirtualBox.asOutParam());
     397    rc = aMachine->COMGETTER(Parent)(mVirtualBox.asOutParam());
    399398
    400399    if (SUCCEEDED(rc))
     
    407406            mType = SessionType_Existing;
    408407        else
    409             Assert (mState == SessionState_Spawning);
     408            Assert(mState == SessionState_Spawning);
    410409
    411410        mState = SessionState_Open;
     
    425424}
    426425
    427 STDMETHODIMP Session::UpdateMachineState (MachineState_T aMachineState)
     426STDMETHODIMP Session::UpdateMachineState(MachineState_T aMachineState)
    428427{
    429428    AutoCaller autoCaller(this);
     
    453452    AssertReturn(!mConsole.isNull(), E_FAIL);
    454453
    455     return mConsole->updateMachineState (aMachineState);
     454    return mConsole->updateMachineState(aMachineState);
    456455}
    457456
     
    481480
    482481        /* close ourselves */
    483         rc = close (false /* aFinalRelease */, true /* aFromServer */);
     482        rc = close(false /* aFinalRelease */, true /* aFromServer */);
    484483    }
    485484    else if (autoCaller.state() == InUninit)
     
    508507
    509508    AutoCaller autoCaller(this);
    510     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     509    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    511510
    512511    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    522521
    523522    AutoCaller autoCaller(this);
    524     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     523    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    525524
    526525    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    536535
    537536    AutoCaller autoCaller(this);
    538     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     537    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    539538
    540539    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    550549
    551550    AutoCaller autoCaller(this);
    552     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     551    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    553552
    554553    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    564563
    565564    AutoCaller autoCaller(this);
    566     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     565    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    567566
    568567    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    578577
    579578    AutoCaller autoCaller(this);
    580     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     579    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    581580
    582581    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    592591
    593592    AutoCaller autoCaller(this);
    594     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     593    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    595594
    596595    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    606605
    607606    AutoCaller autoCaller(this);
    608     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     607    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    609608
    610609    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    615614}
    616615
    617 STDMETHODIMP Session::OnSharedFolderChange (BOOL aGlobal)
    618 {
    619     LogFlowThisFunc(("\n"));
    620 
    621     AutoCaller autoCaller(this);
    622     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     616STDMETHODIMP Session::OnSharedFolderChange(BOOL aGlobal)
     617{
     618    LogFlowThisFunc(("\n"));
     619
     620    AutoCaller autoCaller(this);
     621    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    623622
    624623    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    626625    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    627626
    628     return mConsole->onSharedFolderChange (aGlobal);
    629 }
    630 
    631 STDMETHODIMP Session::OnUSBDeviceAttach (IUSBDevice *aDevice,
    632                                          IVirtualBoxErrorInfo *aError,
    633                                          ULONG aMaskedIfs)
    634 {
    635     LogFlowThisFunc(("\n"));
    636 
    637     AutoCaller autoCaller(this);
    638     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     627    return mConsole->onSharedFolderChange(aGlobal);
     628}
     629
     630STDMETHODIMP Session::OnUSBDeviceAttach(IUSBDevice *aDevice,
     631                                        IVirtualBoxErrorInfo *aError,
     632                                        ULONG aMaskedIfs)
     633{
     634    LogFlowThisFunc(("\n"));
     635
     636    AutoCaller autoCaller(this);
     637    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    639638
    640639    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    642641    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    643642
    644     return mConsole->onUSBDeviceAttach (aDevice, aError, aMaskedIfs);
    645 }
    646 
    647 STDMETHODIMP Session::OnUSBDeviceDetach (IN_BSTR aId,
    648                                          IVirtualBoxErrorInfo *aError)
    649 {
    650     LogFlowThisFunc(("\n"));
    651 
    652     AutoCaller autoCaller(this);
    653     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     643    return mConsole->onUSBDeviceAttach(aDevice, aError, aMaskedIfs);
     644}
     645
     646STDMETHODIMP Session::OnUSBDeviceDetach(IN_BSTR aId,
     647                                        IVirtualBoxErrorInfo *aError)
     648{
     649    LogFlowThisFunc(("\n"));
     650
     651    AutoCaller autoCaller(this);
     652    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    654653
    655654    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    657656    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    658657
    659     return mConsole->onUSBDeviceDetach (aId, aError);
    660 }
    661 
    662 STDMETHODIMP Session::OnShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId)
    663 {
    664     AutoCaller autoCaller(this);
    665     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     658    return mConsole->onUSBDeviceDetach(aId, aError);
     659}
     660
     661STDMETHODIMP Session::OnShowWindow(BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId)
     662{
     663    AutoCaller autoCaller(this);
     664    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    666665
    667666    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    680679    }
    681680
    682     return mConsole->onShowWindow (aCheck, aCanShow, aWinId);
    683 }
    684 
    685 STDMETHODIMP Session::AccessGuestProperty (IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
    686                                            BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags)
     681    return mConsole->onShowWindow(aCheck, aCanShow, aWinId);
     682}
     683
     684STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
     685                                          BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags)
    687686{
    688687#ifdef VBOX_WITH_GUEST_PROPS
    689688    AutoCaller autoCaller(this);
    690     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     689    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    691690
    692691    if (mState != SessionState_Open)
    693         return setError (VBOX_E_INVALID_VM_STATE,
    694             tr ("Machine session is not open (session state: %s)."),
    695             Global::stringifySessionState(mState));
     692        return setError(VBOX_E_INVALID_VM_STATE,
     693                        tr("Machine session is not open (session state: %s)."),
     694                        Global::stringifySessionState(mState));
    696695    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    697696    CheckComArgNotNull(aName);
    698     if (!aIsSetter && !VALID_PTR (aRetValue))
     697    if (!aIsSetter && !VALID_PTR(aRetValue))
    699698        return E_POINTER;
    700     if (!aIsSetter && !VALID_PTR (aRetTimestamp))
     699    if (!aIsSetter && !VALID_PTR(aRetTimestamp))
    701700        return E_POINTER;
    702     if (!aIsSetter && !VALID_PTR (aRetFlags))
     701    if (!aIsSetter && !VALID_PTR(aRetFlags))
    703702        return E_POINTER;
    704703    /* aValue can be NULL for a setter call if the property is to be deleted. */
    705     if (aIsSetter && (aValue != NULL) && !VALID_PTR (aValue))
     704    if (aIsSetter && (aValue != NULL) && !VALID_PTR(aValue))
    706705        return E_INVALIDARG;
    707706    /* aFlags can be null if it is to be left as is */
    708     if (aIsSetter && (aFlags != NULL) && !VALID_PTR (aFlags))
     707    if (aIsSetter && (aFlags != NULL) && !VALID_PTR(aFlags))
    709708        return E_INVALIDARG;
    710709    if (!aIsSetter)
    711         return mConsole->getGuestProperty (aName, aRetValue, aRetTimestamp, aRetFlags);
     710        return mConsole->getGuestProperty(aName, aRetValue, aRetTimestamp, aRetFlags);
    712711    else
    713         return mConsole->setGuestProperty (aName, aValue, aFlags);
     712        return mConsole->setGuestProperty(aName, aValue, aFlags);
    714713#else /* VBOX_WITH_GUEST_PROPS not defined */
    715714    ReturnComNotImplemented();
     
    717716}
    718717
    719 STDMETHODIMP Session::EnumerateGuestProperties (IN_BSTR aPatterns,
    720                                                 ComSafeArrayOut(BSTR, aNames),
    721                                                 ComSafeArrayOut(BSTR, aValues),
    722                                                 ComSafeArrayOut(ULONG64, aTimestamps),
    723                                                 ComSafeArrayOut(BSTR, aFlags))
     718STDMETHODIMP Session::EnumerateGuestProperties(IN_BSTR aPatterns,
     719                                               ComSafeArrayOut(BSTR, aNames),
     720                                               ComSafeArrayOut(BSTR, aValues),
     721                                               ComSafeArrayOut(ULONG64, aTimestamps),
     722                                               ComSafeArrayOut(BSTR, aFlags))
    724723{
    725724#ifdef VBOX_WITH_GUEST_PROPS
    726725    AutoCaller autoCaller(this);
    727     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     726    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    728727
    729728    if (mState != SessionState_Open)
    730         return setError (VBOX_E_INVALID_VM_STATE,
    731             tr ("Machine session is not open (session state: %s)."),
    732             Global::stringifySessionState(mState));
    733     AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    734     if (!VALID_PTR (aPatterns) && (aPatterns != NULL))
     729        return setError(VBOX_E_INVALID_VM_STATE,
     730                        tr("Machine session is not open (session state: %s)."),
     731                        Global::stringifySessionState(mState));
     732    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
     733    if (!VALID_PTR(aPatterns) && (aPatterns != NULL))
    735734        return E_POINTER;
    736735    if (ComSafeArrayOutIsNull(aNames))
     
    764763 *  @note Locks this object for writing.
    765764 */
    766 HRESULT Session::close (bool aFinalRelease, bool aFromServer)
     765HRESULT Session::close(bool aFinalRelease, bool aFromServer)
    767766{
    768767    LogFlowThisFuncEnter();
     
    779778    if (mState != SessionState_Open)
    780779    {
    781         Assert (mState == SessionState_Spawning);
     780        Assert(mState == SessionState_Spawning);
    782781
    783782        /* The session object is going to be uninitialized before it has been
     
    789788         * trying to close the session before waiting for the progress object it
    790789         * got from IVirtualBox:: openRemoteSession() to complete, so assert. */
    791         Assert (aFromServer);
     790        Assert(aFromServer);
    792791
    793792        mState = SessionState_Closed;
    794793        mType = SessionType_Null;
    795794#if defined(RT_OS_WINDOWS)
    796         Assert (!mIPCSem && !mIPCThreadSem);
     795        Assert(!mIPCSem && !mIPCThreadSem);
    797796#elif defined(RT_OS_OS2)
    798         Assert (mIPCThread == NIL_RTTHREAD &&
    799                 mIPCThreadSem == NIL_RTSEMEVENT);
     797        Assert(mIPCThread == NIL_RTTHREAD &&
     798               mIPCThreadSem == NIL_RTSEMEVENT);
    800799#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    801         Assert (mIPCSem == -1);
     800        Assert(mIPCSem == -1);
    802801#else
    803802# error "Port me!"
     
    845844
    846845        LogFlowThisFunc(("Calling mControl->OnSessionEnd()...\n"));
    847         HRESULT rc = mControl->OnSessionEnd (this, progress.asOutParam());
     846        HRESULT rc = mControl->OnSessionEnd(this, progress.asOutParam());
    848847        LogFlowThisFunc(("mControl->OnSessionEnd()=%08X\n", rc));
    849848
     
    857856            rc = S_OK;
    858857
    859         AssertComRC (rc);
     858        AssertComRC(rc);
    860859    }
    861860
     
    872871             *  once this method returns)
    873872             */
    874             Assert (!!progress);
     873            Assert(!!progress);
    875874            if (progress)
    876                 progress->WaitForCompletion (-1);
     875                progress->WaitForCompletion(-1);
    877876        }
    878877    }
     
    895894    /* open the IPC semaphore based on the sessionId and try to grab it */
    896895    Bstr ipcId;
    897     rc = mControl->GetIPCId (ipcId.asOutParam());
     896    rc = mControl->GetIPCId(ipcId.asOutParam());
    898897    AssertComRCReturnRC(rc);
    899898
     
    909908     */
    910909
    911     mIPCThreadSem = ::CreateEvent (NULL, FALSE, FALSE, NULL);
    912     AssertMsgReturn (mIPCThreadSem,
    913                      ("Cannot create an event sem, err=%d", ::GetLastError()),
    914                      E_FAIL);
    915 
    916     void *data [3];
    917     data [0] = (void *) (BSTR) ipcId;
    918     data [1] = (void *) mIPCThreadSem;
    919     data [2] = 0; /* will get an output from the thread */
     910    mIPCThreadSem = ::CreateEvent(NULL, FALSE, FALSE, NULL);
     911    AssertMsgReturn(mIPCThreadSem,
     912                    ("Cannot create an event sem, err=%d", ::GetLastError()),
     913                    E_FAIL);
     914
     915    void *data[3];
     916    data[0] = (void*)(BSTR)ipcId;
     917    data[1] = (void*)mIPCThreadSem;
     918    data[2] = 0; /* will get an output from the thread */
    920919
    921920    /* create a thread to hold the IPC mutex until signalled to release it */
    922921    RTTHREAD tid;
    923     int vrc = RTThreadCreate (&tid, IPCMutexHolderThread, (void *) data,
    924                               0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder");
    925     AssertRCReturn (vrc, E_FAIL);
     922    int vrc = RTThreadCreate(&tid, IPCMutexHolderThread, (void*)data, 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder");
     923    AssertRCReturn(vrc, E_FAIL);
    926924
    927925    /* wait until thread init is completed */
    928     DWORD wrc = ::WaitForSingleObject (mIPCThreadSem, INFINITE);
    929     AssertMsg (wrc == WAIT_OBJECT_0, ("Wait failed, err=%d\n", ::GetLastError()));
    930     Assert (data [2]);
    931 
    932     if (wrc == WAIT_OBJECT_0 && data [2])
     926    DWORD wrc = ::WaitForSingleObject(mIPCThreadSem, INFINITE);
     927    AssertMsg(wrc == WAIT_OBJECT_0, ("Wait failed, err=%d\n", ::GetLastError()));
     928    Assert(data[2]);
     929
     930    if (wrc == WAIT_OBJECT_0 && data[2])
    933931    {
    934932        /* memorize the event sem we should signal in close() */
    935         mIPCSem = (HANDLE) data [2];
     933        mIPCSem = (HANDLE)data[2];
    936934        rc = S_OK;
    937935    }
    938936    else
    939937    {
    940         ::CloseHandle (mIPCThreadSem);
     938        ::CloseHandle(mIPCThreadSem);
    941939        mIPCThreadSem = NULL;
    942940        rc = E_FAIL;
     
    950948     * and then release it in close(). */
    951949
    952     int vrc = RTSemEventCreate (&mIPCThreadSem);
    953     AssertRCReturn (vrc, E_FAIL);
    954 
    955     void *data [3];
    956     data [0] = (void *) ipcId.raw();
    957     data [1] = (void *) mIPCThreadSem;
    958     data [2] = (void *) false; /* will get the thread result here */
     950    int vrc = RTSemEventCreate(&mIPCThreadSem);
     951    AssertRCReturn(vrc, E_FAIL);
     952
     953    void *data[3];
     954    data[0] = (void*)ipcId.raw();
     955    data[1] = (void*)mIPCThreadSem;
     956    data[2] = (void*)false; /* will get the thread result here */
    959957
    960958    /* create a thread to hold the IPC mutex until signalled to release it */
    961     vrc = RTThreadCreate (&mIPCThread, IPCMutexHolderThread, (void *) data,
    962                           0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder");
    963     AssertRCReturn (vrc, E_FAIL);
     959    vrc = RTThreadCreate(&mIPCThread, IPCMutexHolderThread, (void *) data,
     960                         0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder");
     961    AssertRCReturn(vrc, E_FAIL);
    964962
    965963    /* wait until thread init is completed */
     
    968966
    969967    /* the thread must succeed */
    970     AssertReturn((bool) data [2], E_FAIL);
     968    AssertReturn((bool)data[2], E_FAIL);
    971969
    972970#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     
    10341032        /* tell the thread holding the IPC mutex to release it */
    10351033        int vrc = RTSemEventSignal (mIPCThreadSem);
    1036         AssertRC (vrc == NO_ERROR);
     1034        AssertRC(vrc == NO_ERROR);
    10371035
    10381036        /* wait for the thread to finish */
     
    10731071    void **data = (void **) pvUser;
    10741072
    1075     BSTR sessionId = (BSTR) data [0];
    1076     HANDLE initDoneSem = (HANDLE) data [1];
     1073    BSTR sessionId = (BSTR)data[0];
     1074    HANDLE initDoneSem = (HANDLE)data[1];
    10771075
    10781076    HANDLE ipcMutex = ::OpenMutex (MUTEX_ALL_ACCESS, FALSE, sessionId);
     
    10901088            if (finishSem)
    10911089            {
    1092                 data [2] = (void *) finishSem;
     1090                data[2] = (void*)finishSem;
    10931091                /* signal we're done with init */
    10941092                ::SetEvent (initDoneSem);
     
    11231121    void **data = (void **) pvUser;
    11241122
    1125     Utf8Str ipcId = (BSTR) data [0];
    1126     RTSEMEVENT finishSem = (RTSEMEVENT) data [1];
     1123    Utf8Str ipcId = (BSTR)data[0];
     1124    RTSEMEVENT finishSem = (RTSEMEVENT)data[1];
    11271125
    11281126    LogFlowFunc (("ipcId='%s', finishSem=%p\n", ipcId.raw(), finishSem));
     
    11411139        {
    11421140            /* store the answer */
    1143             data [2] = (void *) true;
     1141            data[2] = (void*)true;
    11441142            /* signal we're done */
    11451143            int vrc = RTThreadUserSignal (Thread);
    1146             AssertRC (vrc);
     1144            AssertRC(vrc);
    11471145
    11481146            /* wait until we're signaled to release the IPC mutex */
     
    11611159
    11621160    /* store the answer */
    1163     data [1] = (void *) false;
     1161    data[1] = (void*)false;
    11641162    /* signal we're done */
    11651163    int vrc = RTThreadUserSignal (Thread);
    1166     AssertRC (vrc);
     1164    AssertRC(vrc);
    11671165
    11681166    LogFlowFuncLeave();
  • trunk/src/VBox/Main/SharedFolderImpl.cpp

    r25860 r26186  
    209209
    210210    /* Check whether the path is full (absolute) */
    211     char hostPathFull [RTPATH_MAX];
     211    char hostPathFull[RTPATH_MAX];
    212212    int vrc = RTPathAbsEx(NULL,
    213213                          hostPath.c_str(),
     
    215215                          sizeof (hostPathFull));
    216216    if (RT_FAILURE(vrc))
    217         return setError (E_INVALIDARG,
    218             tr ("Invalid shared folder path: '%s' (%Rrc)"), hostPath.raw(), vrc);
     217        return setError(E_INVALIDARG,
     218                        tr("Invalid shared folder path: '%s' (%Rrc)"),
     219                        hostPath.raw(), vrc);
    219220
    220221    if (RTPathCompare(hostPath.c_str(), hostPathFull) != 0)
    221         return setError (E_INVALIDARG,
    222             tr ("Shared folder path '%s' is not absolute"), hostPath.raw());
     222        return setError(E_INVALIDARG,
     223                        tr("Shared folder path '%s' is not absolute"),
     224                        hostPath.raw());
    223225
    224226    unconst(mParent) = aParent;
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r26167 r26186  
    106106HRESULT Snapshot::FinalConstruct()
    107107{
    108     LogFlowMember (("Snapshot::FinalConstruct()\n"));
     108    LogFlowMember(("Snapshot::FinalConstruct()\n"));
    109109    return S_OK;
    110110}
     
    112112void Snapshot::FinalRelease()
    113113{
    114     LogFlowMember (("Snapshot::FinalRelease()\n"));
     114    LogFlowMember(("Snapshot::FinalRelease()\n"));
    115115    uninit();
    116116}
     
    136136    LogFlowMember(("Snapshot::init(uuid: %s, aParent->uuid=%s)\n", aId.toString().c_str(), (aParent) ? aParent->m->uuid.toString().c_str() : ""));
    137137
    138     ComAssertRet (!aId.isEmpty() && !aName.isEmpty() && aMachine, E_INVALIDARG);
     138    ComAssertRet(!aId.isEmpty() && !aName.isEmpty() && aMachine, E_INVALIDARG);
    139139
    140140    /* Enclose the state transition NotReady->InInit->Ready */
     
    174174void Snapshot::uninit()
    175175{
    176     LogFlowMember (("Snapshot::uninit()\n"));
     176    LogFlowMember(("Snapshot::uninit()\n"));
    177177
    178178    /* Enclose the state transition Ready->InUninit->NotReady */
     
    310310////////////////////////////////////////////////////////////////////////////////
    311311
    312 STDMETHODIMP Snapshot::COMGETTER(Id) (BSTR *aId)
     312STDMETHODIMP Snapshot::COMGETTER(Id)(BSTR *aId)
    313313{
    314314    CheckComArgOutPointerValid(aId);
     
    323323}
    324324
    325 STDMETHODIMP Snapshot::COMGETTER(Name) (BSTR *aName)
     325STDMETHODIMP Snapshot::COMGETTER(Name)(BSTR *aName)
    326326{
    327327    CheckComArgOutPointerValid(aName);
     
    363363}
    364364
    365 STDMETHODIMP Snapshot::COMGETTER(Description) (BSTR *aDescription)
     365STDMETHODIMP Snapshot::COMGETTER(Description)(BSTR *aDescription)
    366366{
    367367    CheckComArgOutPointerValid(aDescription);
     
    376376}
    377377
    378 STDMETHODIMP Snapshot::COMSETTER(Description) (IN_BSTR aDescription)
     378STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription)
    379379{
    380380    CheckComArgNotNull(aDescription);
     
    399399}
    400400
    401 STDMETHODIMP Snapshot::COMGETTER(TimeStamp) (LONG64 *aTimeStamp)
     401STDMETHODIMP Snapshot::COMGETTER(TimeStamp)(LONG64 *aTimeStamp)
    402402{
    403403    CheckComArgOutPointerValid(aTimeStamp);
     
    425425}
    426426
    427 STDMETHODIMP Snapshot::COMGETTER(Machine) (IMachine **aMachine)
     427STDMETHODIMP Snapshot::COMGETTER(Machine)(IMachine **aMachine)
    428428{
    429429    CheckComArgOutPointerValid(aMachine);
     
    438438}
    439439
    440 STDMETHODIMP Snapshot::COMGETTER(Parent) (ISnapshot **aParent)
     440STDMETHODIMP Snapshot::COMGETTER(Parent)(ISnapshot **aParent)
    441441{
    442442    CheckComArgOutPointerValid(aParent);
     
    451451}
    452452
    453 STDMETHODIMP Snapshot::COMGETTER(Children) (ComSafeArrayOut(ISnapshot *, aChildren))
     453STDMETHODIMP Snapshot::COMGETTER(Children)(ComSafeArrayOut(ISnapshot *, aChildren))
    454454{
    455455    CheckComArgOutSafeArrayPointerValid(aChildren);
     
    816816    LogFlowThisFunc(("mName={%ls}\n", aSessionMachine->mUserData->mName.raw()));
    817817
    818     AssertReturn(aSessionMachine && !Guid (aSnapshotId).isEmpty(), E_INVALIDARG);
     818    AssertReturn(aSessionMachine && !Guid(aSnapshotId).isEmpty(), E_INVALIDARG);
    819819
    820820    /* Enclose the state transition NotReady->InInit->Ready */
     
    832832
    833833    /* take the pointer to Data to share */
    834     mData.share (mPeer->mData);
     834    mData.share(mPeer->mData);
    835835
    836836    /* take the pointer to UserData to share (our UserData must always be the
    837837     * same as Machine's data) */
    838     mUserData.share (mPeer->mUserData);
     838    mUserData.share(mPeer->mUserData);
    839839    /* make a private copy of all other data (recent changes from SessionMachine) */
    840     mHWData.attachCopy (aSessionMachine->mHWData);
     840    mHWData.attachCopy(aSessionMachine->mHWData);
    841841    mMediaData.attachCopy(aSessionMachine->mMediaData);
    842842
     
    855855        ComObjPtr<SharedFolder> folder;
    856856        folder.createObject();
    857         rc = folder->initCopy (this, *it);
     857        rc = folder->initCopy(this, *it);
    858858        if (FAILED(rc)) return rc;
    859859        *it = folder;
     
    885885        ComObjPtr<StorageController> ctrl;
    886886        ctrl.createObject();
    887         ctrl->initCopy (this, *it);
     887        ctrl->initCopy(this, *it);
    888888        mStorageControllers->push_back(ctrl);
    889889    }
     
    892892
    893893    unconst(mBIOSSettings).createObject();
    894     mBIOSSettings->initCopy (this, mPeer->mBIOSSettings);
     894    mBIOSSettings->initCopy(this, mPeer->mBIOSSettings);
    895895
    896896#ifdef VBOX_WITH_VRDP
    897897    unconst(mVRDPServer).createObject();
    898     mVRDPServer->initCopy (this, mPeer->mVRDPServer);
     898    mVRDPServer->initCopy(this, mPeer->mVRDPServer);
    899899#endif
    900900
    901901    unconst(mAudioAdapter).createObject();
    902     mAudioAdapter->initCopy (this, mPeer->mAudioAdapter);
     902    mAudioAdapter->initCopy(this, mPeer->mAudioAdapter);
    903903
    904904    unconst(mUSBController).createObject();
    905905    mUSBController->initCopy(this, mPeer->mUSBController);
    906906
    907     for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot++)
     907    for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++)
    908908    {
    909909        unconst(mNetworkAdapters[slot]).createObject();
    910         mNetworkAdapters[slot]->initCopy (this, mPeer->mNetworkAdapters [slot]);
    911     }
    912 
    913     for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot++)
    914     {
    915         unconst(mSerialPorts [slot]).createObject();
    916         mSerialPorts[slot]->initCopy (this, mPeer->mSerialPorts[slot]);
    917     }
    918 
    919     for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot++)
     910        mNetworkAdapters[slot]->initCopy(this, mPeer->mNetworkAdapters[slot]);
     911    }
     912
     913    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
     914    {
     915        unconst(mSerialPorts[slot]).createObject();
     916        mSerialPorts[slot]->initCopy(this, mPeer->mSerialPorts[slot]);
     917    }
     918
     919    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
    920920    {
    921921        unconst(mParallelPorts[slot]).createObject();
    922         mParallelPorts[slot]->initCopy (this, mPeer->mParallelPorts[slot]);
     922        mParallelPorts[slot]->initCopy(this, mPeer->mParallelPorts[slot]);
    923923    }
    924924
     
    967967
    968968    /* take the pointer to Data to share */
    969     mData.share (mPeer->mData);
     969    mData.share(mPeer->mData);
    970970    /*
    971971     *  take the pointer to UserData to share
    972972     *  (our UserData must always be the same as Machine's data)
    973973     */
    974     mUserData.share (mPeer->mUserData);
     974    mUserData.share(mPeer->mUserData);
    975975    /* allocate private copies of all other data (will be loaded from settings) */
    976976    mHWData.allocate();
     
    10791079 *  @note Locks this object for writing.
    10801080 */
    1081 HRESULT SnapshotMachine::onSnapshotChange (Snapshot *aSnapshot)
     1081HRESULT SnapshotMachine::onSnapshotChange(Snapshot *aSnapshot)
    10821082{
    10831083    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    15381538
    15391539    AutoCaller autoCaller(this);
    1540     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     1540    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    15411541
    15421542    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    19521952
    19531953    AutoCaller autoCaller(this);
    1954     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     1954    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    19551955
    19561956    /* saveSettings() needs mParent lock */
     
    22082208                    /* The below assert would be nice but I don't want to move
    22092209                     * Medium::MergeChain to the header just for that
    2210                      * Assert (!chain->isForward()); */
     2210                     * Assert(!chain->isForward()); */
    22112211
    22122212                    // prepareDiscard() should have raised an error already
  • trunk/src/VBox/Main/StorageControllerImpl.cpp

    r26171 r26186  
    123123    if (   (aStorageBus <= StorageBus_Null)
    124124        || (aStorageBus >  StorageBus_SAS))
    125         return setError (E_INVALIDARG,
    126             tr ("Invalid storage connection type"));
     125        return setError(E_INVALIDARG,
     126                        tr("Invalid storage connection type"));
    127127
    128128    /* Enclose the state transition NotReady->InInit->Ready */
     
    137137    /* register with parent early, since uninit() will unconditionally
    138138     * unregister on failure */
    139     m->pParent->addDependentChild (this);
     139    m->pParent->addDependentChild(this);
    140140
    141141    m->bd.allocate();
     
    211211    /* register with parent early, since uninit() will unconditionally
    212212     * unregister on failure */
    213     m->pParent->addDependentChild (this);
     213    m->pParent->addDependentChild(this);
    214214
    215215    /* sanity */
     
    258258    /* m->pPeer is left null */
    259259
    260     m->pParent->addDependentChild (this);
    261 
    262     AutoCaller thatCaller (aThat);
     260    m->pParent->addDependentChild(this);
     261
     262    AutoCaller thatCaller(aThat);
    263263    AssertComRCReturnRC(thatCaller.rc());
    264264
    265265    AutoReadLock thatlock(aThat COMMA_LOCKVAL_SRC_POS);
    266     m->bd.attachCopy (aThat->m->bd);
     266    m->bd.attachCopy(aThat->m->bd);
    267267
    268268    /* Confirm a successful initialization */
     
    288288    m->bd.free();
    289289
    290     m->pParent->removeDependentChild (this);
     290    m->pParent->removeDependentChild(this);
    291291
    292292    unconst(m->pPeer).setNull();
     
    494494            /* AHCI SATA supports a maximum of 30 ports. */
    495495            if ((aPortCount < 1) || (aPortCount > 30))
    496                 return setError (E_INVALIDARG,
    497                     tr ("Invalid port count: %lu (must be in range [%lu, %lu])"),
    498                         aPortCount, 1, 30);
     496                return setError(E_INVALIDARG,
     497                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
     498                                aPortCount, 1, 30);
    499499            break;
    500500        }
     
    508508             */
    509509            if (aPortCount != 16)
    510                 return setError (E_INVALIDARG,
    511                     tr ("Invalid port count: %lu (must be in range [%lu, %lu])"),
    512                         aPortCount, 16, 16);
     510                return setError(E_INVALIDARG,
     511                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
     512                                aPortCount, 16, 16);
    513513            break;
    514514        }
     
    519519             */
    520520            if (aPortCount != 2)
    521                 return setError (E_INVALIDARG,
    522                     tr ("Invalid port count: %lu (must be in range [%lu, %lu])"),
    523                         aPortCount, 2, 2);
     521                return setError(E_INVALIDARG,
     522                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
     523                                aPortCount, 2, 2);
    524524            break;
    525525        }
     
    531531             */
    532532            if (aPortCount != 1)
    533                 return setError (E_INVALIDARG,
    534                     tr ("Invalid port count: %lu (must be in range [%lu, %lu])"),
    535                         aPortCount, 1, 1);
     533                return setError(E_INVALIDARG,
     534                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
     535                                aPortCount, 1, 1);
    536536            break;
    537537        }
     
    542542             */
    543543            if (aPortCount != 8)
    544                 return setError (E_INVALIDARG,
    545                     tr ("Invalid port count: %lu (must be in range [%lu, %lu])"),
    546                         aPortCount, 8, 8);
     544                return setError(E_INVALIDARG,
     545                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
     546                                aPortCount, 8, 8);
    547547            break;
    548548        }
     
    617617
    618618    if (m->bd->mStorageControllerType != StorageControllerType_IntelAhci)
    619         return setError (E_NOTIMPL,
    620             tr ("Invalid controller type"));
     619        return setError(E_NOTIMPL,
     620                        tr("Invalid controller type"));
    621621
    622622    switch (DevicePosition)
     
    652652
    653653    if (m->bd->mStorageControllerType != StorageControllerType_IntelAhci)
    654         return setError (E_NOTIMPL,
    655             tr ("Invalid controller type"));
     654        return setError(E_NOTIMPL,
     655                        tr("Invalid controller type"));
    656656
    657657    if ((aPortNumber < 0) || (aPortNumber >= 30))
    658         return setError (E_INVALIDARG,
    659             tr ("Invalid port number: %l (must be in range [%lu, %lu])"),
    660                 aPortNumber, 0, 29);
     658        return setError(E_INVALIDARG,
     659                        tr("Invalid port number: %l (must be in range [%lu, %lu])"),
     660                        aPortNumber, 0, 29);
    661661
    662662    switch (DevicePosition)
  • trunk/src/VBox/Main/SystemPropertiesImpl.cpp

    r25860 r26186  
    9797    /// free in structures returned by VDBackendInfo. Must be fixed ASAP!
    9898
    99     VDBACKENDINFO aVDInfo [100];
     99    VDBACKENDINFO aVDInfo[100];
    100100    unsigned cEntries;
    101     int vrc = VDBackendInfo (RT_ELEMENTS (aVDInfo), aVDInfo, &cEntries);
    102     AssertRC (vrc);
     101    int vrc = VDBackendInfo(RT_ELEMENTS (aVDInfo), aVDInfo, &cEntries);
     102    AssertRC(vrc);
    103103    if (RT_SUCCESS(vrc))
    104104    {
     
    109109            if (FAILED(rc)) break;
    110110
    111             rc = hdf->init (&aVDInfo [i]);
     111            rc = hdf->init(&aVDInfo[i]);
    112112            if (FAILED(rc)) break;
    113113
    114             mMediumFormats.push_back (hdf);
     114            mMediumFormats.push_back(hdf);
    115115        }
    116116    }
  • trunk/src/VBox/Main/USBControllerImpl.cpp

    r26171 r26186  
    560560
    561561    if (!m->llDeviceFilters->size())
    562         return setError (E_INVALIDARG,
    563             tr ("The USB device filter list is empty"));
     562        return setError(E_INVALIDARG,
     563                        tr("The USB device filter list is empty"));
    564564
    565565    if (aPosition >= m->llDeviceFilters->size())
    566         return setError (E_INVALIDARG,
    567             tr ("Invalid position: %lu (must be in range [0, %lu])"),
    568             aPosition, m->llDeviceFilters->size() - 1);
     566        return setError(E_INVALIDARG,
     567                        tr("Invalid position: %lu (must be in range [0, %lu])"),
     568                        aPosition, m->llDeviceFilters->size() - 1);
    569569
    570570    /* backup the list before modification */
  • trunk/src/VBox/Main/VirtualBoxBase.cpp

    r25939 r26186  
    6363    if (mObjectLock)
    6464        delete mObjectLock;
    65     Assert (mInitUninitWaiters == 0);
    66     Assert (mInitUninitSem == NIL_RTSEMEVENTMULTI);
     65    Assert(mInitUninitWaiters == 0);
     66    Assert(mInitUninitSem == NIL_RTSEMEVENTMULTI);
    6767    if (mZeroCallersSem != NIL_RTSEMEVENT)
    6868        RTSemEventDestroy (mZeroCallersSem);
     
    217217            {
    218218                RTSemEventMultiCreate (&mInitUninitSem);
    219                 Assert (mInitUninitWaiters == 0);
     219                Assert(mInitUninitWaiters == 0);
    220220            }
    221221
     
    242242            else
    243243            {
    244                 Assert (mCallers != 0);
     244                Assert(mCallers != 0);
    245245                -- mCallers;
    246246                if (mCallers == 0 && mState == InUninit)
     
    272272    {
    273273        /* if Ready or Limited, decrease the number of callers */
    274         AssertMsgReturn (mCallers != 0, ("mCallers is ZERO!"), (void) 0);
    275         -- mCallers;
     274        AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0);
     275        --mCallers;
    276276
    277277        return;
     
    291291            /* the caller is being released after AutoUninitSpan or
    292292             * AutoMayUninitSpan has begun */
    293             AssertMsgReturn (mCallers != 0, ("mCallers is ZERO!"), (void) 0);
    294             -- mCallers;
     293            AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0);
     294            --mCallers;
    295295
    296296            if (mCallers == 0)
    297             {
    298297                /* inform the Auto*UninitSpan ctor there are no more callers */
    299                 RTSemEventSignal (mZeroCallersSem);
    300             }
     298                RTSemEventSignal(mZeroCallersSem);
    301299
    302300            return;
     
    600598             * something else but set error info. */
    601599            mRC = mObj->addCaller();
    602             Assert(FAILED (mRC));
     600            Assert(FAILED(mRC));
    603601            return;
    604602    }
     
    634632{
    635633    /* if we did nothing in the constructor, do nothing here */
    636     if (mAlreadyInProgress || FAILED (mRC))
     634    if (mAlreadyInProgress || FAILED(mRC))
    637635        return;
    638636
     
    730728bool VirtualBoxSupportTranslationBase::cutClassNameFrom__PRETTY_FUNCTION__ (char *fn)
    731729{
    732     Assert (fn);
     730    Assert(fn);
    733731    if (!fn)
    734732        return false;
     
    752750#endif
    753751
    754     char *start = strstr (fn, START);
    755     Assert (start);
     752    char *start = strstr(fn, START);
     753    Assert(start);
    756754    if (start)
    757755    {
    758         start += sizeof (START) - 1;
    759         char *end = strstr (start, END);
    760         Assert (end && (end > start));
     756        start += sizeof(START) - 1;
     757        char *end = strstr(start, END);
     758        Assert(end && (end > start));
    761759        if (end && (end > start))
    762760        {
    763761            size_t len = end - start;
    764             memmove (fn, start, len);
    765             fn [len] = 0;
     762            memmove(fn, start, len);
     763            fn[len] = 0;
    766764            return true;
    767765        }
     
    827825
    828826    /* these are mandatory, others -- not */
    829     AssertReturn((!aWarning && FAILED (aResultCode)) ||
     827    AssertReturn((!aWarning && FAILED(aResultCode)) ||
    830828                  (aWarning && aResultCode != S_OK),
    831829                  E_FAIL);
     
    854852            if (FAILED(rc)) break;
    855853            rc = err.queryInterfaceTo(curInfo.asOutParam());
    856             if (FAILED (rc))
     854            if (FAILED(rc))
    857855            {
    858856                /* create a IVirtualBoxErrorInfo wrapper for the native
     
    869867        }
    870868        /* On failure, curInfo will stay null */
    871         Assert (SUCCEEDED(rc) || curInfo.isNull());
     869        Assert(SUCCEEDED(rc) || curInfo.isNull());
    872870
    873871        /* set the current error info and preserve the previous one if any */
     
    913911            }
    914912            /* On failure, curInfo will stay null */
    915             Assert (SUCCEEDED(rc) || curInfo.isNull());
     913            Assert(SUCCEEDED(rc) || curInfo.isNull());
    916914
    917915            /* set the current error info and preserve the previous one if any */
     
    991989        DependentChildren::iterator it = mDependentChildren.begin();
    992990        ComPtr<IUnknown> unk = it->first;
    993         Assert (!unk.isNull());
     991        Assert(!unk.isNull());
    994992
    995993        VirtualBoxBase *child = it->second;
     
    10031001         * uninit() call will wait until the first one has done so
    10041002         * (thanks to AutoUninitSpan). */
    1005         Assert (child);
     1003        Assert(child);
    10061004        if (child)
    10071005            child->uninit();
     
    10171015            mDependentChildren.erase (it);
    10181016
    1019         Assert (count == mDependentChildren.size());
     1017        Assert(count == mDependentChildren.size());
    10201018    }
    10211019}
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r26156 r26186  
    314314        int vrc = com::GetVBoxUserHomeDirectory(szHomeDir, sizeof(szHomeDir));
    315315        if (RT_FAILURE(vrc))
    316             return setError (E_FAIL,
    317                 tr ("Could not create the VirtualBox home directory '%s'"
    318                     "(%Rrc)"),
    319                 szHomeDir, vrc);
     316            return setError(E_FAIL,
     317                            tr("Could not create the VirtualBox home directory '%s' (%Rrc)"),
     318                            szHomeDir, vrc);
    320319
    321320        unconst(m->strHomeDir) = szHomeDir;
     
    380379            if (SUCCEEDED(rc))
    381380            {
    382                 rc = guestOSTypeObj->init(Global::sOSTypes [i].familyId,
    383                                           Global::sOSTypes [i].familyDescription,
    384                                           Global::sOSTypes [i].id,
    385                                           Global::sOSTypes [i].description,
    386                                           Global::sOSTypes [i].osType,
    387                                           Global::sOSTypes [i].osHint,
    388                                           Global::sOSTypes [i].recommendedRAM,
    389                                           Global::sOSTypes [i].recommendedVRAM,
    390                                           Global::sOSTypes [i].recommendedHDD,
    391                                           Global::sOSTypes [i].networkAdapterType,
    392                                           Global::sOSTypes [i].numSerialEnabled);
     381                rc = guestOSTypeObj->init(Global::sOSTypes[i].familyId,
     382                                          Global::sOSTypes[i].familyDescription,
     383                                          Global::sOSTypes[i].id,
     384                                          Global::sOSTypes[i].description,
     385                                          Global::sOSTypes[i].osType,
     386                                          Global::sOSTypes[i].osHint,
     387                                          Global::sOSTypes[i].recommendedRAM,
     388                                          Global::sOSTypes[i].recommendedVRAM,
     389                                          Global::sOSTypes[i].recommendedHDD,
     390                                          Global::sOSTypes[i].networkAdapterType,
     391                                          Global::sOSTypes[i].numSerialEnabled);
    393392                if (SUCCEEDED(rc))
    394393                    m->ollGuestOSTypes.addChild(guestOSTypeObj);
     
    456455                                 RTTHREADFLAGS_WAITABLE,
    457456                                 "Watcher");
    458         ComAssertRC (vrc);
     457        ComAssertRC(vrc);
    459458        if (RT_FAILURE(vrc))
    460459            rc = E_FAIL;
     
    887886    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    888887
    889     return setError (E_NOTIMPL, "Not yet implemented");
     888    return setError(E_NOTIMPL, "Not yet implemented");
    890889}
    891890
     
    13651364        imageId = Guid(aImageId);
    13661365        if (imageId.isEmpty())
    1367             return setError (E_INVALIDARG, tr ("Argument %s is empty"), "aImageId");
     1366            return setError(E_INVALIDARG, tr("Argument %s is empty"), "aImageId");
    13681367    }
    13691368    if (aSetParentId)
     
    16241623    for (size_t i = 0; i < RT_ELEMENTS (kOldNewIDs) / 2; i += 2)
    16251624    {
    1626         if (id == kOldNewIDs [i])
    1627         {
    1628             id = kOldNewIDs [i + 1];
     1625        if (id == kOldNewIDs[i])
     1626        {
     1627            id = kOldNewIDs[i + 1];
    16291628            break;
    16301629        }
     
    16481647
    16491648    return (*aType) ? S_OK :
    1650         setError (E_INVALIDARG,
    1651             tr ("'%ls' is not a valid Guest OS type"),
    1652             aId);
     1649        setError(E_INVALIDARG,
     1650                 tr("'%ls' is not a valid Guest OS type"),
     1651                 aId);
    16531652}
    16541653
     
    16611660    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    16621661
    1663     return setError (E_NOTIMPL, "Not yet implemented");
     1662    return setError(E_NOTIMPL, "Not yet implemented");
    16641663}
    16651664
     
    16711670    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    16721671
    1673     return setError (E_NOTIMPL, "Not yet implemented");
     1672    return setError(E_NOTIMPL, "Not yet implemented");
    16741673}
    16751674
     
    18301829
    18311830    if (state != SessionState_Closed)
    1832         return setError (VBOX_E_INVALID_OBJECT_STATE,
    1833             tr ("The given session is already open or being opened"));
     1831        return setError(VBOX_E_INVALID_OBJECT_STATE,
     1832                        tr("The given session is already open or being opened"));
    18341833
    18351834    /* get the IInternalSessionControl interface */
     
    18861885
    18871886    if (state != SessionState_Closed)
    1888         return setError (VBOX_E_INVALID_OBJECT_STATE,
    1889             tr ("The given session is already open or being opened"));
     1887        return setError(VBOX_E_INVALID_OBJECT_STATE,
     1888                        tr("The given session is already open or being opened"));
    18901889
    18911890    /* get the IInternalSessionControl interface */
     
    19401939
    19411940    if (state != SessionState_Closed)
    1942         return setError (VBOX_E_INVALID_OBJECT_STATE,
    1943             tr ("The given session is already open or being opened"));
     1941        return setError(VBOX_E_INVALID_OBJECT_STATE,
     1942                        tr("The given session is already open or being opened"));
    19441943
    19451944    /* get the IInternalSessionControl interface */
     
    22712270
    22722271        /* get the path to the executable */
    2273         char exePathBuf [RTPATH_MAX];
     2272        char exePathBuf[RTPATH_MAX];
    22742273        char *exePath = RTProcGetExecutableName (exePathBuf, RTPATH_MAX);
    22752274        ComAssertBreak (exePath, E_FAIL);
     
    23072306                 * (pressing the Cancel button to close the Run As dialog) */
    23082307                if (vrc2 == VERR_CANCELLED)
    2309                     rc = setError (E_FAIL,
    2310                         tr ("Operation cancelled by the user"));
     2308                    rc = setError(E_FAIL,
     2309                                  tr("Operation cancelled by the user"));
    23112310                else
    2312                     rc = setError (E_FAIL,
    2313                         tr ("Could not launch a privileged process '%s' (%Rrc)"),
    2314                         exePath, vrc2);
     2311                    rc = setError(E_FAIL,
     2312                                  tr("Could not launch a privileged process '%s' (%Rrc)"),
     2313                                  exePath, vrc2);
    23152314                break;
    23162315            }
     
    23222321            if (RT_FAILURE(vrc))
    23232322            {
    2324                 rc = setError (E_FAIL,
    2325                     tr ("Could not launch a process '%s' (%Rrc)"), exePath, vrc);
     2323                rc = setError(E_FAIL,
     2324                              tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc);
    23262325                break;
    23272326            }
     
    23462345        if (SUCCEEDED(rc) && RT_FAILURE(vrc))
    23472346        {
    2348             rc = setError (E_FAIL,
    2349                 tr ("Could not operate the communication channel (%Rrc)"), vrc);
     2347            rc = setError(E_FAIL,
     2348                          tr("Could not operate the communication channel (%Rrc)"), vrc);
    23502349            break;
    23512350        }
     
    23532352    while (0);
    23542353
    2355     if (FAILED (rc) && !userFuncCalled)
     2354    if (FAILED(rc) && !userFuncCalled)
    23562355    {
    23572356        /* call the user function in the "cleanup only" mode
     
    24992498        HRESULT rc = (*it++)->OnExtraDataCanChange (id, aKey, aValue,
    25002499                                                    aError.asOutParam(), &allowChange);
    2501         if (FAILED (rc))
     2500        if (FAILED(rc))
    25022501        {
    25032502            /* if a call to this method fails for some reason (for ex., because
     
    29782977        int vrc = calculateFullPath(Utf8Str(aLocation), location);
    29792978        if (RT_FAILURE(vrc))
    2980             return setError (VBOX_E_FILE_ERROR,
    2981                 tr ("Invalid image file location '%ls' (%Rrc)"),
    2982                 aLocation, vrc);
     2979            return setError(VBOX_E_FILE_ERROR,
     2980                            tr("Invalid image file location '%ls' (%Rrc)"),
     2981                            aLocation, vrc);
    29832982    }
    29842983
     
    38693868            {
    38703869                /* spawned VM process has terminated (normally or abnormally) */
    3871                 (spawnedMachines [rc - WAIT_OBJECT_0 - cnt - 1])->
     3870                (spawnedMachines[rc - WAIT_OBJECT_0 - cnt - 1])->
    38723871                    checkForSpawnFailure();
    38733872                update = true;
     
    39453944    /* close old process handles */
    39463945    for (size_t i = 1 + cnt; i < 1 + cnt + cntSpawned; ++ i)
    3947         CloseHandle (handles [i]);
     3946        CloseHandle (handles[i]);
    39483947
    39493948    /* release sets of machines if any */
     
    39583957
    39593958    /* according to PMREF, 64 is the maximum for the muxwait list */
    3960     SEMRECORD handles [64];
     3959    SEMRECORD handles[64];
    39613960
    39623961    HMUX muxSem = NULLHANDLE;
     
    40084007                    {
    40094008                        /* machine mutex is normally released */
    4010                         Assert (semId >= 0 && semId < cnt);
     4009                        Assert(semId >= 0 && semId < cnt);
    40114010                        if (semId >= 0 && semId < cnt)
    40124011                        {
     
    40314030                            PID pid; TID tid;
    40324031                            unsigned long reqCnt;
    4033                             arc = DosQueryMutexSem ((HMTX) handles [i].hsemCur, &pid,
    4034                                                     &tid, &reqCnt);
     4032                            arc = DosQueryMutexSem((HMTX)handles[i].hsemCur, &pid, &tid, &reqCnt);
    40354033                            if (arc == ERROR_SEM_OWNER_DIED)
    40364034                            {
    40374035                                /* close the dead mutex as asked by PMREF */
    4038                                 ::DosCloseMutexSem ((HMTX) handles [i].hsemCur);
    4039 
    4040                                 Assert (i >= 0 && i < cnt);
     4036                                ::DosCloseMutexSem((HMTX)handles[i].hsemCur);
     4037
     4038                                Assert(i >= 0 && i < cnt);
    40414039                                if (i >= 0 && i < cnt)
    40424040                                {
     
    40634061                {
    40644062                    for (size_t i = 0; i < cntSpawned; ++ i)
    4065                         updateSpawned |= (spawnedMachines [i])->
     4063                        updateSpawned |= (spawnedMachines[i])->
    40664064                            checkForSpawnFailure();
    40674065                }
     
    42174215            update = false;
    42184216            for (size_t i = 0; i < cnt; ++ i)
    4219                 update |= (machines [i])->checkForDeath();
     4217                update |= (machines[i])->checkForDeath();
    42204218
    42214219            updateSpawned = false;
    42224220            for (size_t i = 0; i < cntSpawned; ++ i)
    4223                 updateSpawned |= (spawnedMachines [i])->checkForSpawnFailure();
     4221                updateSpawned |= (spawnedMachines[i])->checkForSpawnFailure();
    42244222
    42254223            /* reap child processes */
     
    44704468    {
    44714469        rc = saveSettings();
    4472         if (FAILED (rc))
     4470        if (FAILED(rc))
    44734471            unregisterDHCPServer(aDHCPServer, false /* aSaveRegistry */);
    44744472    }
     
    45124510    {
    45134511        rc = saveSettings();
    4514         if (FAILED (rc))
     4512        if (FAILED(rc))
    45154513            registerDHCPServer(aDHCPServer, false /* aSaveRegistry */);
    45164514    }
  • trunk/src/VBox/Main/generic/NetIf-generic.cpp

    r26177 r26186  
    231231        Bstr ifname;
    232232        ComPtr<IHostNetworkInterface> iface;
    233         if (FAILED (host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam())))
     233        if (FAILED(host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam())))
    234234            return VERR_INVALID_PARAMETER;
    235         iface->COMGETTER (Name) (ifname.asOutParam());
     235        iface->COMGETTER(Name) (ifname.asOutParam());
    236236        if (ifname.isNull())
    237237            return VERR_INTERNAL_ERROR;
  • trunk/src/VBox/Main/glue/ErrorInfo.cpp

    r21878 r26186  
    145145void ErrorInfo::init (IUnknown *aI, const GUID &aIID, bool aKeepObj /* = false */)
    146146{
    147     Assert (aI);
     147    Assert(aI);
    148148    if (!aI)
    149149        return;
     
    210210    {
    211211        mNext.reset (new ErrorInfo (next));
    212         Assert (mNext.get());
     212        Assert(mNext.get());
    213213        if (!mNext.get())
    214214            rc = E_OUTOFMEMORY;
     
    235235    ErrorInfo (false /* aDummy */)
    236236{
    237     Assert (progress);
     237    Assert(progress);
    238238    if (!progress)
    239239        return;
  • trunk/src/VBox/Main/glue/EventQueue.cpp

    r23128 r26186  
    485485BOOL EventQueue::waitForEvent (Event **event)
    486486{
    487     Assert (event);
     487    Assert(event);
    488488    if (!event)
    489489        return FALSE;
     
    518518        rc = mEventQ->WaitForEvent (&ev);
    519519        // check for error
    520         if (FAILED (rc))
     520        if (FAILED(rc))
    521521            return FALSE;
    522522        // check for EINTR signal
     
    545545BOOL EventQueue::handleEvent (Event *event)
    546546{
    547     Assert (event);
     547    Assert(event);
    548548    if (!event)
    549549        return FALSE;
  • trunk/src/VBox/Main/glue/SupportErrorInfo.cpp

    r26177 r26186  
    5050    {
    5151        sCounter = RTTlsAlloc();
    52         AssertReturnVoid (sCounter != NIL_RTTLS);
     52        AssertReturnVoid(sCounter != NIL_RTTLS);
    5353    }
    5454
    55     uintptr_t counter = (uintptr_t) RTTlsGet (sCounter);
    56     ++ counter;
    57     RTTlsSet (sCounter, (void *) counter);
     55    uintptr_t counter = (uintptr_t)RTTlsGet(sCounter);
     56    ++counter;
     57    RTTlsSet(sCounter, (void*)counter);
    5858}
    5959
     
    6161void MultiResult::decCounter()
    6262{
    63     uintptr_t counter = (uintptr_t) RTTlsGet (sCounter);
    64     AssertReturnVoid (counter != 0);
    65     -- counter;
    66     RTTlsSet (sCounter, (void *) counter);
     63    uintptr_t counter = (uintptr_t)RTTlsGet(sCounter);
     64    AssertReturnVoid(counter != 0);
     65    --counter;
     66    RTTlsSet(sCounter, (void*)counter);
    6767}
    6868
     
    106106{
    107107    /* whether multi-error mode is turned on */
    108     bool preserve = ((uintptr_t) RTTlsGet (MultiResult::sCounter)) > 0;
     108    bool preserve = ((uintptr_t)RTTlsGet(MultiResult::sCounter)) > 0;
    109109
    110110    LogRel(("ERROR [COM]: aRC=%#08x aIID={%RTuuid} aComponent={%s} aText={%s} aWarning=%RTbool, aInfo=%p, preserve=%RTbool\n",
     
    120120    {
    121121        /* these are mandatory, others -- not */
    122         AssertReturn((!aWarning && FAILED (aResultCode)) ||
     122        AssertReturn((!aWarning && FAILED(aResultCode)) ||
    123123                      (aWarning && aResultCode != S_OK),
    124124                      E_FAIL);
     
    143143            /* get the current error info if any */
    144144            ComPtr<IErrorInfo> err;
    145             rc = ::GetErrorInfo (0, err.asOutParam());
     145            rc = ::GetErrorInfo(0, err.asOutParam());
    146146            if (FAILED(rc)) break;
    147147            rc = err.queryInterfaceTo(curInfo.asOutParam());
    148             if (FAILED (rc))
     148            if (FAILED(rc))
    149149            {
    150150                /* create a IVirtualBoxErrorInfo wrapper for the native
     
    154154                if (SUCCEEDED(rc))
    155155                {
    156                     rc = wrapper->init (err);
     156                    rc = wrapper->init(err);
    157157                    if (SUCCEEDED(rc))
    158158                        curInfo = wrapper;
     
    176176                if (FAILED(rc)) break;
    177177
    178                 rc = infoObj->init (aInfo, curInfo);
     178                rc = infoObj->init(aInfo, curInfo);
    179179                if (FAILED(rc)) break;
    180180
     
    183183
    184184            /* we want to return the head's result code */
    185             rc = info->COMGETTER(ResultCode) (&aResultCode);
     185            rc = info->COMGETTER(ResultCode)(&aResultCode);
    186186            if (FAILED(rc)) break;
    187187        }
     
    192192            if (FAILED(rc)) break;
    193193
    194             rc = infoObj->init (aResultCode, aIID, aComponent, strText.c_str(), curInfo);
     194            rc = infoObj->init(aResultCode, aIID, aComponent, strText.c_str(), curInfo);
    195195            if (FAILED(rc)) break;
    196196
     
    201201        rc = info.queryInterfaceTo(err.asOutParam());
    202202        if (SUCCEEDED(rc))
    203             rc = ::SetErrorInfo (0, err);
     203            rc = ::SetErrorInfo(0, err);
    204204
    205205#else // !defined (VBOX_WITH_XPCOM)
    206206
    207207        nsCOMPtr <nsIExceptionService> es;
    208         es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
     208        es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
    209209        if (NS_SUCCEEDED(rc))
    210210        {
    211211            nsCOMPtr <nsIExceptionManager> em;
    212             rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
     212            rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
    213213            if (FAILED(rc)) break;
    214214
     
    218218                /* get the current error info if any */
    219219                ComPtr<nsIException> ex;
    220                 rc = em->GetCurrentException (ex.asOutParam());
     220                rc = em->GetCurrentException(ex.asOutParam());
    221221                if (FAILED(rc)) break;
    222222                rc = ex.queryInterfaceTo(curInfo.asOutParam());
    223                 if (FAILED (rc))
     223                if (FAILED(rc))
    224224                {
    225225                    /* create a IVirtualBoxErrorInfo wrapper for the native
     
    229229                    if (SUCCEEDED(rc))
    230230                    {
    231                         rc = wrapper->init (ex);
     231                        rc = wrapper->init(ex);
    232232                        if (SUCCEEDED(rc))
    233233                            curInfo = wrapper;
     
    236236            }
    237237            /* On failure, curInfo will stay null */
    238             Assert (SUCCEEDED(rc) || curInfo.isNull());
     238            Assert(SUCCEEDED(rc) || curInfo.isNull());
    239239
    240240            /* set the current error info and preserve the previous one if any */
     
    251251                    if (FAILED(rc)) break;
    252252
    253                     rc = infoObj->init (aInfo, curInfo);
     253                    rc = infoObj->init(aInfo, curInfo);
    254254                    if (FAILED(rc)) break;
    255255
     
    259259                /* we want to return the head's result code */
    260260                PRInt32 lrc;
    261                 rc = info->COMGETTER(ResultCode) (&lrc); aResultCode = lrc;
     261                rc = info->COMGETTER(ResultCode)(&lrc); aResultCode = lrc;
    262262                if (FAILED(rc)) break;
    263263            }
     
    277277            rc = info.queryInterfaceTo(ex.asOutParam());
    278278            if (SUCCEEDED(rc))
    279                 rc = em->SetCurrentException (ex);
     279                rc = em->SetCurrentException(ex);
    280280        }
    281281        else if (rc == NS_ERROR_UNEXPECTED)
     
    301301    while (0);
    302302
    303     AssertComRC (rc);
     303    AssertComRC(rc);
    304304
    305305    return SUCCEEDED(rc) ? aResultCode : rc;
     
    307307
    308308/* static */
    309 HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const GUID &aIID,
    310                                         const char *aComponent, const char *aText,
    311                                         ...)
    312 {
    313     va_list args;
    314     va_start (args, aText);
    315     HRESULT rc = setErrorV (aResultCode, aIID, aComponent, aText, args);
    316     va_end (args);
     309HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const GUID &aIID,
     310                                       const char *aComponent, const char *aText,
     311                                       ...)
     312{
     313    va_list args;
     314    va_start(args, aText);
     315    HRESULT rc = setErrorV(aResultCode, aIID, aComponent, aText, args);
     316    va_end(args);
    317317    return rc;
    318318}
    319319
    320320/* static */
    321 HRESULT SupportErrorInfoBase::setWarning (HRESULT aResultCode, const GUID &aIID,
    322                                           const char *aComponent, const char *aText,
    323                                           ...)
    324 {
    325     va_list args;
    326     va_start (args, aText);
    327     HRESULT rc = setWarningV (aResultCode, aIID, aComponent, aText, args);
    328     va_end (args);
    329     return rc;
    330 }
    331 
    332 HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const char *aText, ...)
    333 {
    334     va_list args;
    335     va_start (args, aText);
    336     HRESULT rc = setErrorV (aResultCode, mainInterfaceID(), componentName(),
    337                             aText, args);
    338     va_end (args);
    339     return rc;
    340 }
    341 
    342 HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const Utf8Str &strText)
     321HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const GUID &aIID,
     322                                         const char *aComponent, const char *aText,
     323                                         ...)
     324{
     325    va_list args;
     326    va_start(args, aText);
     327    HRESULT rc = setWarningV(aResultCode, aIID, aComponent, aText, args);
     328    va_end(args);
     329    return rc;
     330}
     331
     332HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const char *aText, ...)
     333{
     334    va_list args;
     335    va_start(args, aText);
     336    HRESULT rc = setErrorV(aResultCode, mainInterfaceID(), componentName(),
     337                           aText, args);
     338    va_end(args);
     339    return rc;
     340}
     341
     342HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const Utf8Str &strText)
    343343{
    344344    HRESULT rc = setError(aResultCode,
     
    349349}
    350350
    351 HRESULT SupportErrorInfoBase::setWarning (HRESULT aResultCode, const char *aText, ...)
    352 {
    353     va_list args;
    354     va_start (args, aText);
    355     HRESULT rc = setWarningV (aResultCode, mainInterfaceID(), componentName(),
    356                               aText, args);
    357     va_end (args);
    358     return rc;
    359 }
    360 
    361 HRESULT SupportErrorInfoBase::setError (HRESULT aResultCode, const GUID &aIID,
    362                                         const char *aText, ...)
    363 {
    364     va_list args;
    365     va_start (args, aText);
    366     HRESULT rc = setErrorV (aResultCode, aIID, componentName(), aText, args);
    367     va_end (args);
    368     return rc;
    369 }
    370 
    371 HRESULT SupportErrorInfoBase::setWarning (HRESULT aResultCode, const GUID &aIID,
    372                                           const char *aText, ...)
    373 {
    374     va_list args;
    375     va_start (args, aText);
    376     HRESULT rc = setWarningV (aResultCode, aIID, componentName(), aText, args);
    377     va_end (args);
     351HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const char *aText, ...)
     352{
     353    va_list args;
     354    va_start(args, aText);
     355    HRESULT rc = setWarningV(aResultCode, mainInterfaceID(), componentName(),
     356                             aText, args);
     357    va_end(args);
     358    return rc;
     359}
     360
     361HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const GUID &aIID,
     362                                       const char *aText, ...)
     363{
     364    va_list args;
     365    va_start(args, aText);
     366    HRESULT rc = setErrorV(aResultCode, aIID, componentName(), aText, args);
     367    va_end(args);
     368    return rc;
     369}
     370
     371HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const GUID &aIID,
     372                                         const char *aText, ...)
     373{
     374    va_list args;
     375    va_start(args, aText);
     376    HRESULT rc = setWarningV(aResultCode, aIID, componentName(), aText, args);
     377    va_end(args);
    378378    return rc;
    379379}
  • trunk/src/VBox/Main/glue/initterm.cpp

    r25942 r26186  
    444444            /* Use RTPathAppPrivateArch() first */
    445445            vrc = RTPathAppPrivateArch(szAppHomeDir, sizeof(szAppHomeDir));
    446             AssertRC (vrc);
     446            AssertRC(vrc);
    447447        }
    448448        else
     
    450450            /* Iterate over all other paths */
    451451            szAppHomeDir[RTPATH_MAX - 1] = '\0';
    452             strncpy(szAppHomeDir, kAppPathsToProbe [i], RTPATH_MAX - 1);
     452            strncpy(szAppHomeDir, kAppPathsToProbe[i], RTPATH_MAX - 1);
    453453            vrc = VINF_SUCCESS;
    454454        }
  • trunk/src/VBox/Main/glue/string.cpp

    r21588 r26186  
    7777};
    7878
    79 void Utf8StrFmt::init (const char *format, va_list args)
     79void Utf8StrFmt::init(const char *format, va_list args)
    8080{
    8181    if (!format)
     
    8383
    8484    // assume an extra byte for a terminating zero
    85     size_t fmtlen = strlen (format) + 1;
     85    size_t fmtlen = strlen(format) + 1;
    8686
    8787    FormatData data;
     
    9090        data.size += fmtlen;
    9191    data.pos = 0;
    92     data.cache = (char *) ::RTMemTmpAllocZ (data.size);
     92    data.cache = (char*)::RTMemTmpAllocZ(data.size);
    9393
    94     size_t n = ::RTStrFormatV (strOutput, &data, NULL, NULL, format, args);
     94    size_t n = ::RTStrFormatV(strOutput, &data, NULL, NULL, format, args);
    9595
    96     AssertMsg (n == data.pos,
    97                ("The number of bytes formatted doesn't match: %d and %d!",
    98                 n, data.pos));
    99     NOREF (n);
     96    AssertMsg(n == data.pos,
     97              ("The number of bytes formatted doesn't match: %d and %d!", n, data.pos));
     98    NOREF(n);
    10099
    101100    // finalize formatting
    102     data.cache [data.pos] = 0;
    103     (*static_cast <Utf8Str *> (this)) = data.cache;
    104     ::RTMemTmpFree (data.cache);
     101    data.cache[data.pos] = 0;
     102    (*static_cast<Utf8Str*>(this)) = data.cache;
     103    ::RTMemTmpFree(data.cache);
    105104}
    106105
    107106// static
    108 DECLCALLBACK(size_t) Utf8StrFmt::strOutput (void *pvArg, const char *pachChars,
    109                                             size_t cbChars)
     107DECLCALLBACK(size_t) Utf8StrFmt::strOutput(void *pvArg, const char *pachChars,
     108                                           size_t cbChars)
    110109{
    111     Assert (pvArg);
     110    Assert(pvArg);
    112111    FormatData &data = *(FormatData *) pvArg;
    113112
    114113    if (!(pachChars == NULL && cbChars == 0))
    115114    {
    116         Assert (pachChars);
     115        Assert(pachChars);
    117116
    118117        // append to cache (always assume an extra byte for a terminating zero)
     
    123122            if (needed >= FormatData::CacheIncrement)
    124123                data.size += needed;
    125             data.cache = (char *) ::RTMemRealloc (data.cache, data.size);
     124            data.cache = (char*)::RTMemRealloc(data.cache, data.size);
    126125        }
    127         strncpy (data.cache + data.pos, pachChars, cbChars);
     126        strncpy(data.cache + data.pos, pachChars, cbChars);
    128127        data.pos += cbChars;
    129128    }
  • trunk/src/VBox/Main/hgcm/HGCMThread.cpp

    r21878 r26186  
    194194    pThread->m_fu32ThreadFlags &= ~HGCMMSG_TF_INITIALIZING;
    195195    rc = RTThreadUserSignal (ThreadSelf);
    196     AssertRC (rc);
     196    AssertRC(rc);
    197197
    198198    pThread->m_pfnThread (pThread->Handle (), pThread->m_pvUser);
     
    300300                    /* Wait until the thread is ready. */
    301301                    rc = RTThreadUserWait (thread, 30000);
    302                     AssertRC (rc);
    303                     Assert (!(m_fu32ThreadFlags & HGCMMSG_TF_INITIALIZING) || RT_FAILURE(rc));
     302                    AssertRC(rc);
     303                    Assert(!(m_fu32ThreadFlags & HGCMMSG_TF_INITIALIZING) || RT_FAILURE(rc));
    304304                }
    305305                else
     
    484484
    485485            /* Remove the message from the head of Queue list. */
    486             Assert (m_pMsgInputQueueHead->m_pPrev == NULL);
     486            Assert(m_pMsgInputQueueHead->m_pPrev == NULL);
    487487
    488488            if (m_pMsgInputQueueHead->m_pNext)
     
    493493            else
    494494            {
    495                 Assert (m_pMsgInputQueueHead == m_pMsgInputQueueTail);
     495                Assert(m_pMsgInputQueueHead == m_pMsgInputQueueTail);
    496496
    497497                m_pMsgInputQueueHead = NULL;
  • trunk/src/VBox/Main/include/AutoCaller.h

    r25859 r26186  
    9090
    9191    /**
    92      * Returns |true| if |SUCCEEDED (rc())| is |true|, for convenience.
     92     * Returns |true| if |SUCCEEDED(rc())| is |true|, for convenience.
    9393     * |true| means the number of callers was successfully increased.
    9494     */
     
    245245 *     AssertReturn (autoInitSpan.isOk(), E_FAIL);
    246246 *     ...
    247  *     if (FAILED (rc))
     247 *     if (FAILED(rc))
    248248 *         return rc;
    249249 *     ...
    250  *     if (SUCCEEDED (rc))
     250 *     if (SUCCEEDED(rc))
    251251 *         autoInitSpan.setSucceeded();
    252252 *     return rc;
     
    341341 *     AssertReturn (autoReinitSpan.isOk(), E_FAIL);
    342342 *     ...
    343  *     if (FAILED (rc))
     343 *     if (FAILED(rc))
    344344 *         return rc;
    345345 *     ...
    346  *     if (SUCCEEDED (rc))
     346 *     if (SUCCEEDED(rc))
    347347 *         autoReinitSpan.setSucceeded();
    348348 *     return rc;
     
    478478 *          return S_OK;
    479479 *     ...
    480  *     if (FAILED (rc))
     480 *     if (FAILED(rc))
    481481 *         return rc; // will go back to Ready
    482482 *     ...
    483  *     if (SUCCEEDED (rc))
     483 *     if (SUCCEEDED(rc))
    484484 *         mayUninitSpan.acceptUninit(); // will call uninit()
    485485 *     return rc;
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r26173 r26186  
    6969    do { \
    7070        if (!(drv)) \
    71             return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \
     71            return setError(E_ACCESSDENIED, tr("The console is not powered up")); \
    7272    } while (0)
    7373
     
    217217    static const PDMDRVREG DrvStatusReg;
    218218
    219     void reportAuthLibraryError (const char *filename, int rc)
     219    void reportAuthLibraryError(const char *filename, int rc)
    220220    {
    221         setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc);
     221        setError(E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc);
    222222    }
    223223
     
    242242        AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK)
    243243        {
    244             Assert (aThat);
     244            Assert(aThat);
    245245            mRC = aThat->addVMCaller (taQuiet, taAllowNullVM);
    246246        }
    247247        ~AutoVMCallerBase()
    248248        {
    249             if (SUCCEEDED (mRC))
     249            if (SUCCEEDED(mRC))
    250250                mThat->releaseVMCaller();
    251251        }
     
    253253        void release()
    254254        {
    255             AssertReturnVoid (SUCCEEDED (mRC));
     255            AssertReturnVoid(SUCCEEDED(mRC));
    256256            mThat->releaseVMCaller();
    257257            mRC = E_FAIL;
     
    261261        void add()
    262262        {
    263             AssertReturnVoid (!SUCCEEDED (mRC));
     263            AssertReturnVoid(!SUCCEEDED(mRC));
    264264            mRC = mThat->addVMCaller (taQuiet, taAllowNullVM);
    265265        }
    266266        /** Returns the result of Console::addVMCaller() */
    267267        HRESULT rc() const { return mRC; }
    268         /** Shortcut to SUCCEEDED (rc()) */
    269         bool isOk() const { return SUCCEEDED (mRC); }
     268        /** Shortcut to SUCCEEDED(rc()) */
     269        bool isOk() const { return SUCCEEDED(mRC); }
    270270    protected:
    271271        Console *mThat;
     
    328328        SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL)
    329329        {
    330             if (SUCCEEDED (Base::mRC))
     330            if (SUCCEEDED(Base::mRC))
    331331                mpVM = aThat->mpVM;
    332332        }
  • trunk/src/VBox/Main/include/ProgressCombinedImpl.h

    r25859 r26186  
    131131
    132132        /* Confirm a successful initialization when it's the case */
    133         if (SUCCEEDED (rc))
     133        if (SUCCEEDED(rc))
    134134            autoInitSpan.setSucceeded();
    135135
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r26171 r26186  
    149149 *
    150150 *  In the debug build, this macro is equivalent to Assert.
    151  *  In the release build, this macro uses |setError (E_FAIL, ...)| to set the
     151 *  In the release build, this macro uses |setError(E_FAIL, ...)| to set the
    152152 *  error info from the asserted expression.
    153153 *
     
    960960 *  On all platforms, the template argument must also define the following
    961961 *  method: |public static const wchar_t *C::getComponentName()|. See
    962  *  #setError (HRESULT, const char *, ...) for a description on how it is
     962 *  #setError(HRESULT, const char *, ...) for a description on how it is
    963963 *  used.
    964964 *
     
    10411041     *  overloaded versions, that automatically substitute some arguments
    10421042     *  taking their values from the template parameters. See
    1043      *  #setError (HRESULT, const char *, ...) for an example.
     1043     *  #setError(HRESULT, const char *, ...) for an example.
    10441044     *
    10451045     *  @param  aResultCode result (error) code, must not be S_OK
     
    10941094     *  (a value of C::getComponentName()).
    10951095     *
    1096      *  See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...)
     1096     *  See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...)
    10971097     *  for details.
    10981098     *
     
    11021102     *
    11031103     *  <code>
    1104      *      return setError (E_FAIL, "Terrible Error");
     1104     *      return setError(E_FAIL, "Terrible Error");
    11051105     *  </code>
    11061106     *  or
    11071107     *  <code>
    1108      *      HRESULT rc = setError (E_FAIL, "Terrible Error");
     1108     *      HRESULT rc = setError(E_FAIL, "Terrible Error");
    11091109     *      ...
    11101110     *      return rc;
     
    11461146     *  (a value of C::getComponentName()).
    11471147     *
    1148      *  See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...)
    1149      *  and #setError (HRESULT, const char *, ...)  for details.
     1148     *  See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...)
     1149     *  and #setError(HRESULT, const char *, ...)  for details.
    11501150     */
    11511151    static HRESULT setErrorV(HRESULT aResultCode, const char *aText,
     
    11831183     *  Bstr string, because it omits an extra conversion Utf8Str -> Bstr.
    11841184     *
    1185      *  See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...)
    1186      *  and #setError (HRESULT, const char *, ...)  for details.
     1185     *  See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...)
     1186     *  and #setError(HRESULT, const char *, ...)  for details.
    11871187     */
    11881188    static HRESULT setErrorBstr(HRESULT aResultCode, const Bstr &aText)
     
    12151215     *  id manually.
    12161216     *
    1217      *  See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...)
     1217     *  See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...)
    12181218     *  for details.
    12191219     */
     
    12541254     *  harmless error from causing confusion.
    12551255     *
    1256      *  It is otherwise identical to #setError (HRESULT, const char *text, ...).
     1256     *  It is otherwise identical to #setError(HRESULT, const char *text, ...).
    12571257     */
    12581258    static HRESULT setErrorNoLog(HRESULT aResultCode, const char *aText, ...)
  • trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h

    r23223 r26186  
    7878    //        is available in this class.
    7979    static const char *tr (const char *a) { return a; }
    80     static HRESULT setError (HRESULT rc,
    81                              const char * /* a */,
    82                              const char * /* b */,
    83                              void *       /* c */) { return rc; }
     80    static HRESULT setError(HRESULT rc,
     81                            const char * /* a */,
     82                            const char * /* b */,
     83                            void *       /* c */) { return rc; }
    8484
    8585    HRESULT mResultCode;
  • trunk/src/VBox/Main/linux/HostHardwareLinux.cpp

    r25942 r26186  
    11661166    bool IsSet ()
    11671167    {
    1168         Assert ((mError.name == NULL) == (mError.message == NULL));
     1168        Assert((mError.name == NULL) == (mError.message == NULL));
    11691169        return (mError.name != NULL);
    11701170    }
    11711171    bool HasName (const char *pcszName)
    11721172    {
    1173         Assert ((mError.name == NULL) == (mError.message == NULL));
     1173        Assert((mError.name == NULL) == (mError.message == NULL));
    11741174        return (RTStrCmp (mError.name, pcszName) == 0);
    11751175    }
     
    16241624    if (RT_SUCCESS(rc) && halSuccess)
    16251625    {
    1626         Assert (pMatches->size() == cProps);
    1627         AssertForEach (j, size_t, 0, cProps,    (pfMatches == NULL)
    1628                                              || (pfMatches[j] == true)
    1629                                              || ((pfMatches[j] == false) && (pMatches[j].size() == 0)));
     1626        Assert(pMatches->size() == cProps);
     1627        AssertForEach(j, size_t, 0, cProps,    (pfMatches == NULL)
     1628                                            || (pfMatches[j] == true)
     1629                                            || ((pfMatches[j] == false) && (pMatches[j].size() == 0)));
    16301630    }
    16311631    LogFlowFunc (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess));
     
    16541654    autoDBusError dbusError;
    16551655
    1656     RTMemAutoPtr <DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet;
    1657     RTMemAutoPtr <DBusConnection, VBoxHalShutdown> dbusConnection;
     1656    RTMemAutoPtr<DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet;
     1657    RTMemAutoPtr<DBusConnection, VBoxHalShutdown> dbusConnection;
    16581658    DBusMessageIter iterFind, iterUdis;
    16591659
     
    16651665    if (halSuccess && RT_SUCCESS(rc))
    16661666    {
    1667         rc = halFindDeviceStringMatch (dbusConnection.get(), "info.subsystem",
    1668                                        "usb_device", &replyFind);
     1667        rc = halFindDeviceStringMatch(dbusConnection.get(), "info.subsystem",
     1668                                      "usb_device", &replyFind);
    16691669        if (!replyFind)
    16701670            halSuccess = false;
     
    16721672    if (halSuccess && RT_SUCCESS(rc))
    16731673    {
    1674         dbus_message_iter_init (replyFind.get(), &iterFind);
     1674        dbus_message_iter_init(replyFind.get(), &iterFind);
    16751675        if (dbus_message_iter_get_arg_type (&iterFind) != DBUS_TYPE_ARRAY)
    16761676            halSuccess = false;
     
    16791679     * entries. */
    16801680    if (halSuccess && RT_SUCCESS(rc))
    1681         dbus_message_iter_recurse (&iterFind, &iterUdis);
     1681        dbus_message_iter_recurse(&iterFind, &iterUdis);
    16821682    for (;    halSuccess && RT_SUCCESS(rc)
    1683            && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING;
     1683           && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING;
    16841684         dbus_message_iter_next(&iterUdis))
    16851685    {
     
    16881688        dbus_message_iter_get_basic (&iterUdis, &pszUdi);
    16891689        static const char *papszKeys[] = { "linux.device_file", "linux.sysfs_path" };
    1690         char *papszValues[RT_ELEMENTS (papszKeys)];
    1691         rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys),
    1692                                     papszKeys, papszValues, &replyGet);
     1690        char *papszValues[RT_ELEMENTS(papszKeys)];
     1691        rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys),
     1692                                   papszKeys, papszValues, &replyGet);
    16931693        const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1];
    16941694        /* Get the interfaces. */
    16951695        if (!!replyGet && pszDevice && pszSysfsPath)
    16961696        {
    1697             USBDeviceInfo info (pszDevice, pszSysfsPath);
     1697            USBDeviceInfo info(pszDevice, pszSysfsPath);
    16981698            bool ifaceSuccess = true;  /* If we can't get the interfaces, just
    16991699                                        * skip this one device. */
    1700             rc = getUSBInterfacesFromHal (&info.mInterfaces, pszUdi, &ifaceSuccess);
     1700            rc = getUSBInterfacesFromHal(&info.mInterfaces, pszUdi, &ifaceSuccess);
    17011701            if (RT_SUCCESS(rc) && halSuccess && ifaceSuccess)
    17021702                try
    17031703                {
    1704                     pList->push_back (info);
     1704                    pList->push_back(info);
    17051705                }
    17061706                catch(std::bad_alloc &e)
     
    17141714    if (pfSuccess != NULL)
    17151715        *pfSuccess = halSuccess;
    1716     LogFlow (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess));
     1716    LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess));
    17171717    dbusError.FlowLog();
    17181718    return rc;
     
    17391739    autoDBusError dbusError;
    17401740
    1741     RTMemAutoPtr <DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet;
    1742     RTMemAutoPtr <DBusConnection, VBoxHalShutdown> dbusConnection;
     1741    RTMemAutoPtr<DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet;
     1742    RTMemAutoPtr<DBusConnection, VBoxHalShutdown> dbusConnection;
    17431743    DBusMessageIter iterFind, iterUdis;
    17441744
    17451745    /* Connect to hal */
    1746     rc = halInit (&dbusConnection);
     1746    rc = halInit(&dbusConnection);
    17471747    if (!dbusConnection)
    17481748        halSuccess = false;
     
    17501750    if (halSuccess && RT_SUCCESS(rc))
    17511751    {
    1752         rc = halFindDeviceStringMatch (dbusConnection.get(), "info.category",
     1752        rc = halFindDeviceStringMatch(dbusConnection.get(), "info.category",
    17531753                                       "usbraw", &replyFind);
    17541754        if (!replyFind)
     
    17571757    if (halSuccess && RT_SUCCESS(rc))
    17581758    {
    1759         dbus_message_iter_init (replyFind.get(), &iterFind);
    1760         if (dbus_message_iter_get_arg_type (&iterFind) != DBUS_TYPE_ARRAY)
     1759        dbus_message_iter_init(replyFind.get(), &iterFind);
     1760        if (dbus_message_iter_get_arg_type(&iterFind) != DBUS_TYPE_ARRAY)
    17611761            halSuccess = false;
    17621762    }
     
    17641764     * entries. */
    17651765    if (halSuccess && RT_SUCCESS(rc))
    1766         dbus_message_iter_recurse (&iterFind, &iterUdis);
     1766        dbus_message_iter_recurse(&iterFind, &iterUdis);
    17671767    for (;    halSuccess && RT_SUCCESS(rc)
    1768            && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING;
     1768           && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING;
    17691769         dbus_message_iter_next(&iterUdis))
    17701770    {
    17711771        /* Get the device node and the sysfs path for the current entry. */
    17721772        const char *pszUdi;
    1773         dbus_message_iter_get_basic (&iterUdis, &pszUdi);
     1773        dbus_message_iter_get_basic(&iterUdis, &pszUdi);
    17741774        static const char *papszKeys[] = { "linux.device_file", "info.parent" };
    1775         char *papszValues[RT_ELEMENTS (papszKeys)];
    1776         rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys),
    1777                                     papszKeys, papszValues, &replyGet);
     1775        char *papszValues[RT_ELEMENTS(papszKeys)];
     1776        rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys),
     1777                                   papszKeys, papszValues, &replyGet);
    17781778        const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1];
    17791779        /* Get the interfaces. */
    17801780        if (!!replyGet && pszDevice && pszSysfsPath)
    17811781        {
    1782             USBDeviceInfo info (pszDevice, pszSysfsPath);
     1782            USBDeviceInfo info(pszDevice, pszSysfsPath);
    17831783            bool ifaceSuccess = false;  /* If we can't get the interfaces, just
    17841784                                         * skip this one device. */
    1785             rc = getUSBInterfacesFromHal (&info.mInterfaces, pszSysfsPath,
    1786                                           &ifaceSuccess);
     1785            rc = getUSBInterfacesFromHal(&info.mInterfaces, pszSysfsPath,
     1786                                         &ifaceSuccess);
    17871787            if (RT_SUCCESS(rc) && halSuccess && ifaceSuccess)
    17881788                try
    17891789                {
    1790                     pList->push_back (info);
     1790                    pList->push_back(info);
    17911791                }
    17921792                catch(std::bad_alloc &e)
     
    17961796        }
    17971797    }
    1798     if (dbusError.HasName (DBUS_ERROR_NO_MEMORY))
     1798    if (dbusError.HasName(DBUS_ERROR_NO_MEMORY))
    17991799        rc = VERR_NO_MEMORY;
    18001800    if (pfSuccess != NULL)
    18011801        *pfSuccess = halSuccess;
    1802     LogFlow (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess));
     1802    LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess));
    18031803    dbusError.FlowLog();
    18041804    return rc;
     
    18221822                            const char *pcszUdi, bool *pfSuccess)
    18231823{
    1824     AssertReturn(VALID_PTR (pList) && VALID_PTR (pcszUdi) &&
     1824    AssertReturn(VALID_PTR(pList) && VALID_PTR(pcszUdi) &&
    18251825                 (pfSuccess == NULL || VALID_PTR (pfSuccess)),
    18261826                 VERR_INVALID_POINTER);
    1827     LogFlowFunc (("pList=%p, pcszUdi=%s, pfSuccess=%p\n", pList, pcszUdi,
    1828                   pfSuccess));
     1827    LogFlowFunc(("pList=%p, pcszUdi=%s, pfSuccess=%p\n", pList, pcszUdi,
     1828                 pfSuccess));
    18291829    int rc = VINF_SUCCESS;  /* We set this to failure on fatal errors. */
    18301830    bool halSuccess = true;  /* We set this to false to abort the operation. */
     
    18351835    DBusMessageIter iterFind, iterUdis;
    18361836
    1837     rc = halInit (&dbusConnection);
     1837    rc = halInit(&dbusConnection);
    18381838    if (!dbusConnection)
    18391839        halSuccess = false;
     
    18411841    {
    18421842        /* Look for children of the current UDI. */
    1843         rc = halFindDeviceStringMatch (dbusConnection.get(), "info.parent",
    1844                                        pcszUdi, &replyFind);
     1843        rc = halFindDeviceStringMatch(dbusConnection.get(), "info.parent",
     1844                                      pcszUdi, &replyFind);
    18451845        if (!replyFind)
    18461846            halSuccess = false;
     
    18481848    if (halSuccess && RT_SUCCESS(rc))
    18491849    {
    1850         dbus_message_iter_init (replyFind.get(), &iterFind);
    1851         if (dbus_message_iter_get_arg_type (&iterFind) != DBUS_TYPE_ARRAY)
     1850        dbus_message_iter_init(replyFind.get(), &iterFind);
     1851        if (dbus_message_iter_get_arg_type(&iterFind) != DBUS_TYPE_ARRAY)
    18521852            halSuccess = false;
    18531853    }
    18541854    if (halSuccess && RT_SUCCESS(rc))
    1855         dbus_message_iter_recurse (&iterFind, &iterUdis);
     1855        dbus_message_iter_recurse(&iterFind, &iterUdis);
    18561856    for (;    halSuccess && RT_SUCCESS(rc)
    1857            && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING;
     1857           && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING;
    18581858         dbus_message_iter_next(&iterUdis))
    18591859    {
    18601860        /* Now get the sysfs path and the subsystem from the iterator */
    18611861        const char *pszUdi;
    1862         dbus_message_iter_get_basic (&iterUdis, &pszUdi);
     1862        dbus_message_iter_get_basic(&iterUdis, &pszUdi);
    18631863        static const char *papszKeys[] = { "linux.sysfs_path", "info.subsystem",
    18641864                                           "linux.subsystem" };
    1865         char *papszValues[RT_ELEMENTS (papszKeys)];
    1866         rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys),
    1867                                     papszKeys, papszValues, &replyGet);
     1865        char *papszValues[RT_ELEMENTS(papszKeys)];
     1866        rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys),
     1867                                   papszKeys, papszValues, &replyGet);
    18681868        const char *pszSysfsPath = papszValues[0], *pszInfoSubsystem = papszValues[1],
    18691869                   *pszLinuxSubsystem = papszValues[2];
     
    18771877            try
    18781878            {
    1879                 pList->push_back (pszSysfsPath);
     1879                pList->push_back(pszSysfsPath);
    18801880            }
    18811881            catch(std::bad_alloc &e)
     
    18841884            }
    18851885    }
    1886     if (dbusError.HasName (DBUS_ERROR_NO_MEMORY))
     1886    if (dbusError.HasName(DBUS_ERROR_NO_MEMORY))
    18871887        rc = VERR_NO_MEMORY;
    18881888    if (pfSuccess != NULL)
    18891889        *pfSuccess = halSuccess;
    1890     LogFlow (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess));
     1890    LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess));
    18911891    dbusError.FlowLog();
    18921892    return rc;
     
    19061906 */
    19071907/* static */
    1908 DBusHandlerResult dbusFilterFunction (DBusConnection * /* pConnection */,
    1909                                       DBusMessage *pMessage, void *pvUser)
    1910 {
    1911     volatile bool *pTriggered = reinterpret_cast<volatile bool *> (pvUser);
    1912     if (   dbus_message_is_signal (pMessage, "org.freedesktop.Hal.Manager",
    1913                                    "DeviceAdded")
    1914         || dbus_message_is_signal (pMessage, "org.freedesktop.Hal.Manager",
    1915                                    "DeviceRemoved"))
     1908DBusHandlerResult dbusFilterFunction(DBusConnection * /* pConnection */,
     1909                                     DBusMessage *pMessage, void *pvUser)
     1910{
     1911    volatile bool *pTriggered = reinterpret_cast<volatile bool *>(pvUser);
     1912    if (   dbus_message_is_signal(pMessage, "org.freedesktop.Hal.Manager",
     1913                                  "DeviceAdded")
     1914        || dbus_message_is_signal(pMessage, "org.freedesktop.Hal.Manager",
     1915                                  "DeviceRemoved"))
    19161916    {
    19171917        *pTriggered = true;
  • trunk/src/VBox/Main/testcase/tstVBoxAPILinux.cpp

    r24499 r26186  
    124124        for (PRUint32 i = 0; i < machineCnt; ++ i)
    125125        {
    126             IMachine *machine = machines [i];
     126            IMachine *machine = machines[i];
    127127            if (machine)
    128128            {
    129129                PRBool isAccessible = PR_FALSE;
    130                 machine->GetAccessible (&isAccessible);
     130                machine->GetAccessible(&isAccessible);
    131131
    132132                if (isAccessible)
  • trunk/src/VBox/Main/win/NetIf-win.cpp

    r26177 r26186  
    877877                        0, KEY_QUERY_VALUE, &hKey);
    878878
    879     Assert (rc == ERROR_SUCCESS || rc == ERROR_PATH_NOT_FOUND);
     879    Assert(rc == ERROR_SUCCESS || rc == ERROR_PATH_NOT_FOUND);
    880880    if (rc == ERROR_SUCCESS)
    881881    {
     
    887887        RegCloseKey (hKey);
    888888
    889         Assert (rc == ERROR_SUCCESS || rc == ERROR_FILE_NOT_FOUND);
     889        Assert(rc == ERROR_SUCCESS || rc == ERROR_FILE_NOT_FOUND);
    890890    }
    891891
  • trunk/src/VBox/Main/win/svchlp.cpp

    r21878 r26186  
    235235
    236236    aVal.reserve(len + 1);
    237     aVal.mutableRaw() [len] = 0;
     237    aVal.mutableRaw()[len] = 0;
    238238
    239239    /* read string data */
     
    283283            {
    284284#ifdef VBOX_WITH_NETFLT
    285                 vrc = netIfNetworkInterfaceHelperServer (this, msgCode);
     285                vrc = netIfNetworkInterfaceHelperServer(this, msgCode);
    286286#endif
    287287                break;
    288288            }
    289289            default:
    290                 AssertMsgFailedReturn ((
    291                     "Invalid message code %d (%08lX)\n", msgCode, msgCode),
    292                     VERR_GENERAL_FAILURE);
     290                AssertMsgFailedReturn(("Invalid message code %d (%08lX)\n", msgCode, msgCode),
     291                                      VERR_GENERAL_FAILURE);
    293292        }
    294293
  • trunk/src/VBox/Main/win/svcmain.cpp

    r22184 r26186  
    233233                {
    234234                    Bstr str (lpszToken);
    235                     LPCTSTR lpszToken2 = FindOneOf (lpszToken, szTokens);
     235                    LPCTSTR lpszToken2 = FindOneOf(lpszToken, szTokens);
    236236                    if (lpszToken2)
    237                         str.mutableRaw() [lpszToken2 - lpszToken] = '\0';
     237                        str.mutableRaw()[lpszToken2 - lpszToken] = '\0';
    238238                    pipeName = Utf8Str(lpszToken);
    239239                }
  • trunk/src/VBox/Main/xpcom/server.cpp

    r26089 r26186  
    978978
    979979        nsCOMPtr<ipcIService> ipcServ (do_GetService(IPC_SERVICE_CONTRACTID, &rc));
    980         if (NS_FAILED (rc))
     980        if (NS_FAILED(rc))
    981981        {
    982982            RTMsgError("Failed to get IPC service! (rc=%Rhrc)", rc);
  • trunk/src/VBox/Main/xpcom/server_module.cpp

    r24847 r26186  
    8484 *  Full path to the VBoxSVC executable.
    8585 */
    86 static char VBoxSVCPath [RTPATH_MAX];
     86static char VBoxSVCPath[RTPATH_MAX];
    8787static bool IsVBoxSVCPathSet = false;
    8888
     
    160160                }
    161161            }
    162             if (NS_FAILED (rc))
     162            if (NS_FAILED(rc))
    163163                break;
    164164        }
    165165
    166166        nsCOMPtr <ipcIService> ipcServ = do_GetService (IPC_SERVICE_CONTRACTID, &rc);
    167         if (NS_FAILED (rc))
     167        if (NS_FAILED(rc))
    168168            break;
    169169
     
    179179            PRUint32 serverID = 0;
    180180            rc = ipcServ->ResolveClientName (VBOXSVC_IPC_NAME, &serverID);
    181             if (NS_FAILED (rc))
     181            if (NS_FAILED(rc))
    182182            {
    183183                LogFlowFunc (("Starting server \"%s\"...\n", VBoxSVCPath));
     
    241241            nsCOMPtr <ipcIDConnectService> dconServ =
    242242                do_GetService (IPC_DCONNECTSERVICE_CONTRACTID, &rc);
    243             if (NS_FAILED (rc))
     243            if (NS_FAILED(rc))
    244244                break;
    245245
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette