VirtualBox

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


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/glue
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.

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