VirtualBox

儲存庫 vbox 的更動 46351


忽略:
時間撮記:
2013-5-31 下午08:25:22 (11 年 以前)
作者:
vboxsync
訊息:

The ICON data isn't required, it's optional so dont fail in copyMachineDataToSettings because of this. For the same reason, don't save the <Icon> element unconditionally, only when there is actual data. Because, we have to bump the settings version when using <Icon>.

位置:
trunk/src/VBox/Main
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r46348 r46351  
    12901290        // We must not throw away entries yet, otherwise settings are lost
    12911291        // without a way to roll back.
    1292         uint32_t newCount = Global::getMaxNetworkAdapters(aChipsetType);
    1293         uint32_t oldCount = mNetworkAdapters.size();
     1292        size_t newCount = Global::getMaxNetworkAdapters(aChipsetType);
     1293        size_t oldCount = mNetworkAdapters.size();
    12941294        if (newCount > oldCount)
    12951295        {
     
    99799979void Machine::copyMachineDataToSettings(settings::MachineConfigFile &config)
    99809980{
    9981     Utf8Str aStr;
    9982 
    99839981    // deep copy extradata
    99849982    config.mapExtraDataItems = mData->pMachineConfigFile->mapExtraDataItems;
     
    99939991    COMGETTER(Icon)(ComSafeArrayAsOutParam(iconByte));
    99949992    ssize_t cbData = iconByte.size();
    9995     if (cbData == 0)
    9996         throw setError(E_FAIL,
    9997                        tr("Icon Data length is zero. '%d'"),
    9998                        cbData);
    9999     ssize_t cchOut = RTBase64EncodedLength(cbData);
    10000     aStr.reserve(cchOut+1);
    10001     HRESULT rc = RTBase64Encode(iconByte.raw(), cbData,
    10002                                 aStr.mutableRaw(), aStr.capacity(),
    10003                                 NULL);
    10004     if (FAILED(rc))
    10005         throw setError(E_FAIL,
    10006                        tr("Failure to Encode Icon Data. '%s' (%d)"),
    10007                        aStr.mutableRaw(),
    10008                        rc);
    10009     aStr.jolt();
    10010     config.machineUserData.ovIcon = aStr.c_str();
     9993    if (cbData > 0)
     9994    {
     9995        ssize_t cchOut = RTBase64EncodedLength(cbData);
     9996        Utf8Str strIconData;
     9997        strIconData.reserve(cchOut+1);
     9998        int vrc = RTBase64Encode(iconByte.raw(), cbData,
     9999                                 strIconData.mutableRaw(), strIconData.capacity(),
     10000                                 NULL);
     10001        if (RT_FAILURE(vrc))
     10002            throw setError(E_FAIL, tr("Failure to Encode Icon Data. '%s' (%Rrc)"), strIconData.mutableRaw(), vrc);
     10003        strIconData.jolt();
     10004        config.machineUserData.ovIcon = strIconData;
     10005    }
     10006    else
     10007        config.machineUserData.ovIcon.setNull();
    1001110008
    1001210009    if (    mData->mMachineState == MachineState_Saved
     
    1004010037    /// @todo Live Migration:        config.fTeleported = (mData->mMachineState == MachineState_Teleported);
    1004110038
    10042     rc = saveHardware(config.hardwareMachine, &config.debugging, &config.autostart);
     10039    HRESULT rc = saveHardware(config.hardwareMachine, &config.debugging, &config.autostart);
    1004310040    if (FAILED(rc)) throw rc;
    1004410041
  • trunk/src/VBox/Main/xml/Settings.cpp

    r46348 r46351  
    48494849    if (machineUserData.strDescription.length())
    48504850        elmMachine.createChild("Description")->addContent(machineUserData.strDescription);
    4851     elmMachine.setAttribute("Icon", machineUserData.ovIcon);
     4851    if (machineUserData.ovIcon.length())
     4852        elmMachine.setAttribute("Icon", machineUserData.ovIcon);
    48524853    elmMachine.setAttribute("OSType", machineUserData.strOsType);
    48534854    if (    strStateFile.length()
     
    50515052        if (   !hardwareMachine.strDefaultFrontend.isEmpty()
    50525053            || hardwareMachine.graphicsControllerType != GraphicsControllerType_VBoxVGA
    5053             || hardwareMachine.enmLongMode != Hardware::LongMode_Legacy)
     5054            || hardwareMachine.enmLongMode != Hardware::LongMode_Legacy
     5055            || machineUserData.ovIcon.length() > 0)
    50545056            m->sv = SettingsVersion_v1_14;
    50555057    }
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette