VirtualBox

Changeset 81361 in vbox


Ignore:
Timestamp:
Oct 18, 2019 5:22:44 PM (5 years ago)
Author:
vboxsync
Message:

bugref:8345. replace wrong usage Utf8Str::contains() by RTPathStartsWith().

File:
1 edited

Legend:

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

    r80585 r81361  
    170170    uint32_t cbSector = 0;
    171171
     172
    172173    int vrc = RTFsQuerySizes(strTargetFolder.c_str(), &cbTotal, &cbFree, &cbBlock, &cbSector);
    173174    if (FAILED(vrc))
     
    249250    strLogFolder = bstr_logFolder;
    250251    if (   m_type.equals("basic")
    251         && strLogFolder.contains(strSettingsFilePath))
     252        && RTPathStartsWith(strLogFolder.c_str(), strSettingsFilePath.c_str()))
    252253        m_vmFolders.insert(std::make_pair(VBox_LogFolder, strLogFolder));
    253254
     
    265266        strStateFilePath.stripFilename();
    266267        if (   m_type.equals("basic")
    267             && strStateFilePath.contains(strSettingsFilePath))
     268            && RTPathStartsWith(strStateFilePath.c_str(), strSettingsFilePath.c_str()))
    268269            m_vmFolders.insert(std::make_pair(VBox_StateFolder, strStateFilePath));
    269270    }
     
    277278    strSnapshotFolder = bstr_snapshotFolder;
    278279    if (   m_type.equals("basic")
    279         && strSnapshotFolder.contains(strSettingsFilePath))
     280        && RTPathStartsWith(strSnapshotFolder.c_str(), strSettingsFilePath.c_str()))
    280281        m_vmFolders.insert(std::make_pair(VBox_SnapshotFolder, strSnapshotFolder));
    281282
     
    391392            Utf8Str name = sst.strSaveStateFile;
    392393            /*if a state file is located in the actual VM folder it will be added to the actual list */
    393             if (name.contains(strSettingsFilePath))
     394            if (RTPathStartsWith(name.c_str(), strSettingsFilePath.c_str()))
    394395            {
    395396                vrc = RTFileQuerySizeByPath(name.c_str(), &cbFile);
     
    11841185             * Maybe the more clever check is needed in the some corner cases.
    11851186             */
    1186             if (!path.contains(targetPath))
     1187            if (!RTPathStartsWith(path.c_str(), targetPath.c_str()))
    11871188                m_pMachine->mSSData->strStateFilePath = Utf8StrFmt("%s%s",
    11881189                                                                   targetPath.c_str(),
     
    14331434                mt.strBaseName = bstrLocation;
    14341435                Utf8Str const &strFolder = m_vmFolders[VBox_SnapshotFolder];
    1435                 if (strFolder.isNotEmpty() && mt.strBaseName.contains(strFolder)) /** @todo r=bird: contains? Shouldn't it be startsWith and take mixed slashes (windows) and stuff into account? */
     1436               
     1437                if (strFolder.isNotEmpty() && RTPathStartsWith(mt.strBaseName.c_str(), strFolder.c_str()))
    14361438                    mt.fSnapshot = true;
    14371439                else
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