Changeset 85256 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jul 11, 2020 11:41:06 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139233
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r84618 r85256 165 165 { 166 166 /* default values for a newly created machine */ 167 mHWVersion = Utf8StrFmt("%d", SchemaDefs::DefaultHardwareVersion);167 mHWVersion.printf("%d", SchemaDefs::DefaultHardwareVersion); 168 168 mMemorySize = 128; 169 169 mCPUCount = 1; … … 4346 4346 LONG aDevice) 4347 4347 { 4348 int rc = S_OK;4349 4348 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n", 4350 4349 aName.c_str(), aControllerPort, aDevice)); 4351 4350 4352 rc = setBandwidthGroupForDevice(aName, aControllerPort, aDevice, NULL); 4353 4354 return rc; 4351 return setBandwidthGroupForDevice(aName, aControllerPort, aDevice, NULL); 4355 4352 } 4356 4353 … … 4417 4414 DeviceType_T aType) 4418 4415 { 4419 HRESULT rc = S_OK;4420 4421 4416 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aType=%d\n", 4422 4417 aName.c_str(), aControllerPort, aDevice, aType)); 4423 4418 4424 rc = attachDevice(aName, aControllerPort, aDevice, aType, NULL); 4425 4426 return rc; 4419 return attachDevice(aName, aControllerPort, aDevice, aType, NULL); 4427 4420 } 4428 4421 … … 4433 4426 BOOL aForce) 4434 4427 { 4435 int rc = S_OK;4436 4428 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d", 4437 4429 aName.c_str(), aControllerPort, aForce)); 4438 4430 4439 rc = mountMedium(aName, aControllerPort, aDevice, NULL, aForce); 4440 4441 return rc; 4431 return mountMedium(aName, aControllerPort, aDevice, NULL, aForce); 4442 4432 } 4443 4433 … … 4448 4438 BOOL aForce) 4449 4439 { 4450 int rc = S_OK;4451 4440 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aForce=%d\n", 4452 4441 aName.c_str(), aControllerPort, aDevice, aForce)); … … 4530 4519 mediumLock.release(); 4531 4520 multiLock.release(); 4532 rc = i_onMediumChange(pAttach, aForce);4521 HRESULT rc = i_onMediumChange(pAttach, aForce); 4533 4522 multiLock.acquire(); 4534 4523 mediumLock.acquire(); … … 5115 5104 See the fSafe parameter of xml::XmlFileWriter::write for details. */ 5116 5105 /** @todo Find a way to avoid referring directly to iprt/xml.h here. */ 5117 Utf8Str otherXml = Utf8StrFmt("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszTmpSuff);5106 Utf8StrFmt otherXml("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszTmpSuff); 5118 5107 RTFileDelete(otherXml.c_str()); 5119 otherXml = Utf8StrFmt("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszPrevSuff);5108 otherXml.printf("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszPrevSuff); 5120 5109 RTFileDelete(otherXml.c_str()); 5121 5110 … … 5132 5121 * Console::powerUpThread()). Also, delete the VBox.png[.N] 5133 5122 * files that may have been created by the GUI. */ 5134 Utf8Str log = Utf8StrFmt("%s%cVBox.log", 5135 logFolder.c_str(), RTPATH_DELIMITER); 5123 Utf8StrFmt log("%s%cVBox.log", logFolder.c_str(), RTPATH_DELIMITER); 5136 5124 RTFileDelete(log.c_str()); 5137 log = Utf8StrFmt("%s%cVBox.png", 5138 logFolder.c_str(), RTPATH_DELIMITER); 5125 log.printf("%s%cVBox.png", logFolder.c_str(), RTPATH_DELIMITER); 5139 5126 RTFileDelete(log.c_str()); 5140 for ( inti = uLogHistoryCount; i > 0; i--)5127 for (ULONG i = uLogHistoryCount; i > 0; i--) 5141 5128 { 5142 log = Utf8StrFmt("%s%cVBox.log.%d", 5143 logFolder.c_str(), RTPATH_DELIMITER, i); 5129 log.printf("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, i); 5144 5130 RTFileDelete(log.c_str()); 5145 log = Utf8StrFmt("%s%cVBox.png.%d", 5146 logFolder.c_str(), RTPATH_DELIMITER, i); 5131 log.printf("%s%cVBox.png.%u", logFolder.c_str(), RTPATH_DELIMITER, i); 5147 5132 RTFileDelete(log.c_str()); 5148 5133 } 5149 5134 #if defined(RT_OS_WINDOWS) 5150 log = Utf8StrFmt("%s%cVBoxStartup.log", logFolder.c_str(), RTPATH_DELIMITER);5135 log.printf("%s%cVBoxStartup.log", logFolder.c_str(), RTPATH_DELIMITER); 5151 5136 RTFileDelete(log.c_str()); 5152 log = Utf8StrFmt("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER);5137 log.printf("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER); 5153 5138 RTFileDelete(log.c_str()); 5154 5139 #endif … … 7142 7127 vrc = RTPathAbs(szTmp, szTmp2, sizeof(szTmp2)); 7143 7128 if (RT_SUCCESS(vrc)) 7144 aLogFolder = Utf8StrFmt("%s%c%s",7145 7146 7147 7129 aLogFolder.printf("%s%c%s", 7130 szTmp2, 7131 RTPATH_DELIMITER, 7132 mUserData->s.strName.c_str()); // path/to/logfolder/vmname 7148 7133 } 7149 7134 else … … 7172 7157 Utf8Str log; 7173 7158 if (idx == 0) 7174 log = Utf8StrFmt("%s%cVBox.log", logFolder.c_str(), RTPATH_DELIMITER);7159 log.printf("%s%cVBox.log", logFolder.c_str(), RTPATH_DELIMITER); 7175 7160 #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_HARDENING) 7176 7161 else if (idx == 1) 7177 log = Utf8StrFmt("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER);7162 log.printf("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER); 7178 7163 else 7179 log = Utf8StrFmt("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx - 1);7164 log.printf("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx - 1); 7180 7165 #else 7181 7166 else 7182 log = Utf8StrFmt("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx);7167 log.printf("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx); 7183 7168 #endif 7184 7169 return log; … … 7242 7227 Utf8Str strNVRAMFilePath = mUserData->s.strSnapshotFolder; 7243 7228 strNVRAMFilePath += RTPATH_DELIMITER; 7244 strNVRAMFilePath += Utf8StrFmt("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.nvram",7245 7246 7229 strNVRAMFilePath.appendPrintf("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.nvram", 7230 time.i32Year, time.u8Month, time.u8MonthDay, 7231 time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond); 7247 7232 7248 7233 return strNVRAMFilePath; … … 7283 7268 7284 7269 strStateFilePath += RTPATH_DELIMITER; 7285 strStateFilePath += Utf8StrFmt("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.sav",7286 7287 7270 strStateFilePath.appendPrintf("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.sav", 7271 time.i32Year, time.u8Month, time.u8MonthDay, 7272 time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond); 7288 7273 } 7289 7274 … … 7749 7734 int vrc2 = RTFileQuerySizeByPath(strHardeningLogFile.c_str(), &cbStartupLogFile); 7750 7735 if (RT_SUCCESS(vrc2) && cbStartupLogFile > 0) 7751 strExtraInfo.append (Utf8StrFmt(tr(". More details may be available in '%s'"), strHardeningLogFile.c_str()));7736 strExtraInfo.appendPrintf(tr(". More details may be available in '%s'"), strHardeningLogFile.c_str()); 7752 7737 #endif 7753 7738 … … 9543 9528 9544 9529 /* first, rename the directory if it matches the group and machine name */ 9545 Utf8Str groupPlusName = Utf8StrFmt("%s%c%s", 9546 group.c_str(), RTPATH_DELIMITER, name.c_str()); 9530 Utf8StrFmt groupPlusName("%s%c%s", group.c_str(), RTPATH_DELIMITER, name.c_str()); 9547 9531 /** @todo hack, make somehow use of ComposeMachineFilename */ 9548 9532 if (mUserData->s.fDirectoryIncludesUUID) 9549 groupPlusName += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw()); 9550 Utf8Str newGroupPlusName = Utf8StrFmt("%s%c%s", 9551 newGroup.c_str(), RTPATH_DELIMITER, newName.c_str()); 9533 groupPlusName.appendPrintf(" (%RTuuid)", mData->mUuid.raw()); 9534 Utf8StrFmt newGroupPlusName("%s%c%s", newGroup.c_str(), RTPATH_DELIMITER, newName.c_str()); 9552 9535 /** @todo hack, make somehow use of ComposeMachineFilename */ 9553 9536 if (mUserData->s.fDirectoryIncludesUUID) 9554 newGroupPlusName += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw());9537 newGroupPlusName.appendPrintf(" (%RTuuid)", mData->mUuid.raw()); 9555 9538 configDir = configFile; 9556 9539 configDir.stripFilename(); … … 9604 9587 } 9605 9588 9606 newConfigFile = Utf8StrFmt("%s%c%s.vbox", 9607 newConfigDir.c_str(), RTPATH_DELIMITER, newName.c_str()); 9589 newConfigFile.printf("%s%c%s.vbox", newConfigDir.c_str(), RTPATH_DELIMITER, newName.c_str()); 9608 9590 9609 9591 /* then try to rename the settings file itself */ … … 9611 9593 { 9612 9594 /* get the path to old settings file in renamed directory */ 9613 configFile = Utf8StrFmt("%s%c%s",9614 9615 9616 9595 configFile.printf("%s%c%s", 9596 newConfigDir.c_str(), 9597 RTPATH_DELIMITER, 9598 RTPathFilename(configFile.c_str())); 9617 9599 if (!fSettingsFileIsNew) 9618 9600 { … … 10032 10014 && mSSData->strStateFilePath.isEmpty() 10033 10015 ) 10034 mHWData->mHWVersion = Utf8StrFmt("%d", SchemaDefs::DefaultHardwareVersion);10016 mHWData->mHWVersion.printf("%d", SchemaDefs::DefaultHardwareVersion); 10035 10017 10036 10018 data.strVersion = mHWData->mHWVersion; … … 11530 11512 /** @todo hack, make somehow use of ComposeMachineFilename */ 11531 11513 if (mUserData->s.fDirectoryIncludesUUID) 11532 strConfigFileOnly += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw());11514 strConfigFileOnly.appendPrintf(" (%RTuuid)", mData->mUuid.raw()); 11533 11515 11534 11516 AssertReturn(!strMachineDirName.isEmpty(), false);
Note:
See TracChangeset
for help on using the changeset viewer.