Index: trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 85255)
+++ trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 85256)
@@ -165,5 +165,5 @@
 {
     /* default values for a newly created machine */
-    mHWVersion = Utf8StrFmt("%d", SchemaDefs::DefaultHardwareVersion);
+    mHWVersion.printf("%d", SchemaDefs::DefaultHardwareVersion);
     mMemorySize = 128;
     mCPUCount = 1;
@@ -4346,11 +4346,8 @@
                                               LONG aDevice)
 {
-    int rc = S_OK;
     LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n",
                      aName.c_str(), aControllerPort, aDevice));
 
-    rc = setBandwidthGroupForDevice(aName, aControllerPort, aDevice, NULL);
-
-    return rc;
+    return setBandwidthGroupForDevice(aName, aControllerPort, aDevice, NULL);
 }
 
@@ -4417,12 +4414,8 @@
                                            DeviceType_T aType)
 {
-     HRESULT rc = S_OK;
-
      LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aType=%d\n",
                       aName.c_str(), aControllerPort, aDevice, aType));
 
-     rc = attachDevice(aName, aControllerPort, aDevice, aType, NULL);
-
-     return rc;
+     return attachDevice(aName, aControllerPort, aDevice, aType, NULL);
 }
 
@@ -4433,11 +4426,8 @@
                                BOOL aForce)
 {
-     int rc = S_OK;
      LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d",
                       aName.c_str(), aControllerPort, aForce));
 
-     rc = mountMedium(aName, aControllerPort, aDevice, NULL, aForce);
-
-     return rc;
+     return mountMedium(aName, aControllerPort, aDevice, NULL, aForce);
 }
 
@@ -4448,5 +4438,4 @@
                              BOOL aForce)
 {
-    int rc = S_OK;
     LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aForce=%d\n",
                      aName.c_str(), aControllerPort, aDevice, aForce));
@@ -4530,5 +4519,5 @@
     mediumLock.release();
     multiLock.release();
-    rc = i_onMediumChange(pAttach, aForce);
+    HRESULT rc = i_onMediumChange(pAttach, aForce);
     multiLock.acquire();
     mediumLock.acquire();
@@ -5115,7 +5104,7 @@
                See the fSafe parameter of xml::XmlFileWriter::write for details. */
             /** @todo Find a way to avoid referring directly to iprt/xml.h here. */
