VirtualBox

Changeset 85282 in vbox


Ignore:
Timestamp:
Jul 12, 2020 2:53:50 PM (4 years ago)
Author:
vboxsync
Message:

Main/ApplianceImpl.cpp: Signed/unsigned conversion issues in i_searchUniqueImageFilePath. Renamed it to i_ensureUniqueImageFilePath as it's not really searching anything. bugref:9790

File:
1 edited

Legend:

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

    r84532 r85282  
    982982}
    983983
    984 HRESULT Appliance::i_searchUniqueImageFilePath(const Utf8Str &aMachineFolder, DeviceType_T aDeviceType, Utf8Str &aName) const
     984HRESULT Appliance::i_ensureUniqueImageFilePath(const Utf8Str &aMachineFolder, DeviceType_T aDeviceType, Utf8Str &aName) const
    985985{
    986986    /*
     
    988988     */
    989989    Utf8Str strAbsName;
    990     ssize_t offDashNum = -1;
    991     ssize_t cchDashNum = 0;
     990    size_t  offDashNum = ~(size_t)0;
     991    size_t cchDashNum = 0;
    992992    for (unsigned i = 1;; i++)
    993993    {
     
    10071007
    10081008        /* Insert '_%i' before the suffix and try again. */
    1009         if (offDashNum < 0)
     1009        if (offDashNum == ~(size_t)0)
    10101010        {
    10111011            const char *pszSuffix = RTPathSuffix(aName.c_str());
    1012             offDashNum = pszSuffix ? pszSuffix - aName.c_str() : aName.length();
     1012            offDashNum = pszSuffix ? (size_t)(pszSuffix - aName.c_str()) : aName.length();
    10131013        }
    10141014        char   szTmp[32];
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