VirtualBox

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


Ignore:
Timestamp:
Aug 24, 2020 4:44:24 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
140047
Message:

Main/HostUpdateImpl.cpp: clang 11 found a bunch of setErrorVrc calls that should've been setError. Since most of them are related to getting attributes from other VBox interfaces, I've simply replaced them all with AssertComRCReturn. bugref:7983

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/HostUpdateImpl.cpp

    r85738 r85876  
    257257HRESULT HostUpdate::i_checkForVBoxUpdate()
    258258{
    259     HRESULT rc;
    260 
    261259    // Default to no update required
    262260    m_updateNeeded = FALSE;
     
    266264    Utf8Str strUrl("https://update.virtualbox.org/query.php/?");
    267265    Bstr platform;
    268     rc = mVirtualBox->COMGETTER(PackageType)(platform.asOutParam());
    269     if (FAILED(rc))
    270         return setErrorVrc(rc, tr("%s: IVirtualBox::packageType() failed: %Rrc"), __FUNCTION__, rc);
     266    HRESULT rc = mVirtualBox->COMGETTER(PackageType)(platform.asOutParam());
     267    AssertComRCReturn(rc, rc);
    271268    strUrl.appendPrintf("platform=%ls", platform.raw()); // e.g. SOLARIS_64BITS_GENERIC
    272269
     
    274271    Bstr versionNormalized;
    275272    rc = mVirtualBox->COMGETTER(VersionNormalized)(versionNormalized.asOutParam());
    276     if (FAILED(rc))
    277         return setErrorVrc(rc, tr("%s: IVirtualBox::versionNormalized() failed: %Rrc"), __FUNCTION__, rc);
     273    AssertComRCReturn(rc, rc);
    278274    strUrl.appendPrintf("&version=%ls", versionNormalized.raw()); // e.g. 6.1.1
    279275    // strUrl.appendPrintf("&version=6.0.12"); // comment out previous line and uncomment this one for testing
    280276
    281     ULONG revision;
     277    ULONG revision = 0;
    282278    rc = mVirtualBox->COMGETTER(Revision)(&revision);
    283     if (FAILED(rc))
    284         return setErrorVrc(rc, tr("%s: IVirtualBox::revision() failed: %Rrc"), __FUNCTION__, rc);
     279    AssertComRCReturn(rc, rc);
    285280    strUrl.appendPrintf("_%u", revision); // e.g. 135618
    286281
     
    288283    ComPtr<ISystemProperties> ptrSystemProperties;
    289284    rc = mVirtualBox->COMGETTER(SystemProperties)(ptrSystemProperties.asOutParam());
    290     if (FAILED(rc))
    291         return setErrorVrc(rc, tr("%s: IVirtualBox::systemProperties() failed: %Rrc"), __FUNCTION__, rc);
     285    AssertComRCReturn(rc, rc);
    292286
    293287    // Update the VBoxUpdate setting 'VBoxUpdateLastCheckDate'
     
    295289    RTTIMESPEC TimeNow;
    296290    char szTimeStr[RTTIME_STR_LEN];
    297 
    298291    RTTimeToString(RTTimeExplode(&Time, RTTimeNow(&TimeNow)), szTimeStr, sizeof(szTimeStr));
    299292    LogRelFunc(("VBox updating UpdateDate with TimeString = %s\n", szTimeStr));
    300293    rc = ptrSystemProperties->COMSETTER(VBoxUpdateLastCheckDate)(Bstr(szTimeStr).raw());
    301     if (FAILED(rc))
    302         return rc; // ISystemProperties::setLastCheckDate calls setError() on failure
     294    AssertComRCReturn(rc, rc);
    303295
    304296    // Update the queryURL and the VBoxUpdate setting 'VBoxUpdateCount'
    305297    ULONG cVBoxUpdateCount = 0;
    306298    rc = ptrSystemProperties->COMGETTER(VBoxUpdateCount)(&cVBoxUpdateCount);
    307     if (FAILED(rc))
    308         return setErrorVrc(rc, tr("%s: retrieving ISystemProperties::VBoxUpdateCount failed: %Rrc"), __FUNCTION__, rc);
     299    AssertComRCReturn(rc, rc);
    309300
    310301    cVBoxUpdateCount++;
    311302
    312303    rc = ptrSystemProperties->COMSETTER(VBoxUpdateCount)(cVBoxUpdateCount);
    313     if (FAILED(rc))
    314         return rc; // ISystemProperties::setVBoxUpdateCount calls setError() on failure
     304    AssertComRCReturn(rc, rc);
    315305    strUrl.appendPrintf("&count=%u", cVBoxUpdateCount);
    316306
     
    318308    VBoxUpdateTarget_T enmTarget = VBoxUpdateTarget_Stable; // default branch is 'stable'
    319309    rc = ptrSystemProperties->COMGETTER(VBoxUpdateTarget)(&enmTarget);
    320     if (FAILED(rc))
    321         return setErrorVrc(rc, tr("%s: retrieving ISystemProperties::Target failed: %Rrc"), __FUNCTION__, rc);
     310    AssertComRCReturn(rc, rc);
    322311
    323312    switch (enmTarget)
     
    336325
    337326    rc = ptrSystemProperties->COMSETTER(VBoxUpdateTarget)(enmTarget);
    338     if (FAILED(rc))
    339         return rc; // ISystemProperties::setTarget calls setError() on failure
     327    AssertComRCReturn(rc, rc);
    340328
    341329    LogRelFunc(("VBox update URL = %s\n", strUrl.c_str()));
     
    346334    Bstr version;
    347335    rc = mVirtualBox->COMGETTER(Version)(version.asOutParam()); // e.g. 6.1.0_RC1
    348     if (FAILED(rc))
    349         return setErrorVrc(rc, tr("%s: IVirtualBox::version() failed: %Rrc"), __FUNCTION__, rc);
     336    AssertComRCReturn(rc, rc);
    350337
    351338    Utf8StrFmt const strUserAgent("VirtualBox %ls <%s>", version.raw(), HostUpdate::i_platformInfo().c_str());
     
    596583    ComPtr<ISystemProperties> pSystemProperties;
    597584    HRESULT rc = mVirtualBox->COMGETTER(SystemProperties)(pSystemProperties.asOutParam());
    598     if (FAILED(rc))
    599         return setErrorVrc(rc, tr("%s: IVirtualBox::systemProperties() failed: %Rrc"), __FUNCTION__, rc);
     585    AssertComRCReturn(rc, rc);
    600586
    601587    BOOL fVBoxUpdateEnabled = true;
    602588    rc = pSystemProperties->COMGETTER(VBoxUpdateEnabled)(&fVBoxUpdateEnabled);
    603     if (FAILED(rc))
    604         return setErrorVrc(rc, tr("%s: retrieving ISystemProperties::VBoxUpdateEnabled failed: %Rrc"), __FUNCTION__, rc);
     589    AssertComRCReturn(rc, rc);
    605590
    606591    /** @todo r=bird: Not sure if this makes sense, it should at least have a
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