-            Utf8Str otherXml = Utf8StrFmt("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszTmpSuff);
+            Utf8StrFmt otherXml("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszTmpSuff);
             RTFileDelete(otherXml.c_str());
-            otherXml = Utf8StrFmt("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszPrevSuff);
+            otherXml.printf("%s%s", mData->m_strConfigFileFull.c_str(), xml::XmlFileWriter::s_pszPrevSuff);
             RTFileDelete(otherXml.c_str());
 
@@ -5132,23 +5121,19 @@
                  * Console::powerUpThread()). Also, delete the VBox.png[.N]
                  * files that may have been created by the GUI. */
-                Utf8Str log = Utf8StrFmt("%s%cVBox.log",
-                                         logFolder.c_str(), RTPATH_DELIMITER);
+                Utf8StrFmt log("%s%cVBox.log", logFolder.c_str(), RTPATH_DELIMITER);
                 RTFileDelete(log.c_str());
-                log = Utf8StrFmt("%s%cVBox.png",
-                                 logFolder.c_str(), RTPATH_DELIMITER);
+                log.printf("%s%cVBox.png", logFolder.c_str(), RTPATH_DELIMITER);
                 RTFileDelete(log.c_str());
-                for (int i = uLogHistoryCount; i > 0; i--)
+                for (ULONG i = uLogHistoryCount; i > 0; i--)
                 {
-                    log = Utf8StrFmt("%s%cVBox.log.%d",
-                                     logFolder.c_str(), RTPATH_DELIMITER, i);
+                    log.printf("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, i);
                     RTFileDelete(log.c_str());
-                    log = Utf8StrFmt("%s%cVBox.png.%d",
-                                     logFolder.c_str(), RTPATH_DELIMITER, i);
+                    log.printf("%s%cVBox.png.%u", logFolder.c_str(), RTPATH_DELIMITER, i);
                     RTFileDelete(log.c_str());
                 }
 #if defined(RT_OS_WINDOWS)
-                log = Utf8StrFmt("%s%cVBoxStartup.log", logFolder.c_str(), RTPATH_DELIMITER);
+                log.printf("%s%cVBoxStartup.log", logFolder.c_str(), RTPATH_DELIMITER);
                 RTFileDelete(log.c_str());
-                log = Utf8StrFmt("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER);
+                log.printf("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER);
                 RTFileDelete(log.c_str());
 #endif
@@ -7142,8 +7127,8 @@
             vrc = RTPathAbs(szTmp, szTmp2, sizeof(szTmp2));
             if (RT_SUCCESS(vrc))
-                aLogFolder = Utf8StrFmt("%s%c%s",
-                                        szTmp2,
-                                        RTPATH_DELIMITER,
-                                        mUserData->s.strName.c_str()); // path/to/logfolder/vmname
+                aLogFolder.printf("%s%c%s",
+                                  szTmp2,
+                                  RTPATH_DELIMITER,
+                                  mUserData->s.strName.c_str()); // path/to/logfolder/vmname
         }
         else
@@ -7172,13 +7157,13 @@
     Utf8Str log;
     if (idx == 0)
-        log = Utf8StrFmt("%s%cVBox.log", logFolder.c_str(), RTPATH_DELIMITER);
+        log.printf("%s%cVBox.log", logFolder.c_str(), RTPATH_DELIMITER);
 #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_HARDENING)
     else if (idx == 1)
-        log = Utf8StrFmt("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER);
+        log.printf("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER);
     else
-        log = Utf8StrFmt("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx - 1);
+        log.printf("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx - 1);
 #else
     else
-        log = Utf8StrFmt("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx);
+        log.printf("%s%cVBox.log.%u", logFolder.c_str(), RTPATH_DELIMITER, idx);
 #endif
     return log;
@@ -7242,7 +7227,7 @@
     Utf8Str strNVRAMFilePath = mUserData->s.strSnapshotFolder;
     strNVRAMFilePath += RTPATH_DELIMITER;
-    strNVRAMFilePath += Utf8StrFmt("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.nvram",
-                                   time.i32Year, time.u8Month, time.u8MonthDay,
-                                   time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond);
+    strNVRAMFilePath.appendPrintf("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.nvram",
+                                  time.i32Year, time.u8Month, time.u8MonthDay,
+                                  time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond);
 
     return strNVRAMFilePath;
@@ -7283,7 +7268,7 @@
 
     strStateFilePath += RTPATH_DELIMITER;
-    strStateFilePath += Utf8StrFmt("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.sav",
-                                   time.i32Year, time.u8Month, time.u8MonthDay,
-                                   time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond);
+    strStateFilePath.appendPrintf("%04d-%02u-%02uT%02u-%02u-%02u-%09uZ.sav",
+                                  time.i32Year, time.u8Month, time.u8MonthDay,
+                                  time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond);
 }
 
@@ -7749,5 +7734,5 @@
         int vrc2 = RTFileQuerySizeByPath(strHardeningLogFile.c_str(), &cbStartupLogFile);
         if (RT_SUCCESS(vrc2) && cbStartupLogFile > 0)
-            strExtraInfo.append(Utf8StrFmt(tr(".  More details may be available in '%s'"), strHardeningLogFile.c_str()));
+            strExtraInfo.appendPrintf(tr(".  More details may be available in '%s'"), strHardeningLogFile.c_str());
 #endif
 
@@ -9543,14 +9528,12 @@
 
             /* first, rename the directory if it matches the group and machine name */
-            Utf8Str groupPlusName = Utf8StrFmt("%s%c%s",
-                group.c_str(), RTPATH_DELIMITER, name.c_str());
+            Utf8StrFmt groupPlusName("%s%c%s", group.c_str(), RTPATH_DELIMITER, name.c_str());
             /** @todo hack, make somehow use of ComposeMachineFilename */
             if (mUserData->s.fDirectoryIncludesUUID)
-                groupPlusName += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw());
-            Utf8Str newGroupPlusName = Utf8StrFmt("%s%c%s",
-                newGroup.c_str(), RTPATH_DELIMITER, newName.c_str());
+                groupPlusName.appendPrintf(" (%RTuuid)", mData->mUuid.raw());
+            Utf8StrFmt newGroupPlusName("%s%c%s", newGroup.c_str(), RTPATH_DELIMITER, newName.c_str());
             /** @todo hack, make somehow use of ComposeMachineFilename */
             if (mUserData->s.fDirectoryIncludesUUID)
-                newGroupPlusName += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw());
+                newGroupPlusName.appendPrintf(" (%RTuuid)", mData->mUuid.raw());
             configDir = configFile;
             configDir.stripFilename();
@@ -9604,6 +9587,5 @@
             }
 
-            newConfigFile = Utf8StrFmt("%s%c%s.vbox",
-                newConfigDir.c_str(), RTPATH_DELIMITER, newName.c_str());
+            newConfigFile.printf("%s%c%s.vbox", newConfigDir.c_str(), RTPATH_DELIMITER, newName.c_str());
 
             /* then try to rename the settings file itself */
@@ -9611,8 +9593,8 @@
             {
                 /* get the path to old settings file in renamed directory */
-                configFile = Utf8StrFmt("%s%c%s",
-                                        newConfigDir.c_str(),
-                                        RTPATH_DELIMITER,
-                                        RTPathFilename(configFile.c_str()));
+                configFile.printf("%s%c%s",
+                                  newConfigDir.c_str(),
+                                  RTPATH_DELIMITER,
+                                  RTPathFilename(configFile.c_str()));
                 if (!fSettingsFileIsNew)
                 {
@@ -10032,5 +10014,5 @@
              && mSSData->strStateFilePath.isEmpty()
            )
-            mHWData->mHWVersion = Utf8StrFmt("%d", SchemaDefs::DefaultHardwareVersion);
+            mHWData->mHWVersion.printf("%d", SchemaDefs::DefaultHardwareVersion);
 
         data.strVersion = mHWData->mHWVersion;
@@ -11530,5 +11512,5 @@
     /** @todo hack, make somehow use of ComposeMachineFilename */
     if (mUserData->s.fDirectoryIncludesUUID)
-        strConfigFileOnly += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw());
+        strConfigFileOnly.appendPrintf(" (%RTuuid)", mData->mUuid.raw());
 
     AssertReturn(!strMachineDirName.isEmpty(), false);
