VirtualBox

Changeset 24879 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 23, 2009 4:34:12 PM (15 years ago)
Author:
vboxsync
Message:

Frontends/VBoxManage: eliminate redundant code when using showProgress()

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r24874 r24879  
    8888 * Print out progress on the console
    8989 */
    90 LONG showProgress(ComPtr<IProgress> progress)
     90HRESULT showProgress(ComPtr<IProgress> progress)
    9191{
    9292    BOOL fCompleted;
     
    163163
    164164    /* complete the line. */
    165     LONG iRc;
     165    LONG iRc = E_FAIL;
    166166    if (SUCCEEDED(progress->COMGETTER(ResultCode)(&iRc)))
    167167    {
     
    616616            CHECK_ERROR_BREAK(console, PowerDown(progress.asOutParam()));
    617617
    618             showProgress(progress);
    619 
    620             LONG iRc;
    621             progress->COMGETTER(ResultCode)(&iRc);
    622             if (FAILED(iRc))
     618            rc = showProgress(progress);
     619            if (FAILED(rc))
    623620            {
    624621                com::ProgressErrorInfo info(progress);
     
    638635            CHECK_ERROR_BREAK(console, SaveState(progress.asOutParam()));
    639636
    640             showProgress(progress);
    641 
    642             LONG iRc;
    643             progress->COMGETTER(ResultCode)(&iRc);
    644             if (FAILED(iRc))
     637            rc = showProgress(progress);
     638            if (FAILED(rc))
    645639            {
    646640                com::ProgressErrorInfo info(progress);
     
    13311325            ComPtr<IProgress> progress;
    13321326            CHECK_ERROR_BREAK(console, Teleport(bstrHostname, uPort, bstrPassword, uMaxDowntime, progress.asOutParam()));
    1333             showProgress(progress);
    1334 
    1335             LONG iRc;
    1336             CHECK_ERROR_BREAK(progress, COMGETTER(ResultCode)(&iRc));
    1337             if (FAILED(iRc))
     1327            rc = showProgress(progress);
     1328            if (FAILED(rc))
    13381329            {
    13391330                com::ProgressErrorInfo info(progress);
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r23902 r24879  
    148148
    149149#ifndef VBOX_ONLY_DOCS
    150 LONG showProgress(ComPtr<IProgress> progress);
     150HRESULT showProgress(ComPtr<IProgress> progress);
    151151#endif
    152152
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp

    r22211 r24879  
    7171    CHECK_ERROR(host, CreateHostOnlyNetworkInterface (hif.asOutParam(), progress.asOutParam()));
    7272
    73     showProgress(progress);
    74 
    75     HRESULT hr;
    76     CHECK_ERROR(progress, COMGETTER(ResultCode) (&hr));
    77 
     73    rc = showProgress(progress);
    7874    *pcProcessed = index - iStart;
    79 
    80     if(FAILED(hr))
     75    if (FAILED(rc))
    8176    {
    8277        com::ProgressErrorInfo info(progress);
     
    8479            RTPrintf("Error: failed to create the host-only adapter. Error message: %lS\n", info.getText().raw());
    8580        else
    86             RTPrintf("Error: failed to create the host-only adapter. No error message available, HRESULT code: 0x%x\n", hr);
     81            RTPrintf("Error: failed to create the host-only adapter. No error message available, HRESULT code: 0x%x\n", rc);
    8782
    8883        return 1;
     
    120115    CHECK_ERROR(host, RemoveHostOnlyNetworkInterface (guid, progress.asOutParam()));
    121116
    122     showProgress(progress);
    123 
    124     HRESULT hr;
    125     CHECK_ERROR(progress, COMGETTER(ResultCode) (&hr));
    126 
     117    rc = showProgress(progress);
    127118    *pcProcessed = index - iStart;
    128 
    129     if(FAILED(hr))
     119    if (FAILED(rc))
    130120    {
    131121        com::ProgressErrorInfo info(progress);
     
    133123            RTPrintf("Error: failed to remove the host-only adapter. Error message: %lS\n", info.getText().raw());
    134124        else
    135             RTPrintf("Error: failed to remove the host-only adapter. No error message available, HRESULT code: 0x%x\n", hr);
     125            RTPrintf("Error: failed to remove the host-only adapter. No error message available, HRESULT code: 0x%x\n", rc);
    136126
    137127        return 1;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp

    r24084 r24879  
    314314            CHECK_ERROR_BREAK(console, TakeSnapshot(name, desc, progress.asOutParam()));
    315315
    316             showProgress(progress);
    317             LONG iRc;
    318             progress->COMGETTER(ResultCode)(&iRc);
    319             rc = iRc;
     316            rc = showProgress(progress);
    320317            if (FAILED(rc))
    321318            {
     
    378375            }
    379376
    380             showProgress(pProgress);
    381             LONG iRc;
    382             pProgress->COMGETTER(ResultCode)(&iRc);
    383             rc = iRc;
     377            rc = showProgress(pProgress);
    384378            if (FAILED(rc))
    385379            {
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