VirtualBox

Changeset 85734 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Aug 12, 2020 8:38:51 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139881
Message:

Main/HostUpdateImpl.cpp: Another Bstr -> Utf8Str. ULONG != unsigned long - so do not use %lu/%ld for formatting them. bugref:7983

File:
1 edited

Legend:

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

    r85733 r85734  
    263263    // Following the sequence of steps in UIUpdateStepVirtualBox::sltStartStep()
    264264    // Build up our query URL starting with the URL basename
    265     Bstr url("https://update.virtualbox.org/query.php/?");
     265    Utf8Str strUrl("https://update.virtualbox.org/query.php/?");
    266266    Bstr platform;
    267267    rc = mVirtualBox->COMGETTER(PackageType)(platform.asOutParam());
    268268    if (FAILED(rc))
    269269        return setErrorVrc(rc, tr("%s: IVirtualBox::packageType() failed: %Rrc"), __FUNCTION__, rc);
    270     url.appendPrintf("platform=%ls", platform.raw()); // e.g. SOLARIS_64BITS_GENERIC
     270    strUrl.appendPrintf("platform=%ls", platform.raw()); // e.g. SOLARIS_64BITS_GENERIC
    271271
    272272    // Get the complete current version string for the query URL
     
    275275    if (FAILED(rc))
    276276        return setErrorVrc(rc, tr("%s: IVirtualBox::versionNormalized() failed: %Rrc"), __FUNCTION__, rc);
    277     url.appendPrintf("&version=%ls", versionNormalized.raw()); // e.g. 6.1.1
    278     // url.appendPrintf("&version=6.0.12"); // comment out previous line and uncomment this one for testing
     277    strUrl.appendPrintf("&version=%ls", versionNormalized.raw()); // e.g. 6.1.1
     278    // strUrl.appendPrintf("&version=6.0.12"); // comment out previous line and uncomment this one for testing
    279279
    280280    ULONG revision;
     
    282282    if (FAILED(rc))
    283283        return setErrorVrc(rc, tr("%s: IVirtualBox::revision() failed: %Rrc"), __FUNCTION__, rc);
    284     url.appendPrintf("_%ld", revision); // e.g. 135618
     284    strUrl.appendPrintf("_%u", revision); // e.g. 135618
    285285
    286286    // acquire the System Properties interface
     
    312312    if (FAILED(rc))
    313313        return rc; // ISystemProperties::setVBoxUpdateCount calls setError() on failure
    314     url.appendPrintf("&count=%lu", cVBoxUpdateCount);
     314    strUrl.appendPrintf("&count=%u", cVBoxUpdateCount);
    315315
    316316    // Update the query URL and the VBoxUpdate settings (if necessary) with the 'Target' information.
     
    323323    {
    324324        case VBoxUpdateTarget_AllReleases:
    325             url.appendPrintf("&branch=allrelease"); // query.php expects 'allrelease' and not 'allreleases'
     325            strUrl.appendPrintf("&branch=allrelease"); // query.php expects 'allrelease' and not 'allreleases'
    326326            break;
    327327        case VBoxUpdateTarget_WithBetas:
    328             url.appendPrintf("&branch=withbetas");
     328            strUrl.appendPrintf("&branch=withbetas");
    329329            break;
    330330        case VBoxUpdateTarget_Stable:
    331331        default:
    332             url.appendPrintf("&branch=stable");
     332            strUrl.appendPrintf("&branch=stable");
    333333            break;
    334334    }
     
    338338        return rc; // ISystemProperties::setTarget calls setError() on failure
    339339
    340     LogRelFunc(("VBox update URL = %s\n", Utf8Str(url).c_str()));
    341 
    342     // Setup the User-Agent headers for the GET request
     340    LogRelFunc(("VBox update URL = %s\n", strUrl.c_str()));
     341
     342    /*
     343     * Setup the User-Agent headers for the GET request
     344     */
    343345    Bstr version;
    344346    rc = mVirtualBox->COMGETTER(Version)(version.asOutParam()); // e.g. 6.1.0_RC1
     
    359361        return setErrorVrc(vrc, tr("%s: RTHttpAddHeader() failed: %Rrc (on User-Agent)"), __FUNCTION__, vrc);
    360362
     363    /*
     364     * Configure proxying.
     365     */
    361366    ProxyMode_T enmProxyMode;
    362367    rc = pSystemProperties->COMGETTER(ProxyMode)(&enmProxyMode);
     
    367372    {
    368373        Bstr strProxyURL;
    369 
    370374        rc = pSystemProperties->COMGETTER(ProxyURL)(strProxyURL.asOutParam());
    371375        if (FAILED(rc))
     
    382386    }
    383387
    384     void *pvResponse = 0;
     388    /*
     389     * Perform the GET request, returning raw binary stuff.
     390     */
     391    void *pvResponse = NULL;
    385392    size_t cbResponse = 0;
    386     vrc = RTHttpGetBinary(hHttp, Utf8Str(url).c_str(), &pvResponse, &cbResponse);
     393    vrc = RTHttpGetBinary(hHttp, strUrl.c_str(), &pvResponse, &cbResponse);
    387394    if (RT_FAILURE(vrc))
    388395        return setErrorVrc(vrc, tr("%s: RTHttpGetBinary() failed: %Rrc"), __FUNCTION__, vrc);
     
    409416
    410417    // clean-up HTTP request paperwork
     418    /** @todo r=bird: There is no chance that this would be NIL here unless
     419     *        you've got stack corruption.  Besides, RTHttpDestruct ignores NIL. */
    411420    if (hHttp != NIL_RTHTTP)
    412421        RTHttpDestroy(hHttp);
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