[cstdstring] demise Format, replacing with StringUtils::Format
authornight199uk <night199uk@xbmc.org>
Tue, 10 Sep 2013 11:37:34 +0000 (19:37 +0800)
committerJonathan Marshall <jmarshall@xbmc.org>
Wed, 13 Nov 2013 19:26:55 +0000 (08:26 +1300)
240 files changed:
xbmc/Application.cpp
xbmc/Autorun.cpp
xbmc/CueDocument.cpp
xbmc/FileItem.cpp
xbmc/GUIInfoManager.cpp
xbmc/GUIPassword.cpp
xbmc/PartyModeManager.cpp
xbmc/PlayListPlayer.cpp
xbmc/Temperature.cpp
xbmc/TextureCache.cpp
xbmc/TextureCacheJob.cpp
xbmc/URL.cpp
xbmc/Util.cpp
xbmc/XBDateTime.cpp
xbmc/addons/Addon.cpp
xbmc/addons/AddonCallbacksAddon.cpp
xbmc/addons/AddonCallbacksPVR.cpp
xbmc/addons/AddonDatabase.cpp
xbmc/addons/AddonInstaller.cpp
xbmc/addons/AddonStatusHandler.cpp
xbmc/addons/AddonVersion.cpp
xbmc/addons/GUIDialogAddonInfo.cpp
xbmc/addons/GUIDialogAddonSettings.cpp
xbmc/addons/GUIWindowAddonBrowser.cpp
xbmc/addons/Scraper.cpp
xbmc/cdrip/CDDARipJob.cpp
xbmc/cdrip/CDDARipper.cpp
xbmc/cores/AudioEngine/Engines/PulseAE/PulseAE.cpp
xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
xbmc/cores/DummyVideoPlayer.cpp
xbmc/cores/VideoRenderers/RenderManager.cpp
xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp
xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxBXA.cpp
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp
xbmc/cores/dvdplayer/DVDPlayer.cpp
xbmc/cores/omxplayer/OMXPlayer.cpp
xbmc/cores/omxplayer/PCMRemap.cpp
xbmc/dbwrappers/DatabaseQuery.cpp
xbmc/dialogs/GUIDialogContextMenu.cpp
xbmc/dialogs/GUIDialogGamepad.cpp
xbmc/dialogs/GUIDialogMediaFilter.cpp
xbmc/dialogs/GUIDialogMediaSource.cpp
xbmc/dialogs/GUIDialogNumeric.cpp
xbmc/dialogs/GUIDialogSelect.cpp
xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp
xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
xbmc/epg/EpgInfoTag.cpp
xbmc/epg/GUIEPGGridContainer.cpp
xbmc/filesystem/AddonsDirectory.cpp
xbmc/filesystem/AndroidAppDirectory.cpp
xbmc/filesystem/BlurayDirectory.cpp
xbmc/filesystem/CDDADirectory.cpp
xbmc/filesystem/CurlFile.cpp
xbmc/filesystem/DAAPDirectory.cpp
xbmc/filesystem/DAAPFile.cpp
xbmc/filesystem/FavouritesDirectory.cpp
xbmc/filesystem/FileDirectoryFactory.cpp
xbmc/filesystem/HDHomeRunDirectory.cpp
xbmc/filesystem/HTSPDirectory.cpp
xbmc/filesystem/HTSPSession.cpp
xbmc/filesystem/ISO9660Directory.cpp
xbmc/filesystem/MusicDatabaseDirectory.cpp
xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.cpp
xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.cpp
xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.cpp
xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp
xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp
xbmc/filesystem/MusicFileDirectory.cpp
xbmc/filesystem/MythDirectory.cpp
xbmc/filesystem/PipesManager.cpp
xbmc/filesystem/PluginDirectory.cpp
xbmc/filesystem/SAPDirectory.cpp
xbmc/filesystem/SMBDirectory.cpp
xbmc/filesystem/SlingboxFile.cpp
xbmc/filesystem/TuxBoxDirectory.cpp
xbmc/filesystem/VTPDirectory.cpp
xbmc/filesystem/VideoDatabaseDirectory.cpp
xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp
xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp
xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp
xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.cpp
xbmc/filesystem/iso9660.cpp
xbmc/filesystem/test/TestFileFactory.cpp
xbmc/filesystem/test/TestRarFile.cpp
xbmc/filesystem/test/TestZipFile.cpp
xbmc/guilib/GUIAction.cpp
xbmc/guilib/GUIBaseContainer.cpp
xbmc/guilib/GUIControlFactory.cpp
xbmc/guilib/GUIControlProfiler.cpp
xbmc/guilib/GUIFontManager.cpp
xbmc/guilib/GUIKeyboardFactory.cpp
xbmc/guilib/GUIListContainer.cpp
xbmc/guilib/GUIProgressControl.cpp
xbmc/guilib/GUIScrollBarControl.cpp
xbmc/guilib/GUISliderControl.cpp
xbmc/guilib/GUISpinControl.cpp
xbmc/guilib/GUISpinControlEx.cpp
xbmc/guilib/GUITextBox.cpp
xbmc/guilib/JpegIO.cpp
xbmc/guilib/TextureManager.cpp
xbmc/interfaces/Builtins.cpp
xbmc/interfaces/json-rpc/AddonsOperations.cpp
xbmc/interfaces/json-rpc/AudioLibrary.cpp
xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
xbmc/interfaces/json-rpc/VideoLibrary.cpp
xbmc/interfaces/legacy/Addon.cpp
xbmc/interfaces/legacy/Dialog.cpp
xbmc/interfaces/legacy/ListItem.cpp
xbmc/interfaces/legacy/ModuleXbmc.cpp
xbmc/interfaces/legacy/WindowXML.cpp
xbmc/interfaces/python/PythonInvoker.cpp
xbmc/interfaces/python/swig.cpp
xbmc/linux/HALManager.cpp
xbmc/linux/HALManager.h
xbmc/music/MusicDatabase.cpp
xbmc/music/dialogs/GUIDialogMusicInfo.cpp
xbmc/music/dialogs/GUIDialogSongInfo.cpp
xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp
xbmc/music/infoscanner/MusicAlbumInfo.cpp
xbmc/music/infoscanner/MusicInfoScanner.cpp
xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp
xbmc/music/karaoke/karaokelyricstext.cpp
xbmc/music/tags/MusicInfoTag.cpp
xbmc/music/windows/GUIWindowMusicNav.cpp
xbmc/music/windows/GUIWindowMusicPlaylist.cpp
xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp
xbmc/music/windows/GUIWindowMusicSongs.cpp
xbmc/network/AirPlayServer.cpp
xbmc/network/AirTunesServer.cpp
xbmc/network/DNSNameCache.cpp
xbmc/network/GUIDialogNetworkSetup.cpp
xbmc/network/WakeOnAccess.cpp
xbmc/network/WebServer.cpp
xbmc/network/cddb.cpp
xbmc/network/linux/NetworkLinux.cpp
xbmc/network/upnp/UPnPInternal.cpp
xbmc/network/upnp/UPnPRenderer.cpp
xbmc/network/upnp/UPnPServer.cpp
xbmc/network/windows/NetworkWin32.cpp
xbmc/peripherals/PeripheralTypes.h
xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp
xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp
xbmc/peripherals/devices/Peripheral.cpp
xbmc/peripherals/devices/PeripheralCecAdapter.cpp
xbmc/peripherals/devices/PeripheralHID.cpp
xbmc/pictures/PictureInfoTag.cpp
xbmc/playlists/PlayListM3U.cpp
xbmc/playlists/SmartPlayList.cpp
xbmc/profiles/dialogs/GUIDialogLockSettings.cpp
xbmc/pvr/PVRGUIInfo.cpp
xbmc/pvr/PVRManager.cpp
xbmc/pvr/addons/PVRClient.cpp
xbmc/pvr/channels/PVRChannel.cpp
xbmc/pvr/channels/PVRChannelGroup.cpp
xbmc/pvr/channels/PVRChannelGroups.cpp
xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp
xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp
xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp
xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp
xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
xbmc/pvr/recordings/PVRRecording.cpp
xbmc/pvr/recordings/PVRRecordings.cpp
xbmc/pvr/timers/PVRTimerInfoTag.cpp
xbmc/pvr/timers/PVRTimers.cpp
xbmc/pvr/windows/GUIWindowPVRChannels.cpp
xbmc/pvr/windows/GUIWindowPVRCommon.cpp
xbmc/pvr/windows/GUIWindowPVRGuide.cpp
xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
xbmc/rendering/dx/RenderSystemDX.cpp
xbmc/settings/AdvancedSettings.cpp
xbmc/settings/dialogs/GUIDialogSettings.cpp
xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
xbmc/storage/AutorunMediaJob.cpp
xbmc/storage/MediaManager.cpp
xbmc/storage/linux/DeviceKitDisksProvider.cpp
xbmc/storage/linux/UDisksProvider.cpp
xbmc/utils/AlarmClock.cpp
xbmc/utils/AsyncFileCopy.cpp
xbmc/utils/CPUInfo.cpp
xbmc/utils/DatabaseUtils.cpp
xbmc/utils/EdenVideoArtUpdater.cpp
xbmc/utils/FileOperationJob.cpp
xbmc/utils/HTMLUtil.cpp
xbmc/utils/LabelFormatter.cpp
xbmc/utils/LangCodeExpander.cpp
xbmc/utils/RecentlyAddedJob.cpp
xbmc/utils/RegExp.cpp
xbmc/utils/ScraperParser.cpp
xbmc/utils/SortUtils.cpp
xbmc/utils/StdString.h
xbmc/utils/StringUtils.cpp
xbmc/utils/SystemInfo.cpp
xbmc/utils/TuxBoxUtil.cpp
xbmc/utils/URIUtils.cpp
xbmc/utils/Weather.cpp
xbmc/utils/XMLUtils.cpp
xbmc/utils/log.cpp
xbmc/utils/md5.cpp
xbmc/utils/test/TestDatabaseUtils.cpp
xbmc/utils/test/TestXMLUtils.cpp
xbmc/utils/test/Testfft.cpp
xbmc/utils/test/Testfstrcmp.cpp
xbmc/video/PlayerController.cpp
xbmc/video/VideoDatabase.cpp
xbmc/video/VideoInfoScanner.cpp
xbmc/video/VideoInfoTag.cpp
xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
xbmc/video/dialogs/GUIDialogFileStacking.cpp
xbmc/video/dialogs/GUIDialogSubtitles.cpp
xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp
xbmc/video/dialogs/GUIDialogVideoInfo.cpp
xbmc/video/dialogs/GUIDialogVideoSettings.cpp
xbmc/video/windows/GUIWindowFullScreen.cpp
xbmc/video/windows/GUIWindowVideoBase.cpp
xbmc/video/windows/GUIWindowVideoNav.cpp
xbmc/view/GUIViewControl.cpp
xbmc/win32/WIN32Util.cpp
xbmc/win32/Win32DelayedDllLoad.cpp
xbmc/windowing/WinSystem.cpp
xbmc/windowing/X11/WinSystemX11.cpp
xbmc/windowing/X11/WinSystemX11GLES.cpp
xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
xbmc/windowing/egl/EGLNativeTypeAndroid.cpp
xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp
xbmc/windowing/egl/wayland/XBMCConnection.cpp
xbmc/windowing/osx/WinSystemIOS.mm
xbmc/windowing/osx/WinSystemOSX.mm
xbmc/windowing/windows/WinEventsWin32.cpp
xbmc/windows/GUIMediaWindow.cpp
xbmc/windows/GUIWindowDebugInfo.cpp
xbmc/windows/GUIWindowFileManager.cpp
xbmc/windows/GUIWindowLoginScreen.cpp
xbmc/windows/GUIWindowSystemInfo.cpp
xbmc/windows/GUIWindowWeather.cpp

index ebcea40..f1c83ef 100644 (file)
@@ -765,8 +765,7 @@ bool CApplication::Create()
   CStdString strLanguage = CSettings::Get().GetString("locale.language");
   strLanguage[0] = toupper(strLanguage[0]);
 
-  CStdString strLangInfoPath;
-  strLangInfoPath.Format("special://xbmc/language/%s/langinfo.xml", strLanguage.c_str());
+  CStdString strLangInfoPath = StringUtils::Format("special://xbmc/language/%s/langinfo.xml", strLanguage.c_str());
 
   CLog::Log(LOGINFO, "load language info file: %s", strLangInfoPath.c_str());
   g_langInfo.Load(strLangInfoPath);
@@ -5757,8 +5756,7 @@ bool CApplication::SetLanguage(const CStdString &strLanguage)
   CStdString strNewLanguage = strLanguage;
   if (strNewLanguage != strPreviousLanguage)
   {
-    CStdString strLangInfoPath;
-    strLangInfoPath.Format("special://xbmc/language/%s/langinfo.xml", strNewLanguage.c_str());
+    CStdString strLangInfoPath = StringUtils::Format("special://xbmc/language/%s/langinfo.xml", strNewLanguage.c_str());
     if (!g_langInfo.Load(strLangInfoPath))
       return false;
 
index 1e3f358..22d7930 100644 (file)
@@ -338,8 +338,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
               && (bypassSettings))
         {
           bPlaying = true;
-          CStdString strExec;
-          strExec.Format("XBMC.RecursiveSlideShow(%s)", pItem->GetPath().c_str());
+          CStdString strExec = StringUtils::Format("XBMC.RecursiveSlideShow(%s)", pItem->GetPath().c_str());
           CBuiltins::Execute(strExec);
           return true;
         }
@@ -416,8 +415,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
       if (!pItem->m_bIsFolder && pItem->IsPicture())
       {
         bPlaying = true;
-        CStdString strExec;
-        strExec.Format("XBMC.RecursiveSlideShow(%s)", strDrive.c_str());
+        CStdString strExec = StringUtils::Format("XBMC.RecursiveSlideShow(%s)", strDrive.c_str());
         CBuiltins::Execute(strExec);
         break;
       }
index e79cb02..19ff055 100644 (file)
@@ -246,7 +246,7 @@ void CCueDocument::GetSongs(VECSONGS &songs)
     if ( m_iDiscNumber > 0 )  
       song.iTrack |= (m_iDiscNumber << 16); // see CMusicInfoTag::GetDiscNumber()
     if (m_Track[i].strTitle.length() == 0) // No track information for this track!
-      song.strTitle.Format("Track %2d", i + 1);
+      song.strTitle = StringUtils::Format("Track %2d", i + 1);
     else
       song.strTitle = m_Track[i].strTitle;
     song.strFileName =  m_Track[i].strFile;
index 352c754..c1417d8 100644 (file)
@@ -378,7 +378,7 @@ CFileItem::CFileItem(const CMediaSource& share)
     URIUtils::AddSlashAtEnd(m_strPath);
   CStdString label = share.strName;
   if (!share.strStatus.IsEmpty())
-    label.Format("%s (%s)", share.strName.c_str(), share.strStatus.c_str());
+    label = StringUtils::Format("%s (%s)", share.strName.c_str(), share.strStatus.c_str());
   SetLabel(label);
   m_iLockMode = share.m_iLockMode;
   m_strLockCode = share.m_strLockCode;
@@ -2640,17 +2640,17 @@ CStdString CFileItemList::GetDiscFileCache(int windowID) const
 
   CStdString cacheFile;
   if (IsCDDA() || IsOnDVD())
-    cacheFile.Format("special://temp/r-%08x.fi", (unsigned __int32)crc);
+    cacheFile = StringUtils::Format("special://temp/r-%08x.fi", (unsigned __int32)crc);
   else if (IsMusicDb())
-    cacheFile.Format("special://temp/mdb-%08x.fi", (unsigned __int32)crc);
+    cacheFile = StringUtils::Format("special://temp/mdb-%08x.fi", (unsigned __int32)crc);
   else if (IsVideoDb())
-    cacheFile.Format("special://temp/vdb-%08x.fi", (unsigned __int32)crc);
+    cacheFile = StringUtils::Format("special://temp/vdb-%08x.fi", (unsigned __int32)crc);
   else if (IsSmartPlayList())
-    cacheFile.Format("special://temp/sp-%08x.fi", (unsigned __int32)crc);
+    cacheFile = StringUtils::Format("special://temp/sp-%08x.fi", (unsigned __int32)crc);
   else if (windowID)
-    cacheFile.Format("special://temp/%i-%08x.fi", windowID, (unsigned __int32)crc);
+    cacheFile = StringUtils::Format("special://temp/%i-%08x.fi", windowID, (unsigned __int32)crc);
   else
-    cacheFile.Format("special://temp/%08x.fi", (unsigned __int32)crc);
+    cacheFile = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32)crc);
   return cacheFile;
 }
 
@@ -3053,8 +3053,7 @@ bool CFileItem::LoadMusicTag()
       CStdString strText = g_localizeStrings.Get(554); // "Track"
       if (strText.GetAt(strText.size() - 1) != ' ')
         strText += " ";
-      CStdString strTrack;
-      strTrack.Format(strText + "%i", iTrack);
+      CStdString strTrack = StringUtils::Format(strText + "%i", iTrack);
       GetMusicInfoTag()->SetTitle(strTrack);
       GetMusicInfoTag()->SetLoaded(true);
       return true;
index d69c231..2a3fccf 100644 (file)
@@ -1388,7 +1388,9 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     strLabel = strLabel.Trim();
     break;
   case WEATHER_TEMPERATURE:
-    strLabel.Format("%s%s", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTempUnitString().c_str());
+    strLabel = StringUtils::Format("%s%s",
+                                   g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP).c_str(),
+                                   g_langInfo.GetTempUnitString().c_str());
     break;
   case WEATHER_LOCATION:
     strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_LOCATION);
@@ -1404,24 +1406,24 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     strLabel = GetDate();
     break;
   case SYSTEM_FPS:
-    strLabel.Format("%02.2f", m_fps);
+    strLabel = StringUtils::Format("%02.2f", m_fps);
     break;
   case PLAYER_VOLUME:
-    strLabel.Format("%2.1f dB", CAEUtil::PercentToGain(g_application.GetVolume(false)));
+    strLabel = StringUtils::Format("%2.1f dB", CAEUtil::PercentToGain(g_application.GetVolume(false)));
     break;
   case PLAYER_SUBTITLE_DELAY:
-    strLabel.Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay);
+    strLabel = StringUtils::Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay);
     break;
   case PLAYER_AUDIO_DELAY:
-    strLabel.Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay);
+    strLabel = StringUtils::Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay);
     break;
   case PLAYER_CHAPTER:
     if(g_application.m_pPlayer->IsPlaying())
-      strLabel.Format("%02d", g_application.m_pPlayer->GetChapter());
+      strLabel = StringUtils::Format("%02d", g_application.m_pPlayer->GetChapter());
     break;
   case PLAYER_CHAPTERCOUNT:
     if(g_application.m_pPlayer->IsPlaying())
-      strLabel.Format("%02d", g_application.m_pPlayer->GetChapterCount());
+      strLabel = StringUtils::Format("%02d", g_application.m_pPlayer->GetChapterCount());
     break;
   case PLAYER_CHAPTERNAME:
     if(g_application.m_pPlayer->IsPlaying())
@@ -1431,7 +1433,7 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     {
       int iLevel = 0;
       if(g_application.m_pPlayer->IsPlaying() && GetInt(iLevel, PLAYER_CACHELEVEL) && iLevel >= 0)
-        strLabel.Format("%i", iLevel);
+        strLabel = StringUtils::Format("%i", iLevel);
     }
     break;
   case PLAYER_TIME:
@@ -1595,7 +1597,7 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     if(g_application.m_pPlayer->IsPlaying())
     {
       UpdateAVInfo();
-      strLabel.Format("%i", m_audioInfo.channels);
+      strLabel = StringUtils::Format("%i", m_audioInfo.channels);
     }
     break;
   case VIDEOPLAYER_AUDIO_LANG:
@@ -1670,16 +1672,18 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
 
   case SYSTEM_SCREEN_RESOLUTION:
     if(g_Windowing.IsFullScreen())
-      strLabel.Format("%ix%i@%.2fHz - %s (%02.2f fps)",
+      strLabel = StringUtils::Format("%ix%i@%.2fHz - %s (%02.2f fps)",
         CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenWidth,
         CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenHeight,
         CDisplaySettings::Get().GetCurrentResolutionInfo().fRefreshRate,
-        g_localizeStrings.Get(244), GetFPS());
+        g_localizeStrings.Get(244).c_str(),
+        GetFPS());
     else
-      strLabel.Format("%ix%i - %s (%02.2f fps)",
+      strLabel = StringUtils::Format("%ix%i - %s (%02.2f fps)",
         CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenWidth,
         CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenHeight,
-        g_localizeStrings.Get(242), GetFPS());
+        g_localizeStrings.Get(242).c_str(),
+        GetFPS());
     return strLabel;
     break;
 
@@ -1783,31 +1787,31 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
       int iMemPercentUsed = 100 - iMemPercentFree;
 
       if (info == SYSTEM_FREE_MEMORY)
-        strLabel.Format("%luMB", (ULONG)(stat.ullAvailPhys/MB));
+        strLabel = StringUtils::Format("%luMB", (ULONG)(stat.ullAvailPhys/MB));
       else if (info == SYSTEM_FREE_MEMORY_PERCENT)
-        strLabel.Format("%i%%", iMemPercentFree);
+        strLabel = StringUtils::Format("%i%%", iMemPercentFree);
       else if (info == SYSTEM_USED_MEMORY)
-        strLabel.Format("%luMB", (ULONG)((stat.ullTotalPhys - stat.ullAvailPhys)/MB));
+        strLabel = StringUtils::Format("%luMB", (ULONG)((stat.ullTotalPhys - stat.ullAvailPhys)/MB));
       else if (info == SYSTEM_USED_MEMORY_PERCENT)
-        strLabel.Format("%i%%", iMemPercentUsed);
+        strLabel = StringUtils::Format("%i%%", iMemPercentUsed);
       else if (info == SYSTEM_TOTAL_MEMORY)
-        strLabel.Format("%luMB", (ULONG)(stat.ullTotalPhys/MB));
+        strLabel = StringUtils::Format("%luMB", (ULONG)(stat.ullTotalPhys/MB));
     }
     break;
   case SYSTEM_SCREEN_MODE:
     strLabel = g_graphicsContext.GetResInfo().strMode;
     break;
   case SYSTEM_SCREEN_WIDTH:
-    strLabel.Format("%i", g_graphicsContext.GetResInfo().iScreenWidth);
+    strLabel = StringUtils::Format("%i", g_graphicsContext.GetResInfo().iScreenWidth);
     break;
   case SYSTEM_SCREEN_HEIGHT:
-    strLabel.Format("%i", g_graphicsContext.GetResInfo().iScreenHeight);
+    strLabel = StringUtils::Format("%i", g_graphicsContext.GetResInfo().iScreenHeight);
     break;
   case SYSTEM_CURRENT_WINDOW:
     return g_localizeStrings.Get(g_windowManager.GetFocusedWindow());
     break;
   case SYSTEM_STARTUP_WINDOW:
-    strLabel.Format("%i", CSettings::Get().GetInt("lookandfeel.startupwindow"));
+    strLabel = StringUtils::Format("%i", CSettings::Get().GetInt("lookandfeel.startupwindow"));
     break;
   case SYSTEM_CURRENT_CONTROL:
     {
@@ -1832,16 +1836,16 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     {
       double fTime = g_alarmClock.GetRemaining("shutdowntimer");
       if (fTime > 60.f)
-        strLabel.Format(g_localizeStrings.Get(13213).c_str(),g_alarmClock.GetRemaining("shutdowntimer")/60.f);
+        strLabel = StringUtils::Format(g_localizeStrings.Get(13213).c_str(), g_alarmClock.GetRemaining("shutdowntimer")/60.f);
       else
-        strLabel.Format(g_localizeStrings.Get(13214).c_str(),g_alarmClock.GetRemaining("shutdowntimer"));
+        strLabel = StringUtils::Format(g_localizeStrings.Get(13214).c_str(), g_alarmClock.GetRemaining("shutdowntimer"));
     }
     break;
   case SYSTEM_PROFILENAME:
     strLabel = CProfilesManager::Get().GetCurrentProfile().getName();
     break;
   case SYSTEM_PROFILECOUNT:
-    strLabel.Format("%i", CProfilesManager::Get().GetNumberOfProfiles());
+    strLabel = StringUtils::Format("%i", CProfilesManager::Get().GetNumberOfProfiles());
     break;
   case SYSTEM_PROFILEAUTOLOGIN:
     {
@@ -1860,14 +1864,14 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     {
       int percent;
       if (GetInt(percent, SYSTEM_PROGRESS_BAR) && percent > 0)
-        strLabel.Format("%i", percent);
+        strLabel = StringUtils::Format("%i", percent);
     }
     break;
   case SYSTEM_FRIENDLY_NAME:
     {
       CStdString friendlyName = CSettings::Get().GetString("services.devicename");
       if (friendlyName.Equals("XBMC"))
-        strLabel.Format("%s (%s)", friendlyName.c_str(), g_application.getNetwork().GetHostName().c_str());
+        strLabel = StringUtils::Format("%s (%s)", friendlyName.c_str(), g_application.getNetwork().GetHostName().c_str());
       else
         strLabel = friendlyName;
     }
@@ -1875,7 +1879,7 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
   case SYSTEM_STEREOSCOPIC_MODE:
     {
       int stereoMode = CSettings::Get().GetInt("videoscreen.stereoscopicmode");
-      strLabel.Format("%i", stereoMode);
+      strLabel = StringUtils::Format("%i", stereoMode);
     }
     break;
 
@@ -3157,7 +3161,7 @@ CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWi
   {
     CStdString strTime;
     if (g_application.m_pPlayer->GetPlaySpeed() != 1)
-      strTime.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.m_pPlayer->GetPlaySpeed());
+      strTime = StringUtils::Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.m_pPlayer->GetPlaySpeed());
     else
       strTime = GetCurrentPlayTime();
     return strTime;
@@ -3217,8 +3221,7 @@ CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWi
   }
   else if (info.m_info == SYSTEM_GET_CORE_USAGE)
   {
-    CStdString strCpu;
-    strCpu.Format("%4.2f", g_cpuInfo.GetCoreInfo(atoi(m_stringParameters[info.GetData1()].c_str())).m_fPct);
+    CStdString strCpu = StringUtils::Format("%4.2f", g_cpuInfo.GetCoreInfo(atoi(m_stringParameters[info.GetData1()].c_str())).m_fPct);
     return strCpu;
   }
   else if (info.m_info >= MUSICPLAYER_TITLE && info.m_info <= MUSICPLAYER_ALBUM_ARTIST)
@@ -3479,8 +3482,7 @@ CStdString CGUIInfoManager::GetMusicPartyModeLabel(int item)
     }
     if (iSongs < 0)
       return "";
-    CStdString strLabel;
-    strLabel.Format("%i", iSongs);
+    CStdString strLabel = StringUtils::Format("%i", iSongs);
     return strLabel;
   }
   return "";
@@ -3517,8 +3519,7 @@ const CStdString CGUIInfoManager::GetMusicPlaylistInfo(const GUIInfo& info)
   }
   if (info.m_info == MUSICPLAYER_PLAYLISTPOS)
   {
-    CStdString strPosition = "";
-    strPosition.Format("%i", index + 1);
+    CStdString strPosition = StringUtils::Format("%i", index + 1);
     return strPosition;
   }
   else if (info.m_info == MUSICPLAYER_COVER)
@@ -3536,15 +3537,11 @@ CStdString CGUIInfoManager::GetPlaylistLabel(int item, int playlistid /* = PLAYL
   {
   case PLAYLIST_LENGTH:
     {
-      CStdString strLength = "";
-      strLength.Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());
-      return strLength;
+      return StringUtils::Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());;
     }
   case PLAYLIST_POSITION:
     {
-      CStdString strPosition = "";
-      strPosition.Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
-      return strPosition;
+      return StringUtils::Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
     }
   case PLAYLIST_RANDOM:
     {
@@ -3590,7 +3587,7 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
     {
       CStdString strBitrate = "";
       if (m_audioInfo.bitrate > 0)
-        strBitrate.Format("%i", MathUtils::round_int((double)m_audioInfo.bitrate / 1000.0));
+        strBitrate = StringUtils::Format("%i", MathUtils::round_int((double)m_audioInfo.bitrate / 1000.0));
       return strBitrate;
     }
     break;
@@ -3599,7 +3596,7 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
       CStdString strChannels = "";
       if (m_audioInfo.channels > 0)
       {
-        strChannels.Format("%i", m_audioInfo.channels);
+        strChannels = StringUtils::Format("%i", m_audioInfo.channels);
       }
       return strChannels;
     }
@@ -3609,7 +3606,7 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
       CStdString strBitsPerSample = "";
       if (g_application.m_pPlayer->GetBitsPerSample() > 0)
       {
-        strBitsPerSample.Format("%i", g_application.m_pPlayer->GetBitsPerSample());
+        strBitsPerSample = StringUtils::Format("%i", g_application.m_pPlayer->GetBitsPerSample());
       }
       return strBitsPerSample;
     }
@@ -3619,16 +3616,14 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
       CStdString strSampleRate = "";
       if (g_application.m_pPlayer->GetSampleRate() > 0)
       {
-        strSampleRate.Format("%.5g", ((double)g_application.m_pPlayer->GetSampleRate() / 1000.0));
+        strSampleRate = StringUtils::Format("%.5g", ((double)g_application.m_pPlayer->GetSampleRate() / 1000.0));
       }
       return strSampleRate;
     }
     break;
   case MUSICPLAYER_CODEC:
     {
-      CStdString strCodec;
-      strCodec.Format("%s", m_audioInfo.audioCodecName);
-      return strCodec;
+      return StringUtils::Format("%s", m_audioInfo.audioCodecName.c_str());
     }
     break;
   case MUSICPLAYER_LYRICS:
@@ -3669,8 +3664,7 @@ CStdString CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item)
       CStdString strTrack;
       if (tag.Loaded() && tag.GetTrackNumber() > 0)
       {
-        strTrack.Format("%02i", tag.GetTrackNumber());
-        return strTrack;
+        return StringUtils::Format("%02i", tag.GetTrackNumber());
       }
     }
     break;
@@ -3694,9 +3688,7 @@ CStdString CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item)
       CPVRChannel* channeltag = m_currentFile->GetPVRChannelInfoTag();
       if (channeltag)
       {
-        CStdString strNumber;
-        strNumber.Format("%i", channeltag->ChannelNumber());
-        return strNumber;
+        return StringUtils::Format("%i", channeltag->ChannelNumber());
       }
     }
     break;
@@ -3789,7 +3781,7 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
       {
         CStdString rating;
         if (tag->GetEPGNow(epgTag) && epgTag.ParentalRating() > 0)
-          rating.Format("%i", epgTag.ParentalRating());
+          rating = StringUtils::Format("%i", epgTag.ParentalRating());
         return rating;
       }
       break;
@@ -3799,9 +3791,7 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
       return tag->ChannelName();
     case VIDEOPLAYER_CHANNEL_NUMBER:
       {
-        CStdString strNumber;
-        strNumber.Format("%i", tag->ChannelNumber());
-        return strNumber;
+        return StringUtils::Format("%i", tag->ChannelNumber());;
       }
     case VIDEOPLAYER_CHANNEL_GROUP:
       {
@@ -3827,7 +3817,7 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
       {
         CStdString strRating;
         if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
-          strRating.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
+          strRating = StringUtils::Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
         return strRating;
       }
       break;
@@ -3837,9 +3827,13 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
         if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
         {
           if (m_currentFile->GetVideoInfoTag()->m_strVotes.IsEmpty())
-            strRatingAndVotes.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
+            strRatingAndVotes = StringUtils::Format("%.1f",
+                                                    m_currentFile->GetVideoInfoTag()->m_fRating);
           else
-            strRatingAndVotes.Format("%.1f (%s %s)", m_currentFile->GetVideoInfoTag()->m_fRating, m_currentFile->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
+            strRatingAndVotes = StringUtils::Format("%.1f (%s %s)",
+                                                    m_currentFile->GetVideoInfoTag()->m_fRating,
+                                                    m_currentFile->GetVideoInfoTag()->m_strVotes.c_str(),
+                                                    g_localizeStrings.Get(20350).c_str());
         }
         return strRatingAndVotes;
       }
@@ -3850,7 +3844,7 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
       {
         CStdString strYear;
         if (m_currentFile->GetVideoInfoTag()->m_iYear > 0)
-          strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iYear);
+          strYear = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iYear);
         return strYear;
       }
       break;
@@ -3878,18 +3872,16 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
       {
         CStdString strEpisode;
         if (m_currentFile->GetVideoInfoTag()->m_iSeason == 0) // prefix episode with 'S'
-          strEpisode.Format("S%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
+          strEpisode = StringUtils::Format("S%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
         else 
-          strEpisode.Format("%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
+          strEpisode = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
         return strEpisode;
       }
       break;
     case VIDEOPLAYER_SEASON:
       if (m_currentFile->GetVideoInfoTag()->m_iSeason > 0)
       {
-        CStdString strSeason;
-        strSeason.Format("%i", m_currentFile->GetVideoInfoTag()->m_iSeason);
-        return strSeason;
+        return StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iSeason);
       }
       break;
     case VIDEOPLAYER_TVSHOW:
@@ -3905,7 +3897,7 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
       {
         CStdString strTop250;
         if (m_currentFile->GetVideoInfoTag()->m_iTop250 > 0)
-          strTop250.Format("%i", m_currentFile->GetVideoInfoTag()->m_iTop250);
+          strTop250 = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iTop250);
         return strTop250;
       }
       break;
@@ -3931,7 +3923,7 @@ CStdString CGUIInfoManager::GetVideoLabel(int item)
       {
         CStdString strPlayCount;
         if (m_currentFile->GetVideoInfoTag()->m_playCount > 0)
-          strPlayCount.Format("%i", m_currentFile->GetVideoInfoTag()->m_playCount);
+          strPlayCount = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_playCount);
         return strPlayCount;
       }
     }
@@ -4140,15 +4132,15 @@ string CGUIInfoManager::GetSystemHeatInfo(int info)
       return m_gpuTemp.IsValid() ? m_gpuTemp.ToString() : "?";
       break;
     case SYSTEM_FAN_SPEED:
-      text.Format("%i%%", m_fanSpeed * 2);
+      text = StringUtils::Format("%i%%", m_fanSpeed * 2);
       break;
     case SYSTEM_CPU_USAGE:
 #if defined(TARGET_DARWIN_OSX)
-      text.Format("%4.2f%%", m_resourceCounter.GetCPUUsage());
+      text = StringUtils::Format("%4.2f%%", m_resourceCounter.GetCPUUsage());
 #elif defined(TARGET_DARWIN) || defined(TARGET_WINDOWS)
-      text.Format("%d%%", g_cpuInfo.getUsedPercentage());
+      text = StringUtils::Format("%d%%", g_cpuInfo.getUsedPercentage());
 #else
-      text.Format("%s", g_cpuInfo.GetCoresUsageString());
+      text = StringUtils::Format("%s", g_cpuInfo.GetCoresUsageString().c_str());
 #endif
       break;
   }
@@ -4191,17 +4183,15 @@ CStdString CGUIInfoManager::GetVersion()
 {
   CStdString tmp;
   if (GetXbmcGitRevision())
-    tmp.Format("%d.%d%s Git:%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG, GetXbmcGitRevision());
+    tmp = StringUtils::Format("%d.%d%s Git:%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG, GetXbmcGitRevision());
   else
-    tmp.Format("%d.%d%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG);
+    tmp = StringUtils::Format("%d.%d%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG);
   return tmp;
 }
 
 CStdString CGUIInfoManager::GetBuild()
 {
-  CStdString tmp;
-  tmp.Format("%s", __DATE__);
-  return tmp;
+  return StringUtils::Format("%s", __DATE__);
 }
 
 void CGUIInfoManager::SetDisplayAfterSeek(unsigned int timeOut, int seekOffset)
@@ -4420,9 +4410,9 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString strPlayCount;
       if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_playCount > 0)
-        strPlayCount.Format("%i", item->GetVideoInfoTag()->m_playCount);
+        strPlayCount = StringUtils::Format("%i", item->GetVideoInfoTag()->m_playCount);
       if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetPlayCount() > 0)
-        strPlayCount.Format("%i", item->GetMusicInfoTag()->GetPlayCount());
+        strPlayCount = StringUtils::Format("%i", item->GetMusicInfoTag()->GetPlayCount());
       return strPlayCount;
     }
   case LISTITEM_LASTPLAYED:
@@ -4441,7 +4431,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString track;
       if (item->HasMusicInfoTag())
-        track.Format("%i", item->GetMusicInfoTag()->GetTrackNumber());
+        track = StringUtils::Format("%i", item->GetMusicInfoTag()->GetTrackNumber());
 
       return track;
     }
@@ -4449,7 +4439,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString disc;
       if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDiscNumber() > 0)
-        disc.Format("%i", item->GetMusicInfoTag()->GetDiscNumber());
+        disc = StringUtils::Format("%i", item->GetMusicInfoTag()->GetDiscNumber());
       return disc;
     }
   case LISTITEM_ARTIST:
@@ -4477,7 +4467,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString strResult;
       if (item->GetVideoInfoTag()->m_iYear > 0)
-        strResult.Format("%i",item->GetVideoInfoTag()->m_iYear);
+        strResult = StringUtils::Format("%i",item->GetVideoInfoTag()->m_iYear);
       return strResult;
     }
     if (item->HasMusicInfoTag())
@@ -4554,7 +4544,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString rating;
       if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
-        rating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+        rating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->m_fRating);
       else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetRating() > '0')
       { // song rating.  Images will probably be better than numbers for this in the long run
         rating = item->GetMusicInfoTag()->GetRating();
@@ -4567,9 +4557,13 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
       {
         CStdString strRatingAndVotes;
         if (item->GetVideoInfoTag()->m_strVotes.IsEmpty())
-          strRatingAndVotes.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+          strRatingAndVotes = StringUtils::Format("%.1f",
+                                                  item->GetVideoInfoTag()->m_fRating);
         else
-          strRatingAndVotes.Format("%.1f (%s %s)", item->GetVideoInfoTag()->m_fRating, item->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
+          strRatingAndVotes = StringUtils::Format("%.1f (%s %s)",
+                                                  item->GetVideoInfoTag()->m_fRating,
+                                                  item->GetVideoInfoTag()->m_strVotes.c_str(),
+                                                  g_localizeStrings.Get(20350).c_str());
         return strRatingAndVotes;
       }
     }
@@ -4580,9 +4574,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     break;
   case LISTITEM_PROGRAM_COUNT:
     {
-      CStdString count;
-      count.Format("%i", item->m_iprogramCount);
-      return count;
+      return StringUtils::Format("%i", item->m_iprogramCount);;
     }
   case LISTITEM_DURATION:
     {
@@ -4608,7 +4600,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
       else if (item->HasVideoInfoTag())
       {
         if (item->GetVideoInfoTag()->GetDuration() > 0)
-          duration.Format("%d", item->GetVideoInfoTag()->GetDuration() / 60);
+          duration = StringUtils::Format("%d", item->GetVideoInfoTag()->GetDuration() / 60);
       }
       else if (item->HasMusicInfoTag())
       {
@@ -4660,18 +4652,16 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString strResult;
       if (item->GetVideoInfoTag()->m_iSeason == 0) // prefix episode with 'S'
-        strResult.Format("S%d",item->GetVideoInfoTag()->m_iEpisode);
+        strResult = StringUtils::Format("S%d",item->GetVideoInfoTag()->m_iEpisode);
       else
-        strResult.Format("%d",item->GetVideoInfoTag()->m_iEpisode);
+        strResult = StringUtils::Format("%d",item->GetVideoInfoTag()->m_iEpisode);
       return strResult;
     }
     break;
   case LISTITEM_SEASON:
     if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iSeason > 0)
     {
-      CStdString strResult;
-      strResult.Format("%d",item->GetVideoInfoTag()->m_iSeason);
-      return strResult;
+      return StringUtils::Format("%d",item->GetVideoInfoTag()->m_iSeason);;
     }
     break;
   case LISTITEM_TVSHOW:
@@ -4779,7 +4769,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString strResult;
       if (item->GetVideoInfoTag()->m_iTop250 > 0)
-        strResult.Format("%i",item->GetVideoInfoTag()->m_iTop250);
+        strResult = StringUtils::Format("%i",item->GetVideoInfoTag()->m_iTop250);
       return strResult;
     }
     break;
@@ -4814,7 +4804,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
       CStdString strResult;
       int iChannels = item->GetVideoInfoTag()->m_streamDetails.GetAudioChannels();
       if (iChannels > -1)
-        strResult.Format("%i", iChannels);
+        strResult = StringUtils::Format("%i", iChannels);
       return strResult;
     }
     break;
@@ -4894,11 +4884,11 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString number;
       if (item->HasPVRChannelInfoTag())
-        number.Format("%i", item->GetPVRChannelInfoTag()->ChannelNumber());
+        number = StringUtils::Format("%i", item->GetPVRChannelInfoTag()->ChannelNumber());
       if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasPVRChannel())
-        number.Format("%i", item->GetEPGInfoTag()->PVRChannelNumber());
+        number = StringUtils::Format("%i", item->GetEPGInfoTag()->PVRChannelNumber());
       if (item->HasPVRTimerInfoTag())
-        number.Format("%i", item->GetPVRTimerInfoTag()->ChannelNumber());
+        number = StringUtils::Format("%i", item->GetPVRTimerInfoTag()->ChannelNumber());
 
       return number;
     }
@@ -4989,7 +4979,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
     {
       CStdString rating;
       if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->ParentalRating() > 0)
-        rating.Format("%i", item->GetEPGInfoTag()->ParentalRating());
+        rating = StringUtils::Format("%i", item->GetEPGInfoTag()->ParentalRating());
       return rating;
     }
     break;
@@ -4998,9 +4988,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
       int val;
       if (GetItemInt(val, item, info))
       {
-        CStdString str;
-        str.Format("%d", val);
-        return str;
+        return StringUtils::Format("%d", val);;
       }
       break;
     }
@@ -5015,15 +5003,11 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
   case LISTITEM_DBID:
     if (item->HasVideoInfoTag())
       {
-        CStdString dbid;
-        dbid.Format("%i", item->GetVideoInfoTag()->m_iDbId);
-        return dbid;
+        return StringUtils::Format("%i", item->GetVideoInfoTag()->m_iDbId);;
       }
     if (item->HasMusicInfoTag())
       {
-        CStdString dbid;
-        dbid.Format("%i", item->GetMusicInfoTag()->GetDatabaseId());
-        return dbid;
+        return StringUtils::Format("%i", item->GetMusicInfoTag()->GetDatabaseId());;
       }
     break;
   case LISTITEM_STEREOSCOPIC_MODE:
@@ -5046,11 +5030,9 @@ CStdString CGUIInfoManager::GetItemImage(const CFileItem *item, int info, CStdSt
   {
   case LISTITEM_RATING:  // old song rating format
     {
-      CStdString rating;
       if (item->HasMusicInfoTag())
       {
-        rating.Format("songrating%c.png", item->GetMusicInfoTag()->GetRating());
-        return rating;
+        return StringUtils::Format("songrating%c.png", item->GetMusicInfoTag()->GetRating());
       }
     }
     break;
@@ -5059,11 +5041,11 @@ CStdString CGUIInfoManager::GetItemImage(const CFileItem *item, int info, CStdSt
       CStdString rating;
       if (item->HasVideoInfoTag())
       { // rating for videos is assumed 0..10, so convert to 0..5
-        rating.Format("rating%d.png", (long)((item->GetVideoInfoTag()->m_fRating * 0.5f) + 0.5f));
+        rating = StringUtils::Format("rating%d.png", (long)((item->GetVideoInfoTag()->m_fRating * 0.5f) + 0.5f));
       }
       else if (item->HasMusicInfoTag())
       { // song rating.
-        rating.Format("rating%c.png", item->GetMusicInfoTag()->GetRating());
+        rating = StringUtils::Format("rating%c.png", item->GetMusicInfoTag()->GetRating());
       }
       return rating;
     }
@@ -5201,12 +5183,12 @@ void CGUIInfoManager::UpdateFromTuxBox()
     g_tuxbox.sCurSrvData.current_event_duration.Replace("(","");
     g_tuxbox.sCurSrvData.current_event_duration.Replace(")","");
 
-    m_currentMovieDuration.Format("%s: %s %s (%s - %s)",
-      g_localizeStrings.Get(180),
-      g_tuxbox.sCurSrvData.current_event_duration,
-      g_localizeStrings.Get(12391),
-      g_tuxbox.sCurSrvData.current_event_time,
-      g_tuxbox.sCurSrvData.next_event_time);
+    m_currentMovieDuration = StringUtils::Format("%s: %s %s (%s - %s)",
+                                                 g_localizeStrings.Get(180).c_str(),
+                                                 g_tuxbox.sCurSrvData.current_event_duration.c_str(),
+                                                 g_localizeStrings.Get(12391).c_str(),
+                                                 g_tuxbox.sCurSrvData.current_event_time.c_str(),
+                                                 g_tuxbox.sCurSrvData.next_event_time.c_str());
   }
 
   //Set strVideoGenre
@@ -5215,12 +5197,11 @@ void CGUIInfoManager::UpdateFromTuxBox()
     !g_tuxbox.sCurSrvData.current_event_description.Equals("-") &&
     !g_tuxbox.sCurSrvData.next_event_description.Equals("-"))
   {
-    CStdString genre;
-    genre.Format("%s %s  -  (%s: %s)",
-      g_localizeStrings.Get(143),
-      g_tuxbox.sCurSrvData.current_event_description,
-      g_localizeStrings.Get(209),
-      g_tuxbox.sCurSrvData.next_event_description);
+    CStdString genre = StringUtils::Format("%s %s  -  (%s: %s)",
+                                           g_localizeStrings.Get(143).c_str(),
+                                           g_tuxbox.sCurSrvData.current_event_description.c_str(),
+                                           g_localizeStrings.Get(209).c_str(),
+                                           g_tuxbox.sCurSrvData.next_event_description.c_str());
     m_currentFile->GetVideoInfoTag()->m_genre = StringUtils::Split(genre, g_advancedSettings.m_videoItemSeparator);
   }
 
@@ -5250,9 +5231,7 @@ CStdString CGUIInfoManager::GetPictureLabel(int info)
     CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
     if (slideshow && slideshow->NumSlides())
     {
-      CStdString index;
-      index.Format("%d/%d", slideshow->CurrentSlide(), slideshow->NumSlides());
-      return index;
+      return StringUtils::Format("%d/%d", slideshow->CurrentSlide(), slideshow->NumSlides());
     }
   }
   if (m_currentSlide->HasPictureInfoTag())
index 568a352..75b62d1 100644 (file)
@@ -35,6 +35,7 @@
 #include "FileItem.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "view/ViewStateSettings.h"
 
 CGUIPassword::CGUIPassword(void)
@@ -137,10 +138,10 @@ bool CGUIPassword::CheckStartUpLock()
       iVerifyPasswordResult = VerifyPassword(CProfilesManager::Get().GetMasterProfile().getLockMode(), strPassword, strHeader);
       if (iVerifyPasswordResult != 0 )
       {
-        CStdString strLabel,strLabel1;
+        CStdString strLabel1;
         strLabel1 = g_localizeStrings.Get(12343);
         int iLeft = g_passwordManager.iMasterLockRetriesLeft-i;
-        strLabel.Format("%i %s",iLeft,strLabel1.c_str());
+        CStdString strLabel = StringUtils::Format("%i %s", iLeft, strLabel1.c_str());
 
         // PopUp OK and Display: MasterLock mode has changed but no no Mastercode has been set!
         CGUIDialogOK::ShowAndGetInput(20076, 12367, 12368, strLabel);
@@ -287,7 +288,9 @@ void CGUIPassword::UpdateMasterLockRetryCount(bool bResetCount)
     }
     CStdString dlgLine1 = "";
     if (0 < g_passwordManager.iMasterLockRetriesLeft)
-      dlgLine1.Format("%d %s", g_passwordManager.iMasterLockRetriesLeft, g_localizeStrings.Get(12343));
+      dlgLine1 = StringUtils::Format("%d %s",
+                                     g_passwordManager.iMasterLockRetriesLeft,
+                                     g_localizeStrings.Get(12343).c_str());
     CGUIDialogOK::ShowAndGetInput(20075, 12345, dlgLine1, 0);
   }
   else
index 46c0602..764ade9 100644 (file)
@@ -33,6 +33,7 @@
 #include "playlists/PlayList.h"
 #include "utils/TimeUtils.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "Application.h"
 #include "interfaces/AnnouncementManager.h"
 
@@ -605,8 +606,7 @@ bool CPartyModeManager::AddInitialSongs(vector<pair<int,int> > &songIDs)
 
     for (vector< pair<int,int> >::iterator it = chosenSongIDs.begin(); it != chosenSongIDs.end(); it++)
     {
-      CStdString song;
-      song.Format("%i,", it->second);
+      CStdString song = StringUtils::Format("%i,", it->second);
       if (it->first == 1)
         sqlWhereMusic += song;
       if (it->first == 2)
@@ -660,8 +660,7 @@ pair<CStdString,CStdString> CPartyModeManager::GetWhereClauseWithHistory() const
 
     for (unsigned int i = 0; i < m_history.size(); i++)
     {
-      CStdString number;
-      number.Format("%i,", m_history[i].second);
+      CStdString number = StringUtils::Format("%i,", m_history[i].second);
       if (m_history[i].first == 1)
         historyWhereMusic += number;
       if (m_history[i].first == 2)
index 5d458ed..f45281a 100644 (file)
@@ -30,6 +30,7 @@
 #include "playlists/PlayList.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 #include "music/tags/MusicInfoTag.h"
 #include "dialogs/GUIDialogKaiToast.h"
 #include "guilib/LocalizeStrings.h"
@@ -485,8 +486,7 @@ void CPlayListPlayer::SetShuffle(int iPlaylist, bool bYesNo, bool bNotify /* = f
 
     if (bNotify)
     {
-      CStdString shuffleStr;
-      shuffleStr.Format("%s: %s", g_localizeStrings.Get(191), g_localizeStrings.Get(bYesNo ? 593 : 591)); // Shuffle: All/Off
+      CStdString shuffleStr = StringUtils::Format("%s: %s", g_localizeStrings.Get(191).c_str(), g_localizeStrings.Get(bYesNo ? 593 : 591).c_str()); // Shuffle: All/Off
       CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(559),  shuffleStr);
     }
 
index 327a95c..98b9ebc 100644 (file)
@@ -21,7 +21,7 @@
 #include "LangInfo.h"
 #include "guilib/LocalizeStrings.h"
 #include "Temperature.h"
-
+#include "utils/StringUtils.h"
 
 CTemperature::CTemperature()
 {
@@ -488,8 +488,5 @@ CStdString CTemperature::ToString() const
   if (!IsValid())
     return g_localizeStrings.Get(13205); // "Unknown"
 
-  CStdString str;
-  str.Format("%2.0f%s", ToLocale(), g_langInfo.GetTempUnitString().c_str());
-
-  return str;
+  return StringUtils::Format("%2.0f%s", ToLocale(), g_langInfo.GetTempUnitString().c_str());
 }
index 7f356b7..d4bca6b 100644 (file)
@@ -27,6 +27,7 @@
 #include "settings/AdvancedSettings.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 #include "utils/StringUtils.h"
 
@@ -251,10 +252,8 @@ CStdString CTextureCache::GetCacheFile(const CStdString &url)
 {
   Crc32 crc;
   crc.ComputeFromLowerCase(url);
-  CStdString hex;
-  hex.Format("%08x", (unsigned int)crc);
-  CStdString hash;
-  hash.Format("%c/%s", hex[0], hex.c_str());
+  CStdString hex = StringUtils::Format("%08x", (unsigned int)crc);
+  CStdString hash = StringUtils::Format("%c/%s", hex[0], hex.c_str());
   return hash;
 }
 
index 0d53f4a..2ec01bf 100644 (file)
@@ -224,11 +224,8 @@ CStdString CTextureCacheJob::GetImageHash(const CStdString &url)
     if (!time)
       time = st.st_ctime;
     if (time || st.st_size)
-    {
-      CStdString hash;
-      hash.Format("d%"PRId64"s%"PRId64, time, st.st_size);
-      return hash;
-    }
+      return StringUtils::Format("d%"PRId64"s%"PRId64, time, st.st_size);;
+
   }
   CLog::Log(LOGDEBUG, "%s - unable to stat url %s", __FUNCTION__, url.c_str());
   return "";
index 86afbc0..bb708b1 100644 (file)
@@ -22,6 +22,7 @@
 #include "utils/RegExp.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "Util.h"
 #include "filesystem/File.h"
 #include "FileItem.h"
@@ -318,8 +319,7 @@ void CURL::Parse(const CStdString& strURL1)
   {
     if (m_strHostName != "" && m_strFileName != "")
     {
-      CStdString strFileName = m_strFileName;
-      m_strFileName.Format("%s/%s", m_strHostName.c_str(), strFileName.c_str());
+      m_strFileName = StringUtils::Format("%s/%s", m_strHostName.c_str(), m_strFileName.c_str());
       m_strHostName = "";
     }
     else
@@ -664,8 +664,7 @@ CStdString CURL::GetWithoutFilename() const
       strURL += m_strHostName;
     if (HasPort())
     {
-      CStdString strPort;
-      strPort.Format("%i", m_iPort);
+      CStdString strPort = StringUtils::Format("%i", m_iPort);
       strURL += ":";
       strURL += strPort;
     }
@@ -763,8 +762,7 @@ void CURL::Encode(CStdString& strURLData)
     }
     else
     {
-      CStdString strTmp;
-      strTmp.Format("%%%02.2x", kar);
+      CStdString strTmp = StringUtils::Format("%%%02.2x", kar);
       strResult += strTmp;
     }
   }
index aae254e..e3512f3 100644 (file)
@@ -543,7 +543,7 @@ void CUtil::GetFileAndProtocol(const CStdString& strURL, CStdString& strDir)
   if (URIUtils::IsDVD(strURL)) return ;
 
   CURL url(strURL);
-  strDir.Format("%s://%s", url.GetProtocol().c_str(), url.GetFileName().c_str());
+  strDir = StringUtils::Format("%s://%s", url.GetProtocol().c_str(), url.GetFileName().c_str());
 }
 
 int CUtil::GetDVDIfoTitle(const CStdString& strFile)
@@ -709,9 +709,7 @@ CStdString CUtil::GetNextFilename(const CStdString &fn_template, int max)
 
   CStdString searchPath = URIUtils::GetDirectory(fn_template);
   CStdString mask = URIUtils::GetExtension(fn_template);
-
-  CStdString name;
-  name.Format(fn_template.c_str(), 0);
+  CStdString name = StringUtils::Format(fn_template.c_str(), 0);
 
   CFileItemList items;
   if (!CDirectory::GetDirectory(searchPath, items, mask, DIR_FLAG_NO_FILE_DIRS))
@@ -720,8 +718,7 @@ CStdString CUtil::GetNextFilename(const CStdString &fn_template, int max)
   items.SetFastLookup(true);
   for (int i = 0; i <= max; i++)
   {
-    CStdString name;
-    name.Format(fn_template.c_str(), i);
+    CStdString name = StringUtils::Format(fn_template.c_str(), i);
     if (!items.Get(name))
       return name;
   }
@@ -735,8 +732,7 @@ CStdString CUtil::GetNextPathname(const CStdString &path_template, int max)
   
   for (int i = 0; i <= max; i++)
   {
-    CStdString name;
-    name.Format(path_template.c_str(), i);
+    CStdString name = StringUtils::Format(path_template.c_str(), i);
     if (!CFile::Exists(name))
       return name;
   }
@@ -1467,8 +1463,7 @@ bool CUtil::MakeShortenPath(CStdString StrInput, CStdString& StrOutput, int iTex
     iStrInputSize = StrInput.size();
   }
   // replace any additional /../../ with just /../ if necessary
-  CStdString replaceDots;
-  replaceDots.Format("..%c..", cDelim);
+  CStdString replaceDots = StringUtils::Format("..%c..", cDelim);
   while (StrInput.size() > (unsigned int)iTextMaxLength)
     if (!StrInput.Replace(replaceDots, ".."))
       break;
@@ -1948,8 +1943,7 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
   iSize = strLookInPaths.size();
   for (int i=0;i<9;++i) // 9 cd's
   {
-    CStdString cdDir;
-    cdDir.Format("cd%i",i+1);
+    CStdString cdDir = StringUtils::Format("cd%i",i+1);
     for (int i=0;i<iSize;++i)
     {
       CStdString strPath2 = URIUtils::AddFileToFolder(strLookInPaths[i],cdDir);
@@ -2042,7 +2036,7 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
         {
           for (unsigned int k = 0; k < TagConv.m_Langclass.size(); k++)
           {
-            strDest.Format("special://temp/subtitle.%s.%d.smi", TagConv.m_Langclass[k].Name, i);
+            strDest = StringUtils::Format("special://temp/subtitle.%s.%d.smi", TagConv.m_Langclass[k].Name.c_str(), i);
             if (CFile::Cache(vecSubtitles[i], strDest))
             {
               CLog::Log(LOGINFO, " cached subtitle %s->%s\n", vecSubtitles[i].c_str(), strDest.c_str());
index 07fab08..b099757 100644 (file)
@@ -22,6 +22,7 @@
 #include "LangInfo.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 
 #define SECONDS_PER_DAY 86400UL
 #define SECONDS_PER_HOUR 3600UL
@@ -843,10 +844,7 @@ CStdString CDateTime::GetAsDBDate() const
   SYSTEMTIME st;
   GetAsSystemTime(st);
 
-  CStdString date;
-  date.Format("%04i-%02i-%02i", st.wYear, st.wMonth, st.wDay);
-
-  return date;
+  return StringUtils::Format("%04i-%02i-%02i", st.wYear, st.wMonth, st.wDay);
 }
 
 CStdString CDateTime::GetAsDBDateTime() const
@@ -854,10 +852,7 @@ CStdString CDateTime::GetAsDBDateTime() const
   SYSTEMTIME st;
   GetAsSystemTime(st);
 
-  CStdString date;
-  date.Format("%04i-%02i-%02i %02i:%02i:%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
-
-  return date;
+  return StringUtils::Format("%04i-%02i-%02i %02i:%02i:%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
 }
 
 CStdString CDateTime::GetAsSaveString() const
@@ -865,10 +860,7 @@ CStdString CDateTime::GetAsSaveString() const
   SYSTEMTIME st;
   GetAsSystemTime(st);
 
-  CStdString date;
-  date.Format("%04i%02i%02i_%02i%02i%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
-
-  return date;
+  return StringUtils::Format("%04i%02i%02i_%02i%02i%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);;
 }
 
 void CDateTime::SetFromUTCDateTime(const CDateTime &dateTime)
@@ -1110,9 +1102,9 @@ CStdString CDateTime::GetAsLocalizedTime(const CStdString &format, bool withSeco
       // Format hour string with the length of the mask
       CStdString str;
       if (partLength==1)
-        str.Format("%d", hour);
+        str = StringUtils::Format("%d", hour);
       else
-        str.Format("%02d", hour);
+        str = StringUtils::Format("%02d", hour);
 
       strOut+=str;
     }
@@ -1137,9 +1129,9 @@ CStdString CDateTime::GetAsLocalizedTime(const CStdString &format, bool withSeco
       // Format minute string with the length of the mask
       CStdString str;
       if (partLength==1)
-        str.Format("%d", dateTime.wMinute);
+        str = StringUtils::Format("%d", dateTime.wMinute);
       else
-        str.Format("%02d", dateTime.wMinute);
+        str = StringUtils::Format("%02d", dateTime.wMinute);
 
       strOut+=str;
     }
@@ -1166,9 +1158,9 @@ CStdString CDateTime::GetAsLocalizedTime(const CStdString &format, bool withSeco
         // Format seconds string with the length of the mask
         CStdString str;
         if (partLength==1)
-          str.Format("%d", dateTime.wSecond);
+          str = StringUtils::Format("%d", dateTime.wSecond);
         else
-          str.Format("%02d", dateTime.wSecond);
+          str = StringUtils::Format("%02d", dateTime.wSecond);
 
         strOut+=str;
       }
@@ -1258,9 +1250,9 @@ CStdString CDateTime::GetAsLocalizedDate(const CStdString &strFormat, bool withS
       // Format string with the length of the mask
       CStdString str;
       if (partLength==1) // single-digit number
-        str.Format("%d", dateTime.wDay);
+        str = StringUtils::Format("%d", dateTime.wDay);
       else if (partLength==2) // two-digit number
-        str.Format("%02d", dateTime.wDay);
+        str = StringUtils::Format("%02d", dateTime.wDay);
       else // Day of week string
       {
         int wday = dateTime.wDayOfWeek;
@@ -1290,9 +1282,9 @@ CStdString CDateTime::GetAsLocalizedDate(const CStdString &strFormat, bool withS
       // Format string with the length of the mask
       CStdString str;
       if (partLength==1) // single-digit number
-        str.Format("%d", dateTime.wMonth);
+        str = StringUtils::Format("%d", dateTime.wMonth);
       else if (partLength==2) // two-digit number
-        str.Format("%02d", dateTime.wMonth);
+        str = StringUtils::Format("%02d", dateTime.wMonth);
       else // Month string
       {
         int wmonth = dateTime.wMonth;
@@ -1320,8 +1312,7 @@ CStdString CDateTime::GetAsLocalizedDate(const CStdString &strFormat, bool withS
       }
 
       // Format string with the length of the mask
-      CStdString str;
-      str.Format("%d", dateTime.wYear); // four-digit number
+      CStdString str = StringUtils::Format("%d", dateTime.wYear); // four-digit number
       if (partLength<=2)
         str.Delete(0, 2); // two-digit number
 
@@ -1366,8 +1357,7 @@ CStdString CDateTime::GetAsRFC1123DateTime() const
   if (month != time.GetMonth())
     CLog::Log(LOGWARNING, "Invalid month %d in %s", time.GetMonth(), time.GetAsDBDateTime().c_str());
 
-  CStdString result;
-  result.Format("%s, %02i %s %04i %02i:%02i:%02i GMT", DAY_NAMES[weekDay], time.GetDay(), MONTH_NAMES[month - 1], time.GetYear(), time.GetHour(), time.GetMinute(), time.GetSecond());
+  CStdString result = StringUtils::Format("%s, %02i %s %04i %02i:%02i:%02i GMT", DAY_NAMES[weekDay], time.GetDay(), MONTH_NAMES[month - 1], time.GetYear(), time.GetHour(), time.GetMinute(), time.GetSecond());
   return result;
 }
 
index 059d17e..7e59ebe 100644 (file)
@@ -588,7 +588,7 @@ TiXmlElement* CAddon::GetSettingsXML()
 
 void CAddon::BuildProfilePath()
 {
-  m_profile.Format("special://profile/addon_data/%s/", ID().c_str());
+  m_profile = StringUtils::Format("special://profile/addon_data/%s/", ID().c_str());
 }
 
 const CStdString CAddon::Icon() const
index 131092c..776b5ad 100644 (file)
@@ -30,6 +30,7 @@
 #include "FileItem.h"
 #include "network/Network.h"
 #include "utils/CharsetConverter.h"
+#include "utils/StringUtils.h"
 #include "cores/dvdplayer/DVDCodecs/DVDCodecs.h"
 
 using namespace XFILE;
@@ -111,8 +112,7 @@ void CAddonCallbacksAddon::AddOnLog(void *addonData, const addon_log_t addonLogL
         break;
     }
 
-    CStdString strXbmcMessage;
-    strXbmcMessage.Format("AddOnLog: %s: %s", addonHelper->m_addon->Name().c_str(), strMessage);
+    CStdString strXbmcMessage = StringUtils::Format("AddOnLog: %s: %s", addonHelper->m_addon->Name().c_str(), strMessage);
     CLog::Log(xbmcLogLevel, "%s", strXbmcMessage.c_str());
   }
   catch (std::exception &e)
index f0f0e4c..1fcf412 100644 (file)
@@ -256,9 +256,9 @@ void CAddonCallbacksPVR::PVRRecording(void *addonData, const char *strName, cons
 
   CStdString strLine1;
   if (bOnOff)
-    strLine1.Format(g_localizeStrings.Get(19197), client->Name());
+    strLine1 = StringUtils::Format(g_localizeStrings.Get(19197), client->Name().c_str());
   else
-    strLine1.Format(g_localizeStrings.Get(19198), client->Name());
+    strLine1 = StringUtils::Format(g_localizeStrings.Get(19198), client->Name().c_str());
 
   CStdString strLine2;
   if (strName)
index 99fe693..f3a808d 100644 (file)
@@ -22,6 +22,7 @@
 #include "addons/AddonManager.h"
 #include "utils/log.h"
 #include "utils/Variant.h"
+#include "utils/StringUtils.h"
 #include "XBDateTime.h"
 #include "addons/Service.h"
 #include "dbwrappers/dataset.h"
@@ -546,8 +547,7 @@ void CAddonDatabase::SetPropertiesFromAddon(const AddonPtr& addon,
   pItem->SetProperty("Addon.Creator", addon->Author());
   pItem->SetProperty("Addon.Disclaimer", addon->Disclaimer());
   pItem->SetProperty("Addon.Rating", addon->Stars());
-  CStdString starrating;
-  starrating.Format("rating%d.png", addon->Stars());
+  CStdString starrating = StringUtils::Format("rating%d.png", addon->Stars());
   pItem->SetProperty("Addon.StarRating",starrating);
   pItem->SetProperty("Addon.Path", addon->Path());
   if (addon->Props().broken == "DEPSNOTMET")
index 59819aa..5030dda 100644 (file)
@@ -612,9 +612,8 @@ bool CAddonInstallJob::Install(const CStdString &installFrom, const AddonPtr& re
   if (repo)
   {
     CFileItemList dummy;
-    CStdString s;
-    s.Format("plugin://%s/?action=install"
-             "&package=%s&version=%s", repo->ID().c_str(),
+    CStdString s = StringUtils::Format("plugin://%s/?action=install"
+                                       "&package=%s&version=%s", repo->ID().c_str(),
                                        m_addon->ID().c_str(),
                                        m_addon->Version().c_str());
     if (!CDirectory::GetDirectory(s, dummy))
@@ -645,8 +644,7 @@ bool CAddonInstallJob::Install(const CStdString &installFrom, const AddonPtr& re
     // resolve dependencies
     CAddonMgr::Get().FindAddons(); // needed as GetDeps() grabs directly from c-pluff via the addon manager
     ADDONDEPS deps = addon->GetDeps();
-    CStdString referer;
-    referer.Format("Referer=%s-%s.zip",addon->ID().c_str(),addon->Version().c_str());
+    CStdString referer = StringUtils::Format("Referer=%s-%s.zip",addon->ID().c_str(),addon->Version().c_str());
     for (ADDONDEPS::iterator it  = deps.begin(); it != deps.end(); ++it)
     {
       if (it->first.Equals("xbmc.metadata"))
@@ -803,9 +801,8 @@ bool CAddonUnInstallJob::DoWork()
   if (therepo && !therepo->Props().libname.IsEmpty())
   {
     CFileItemList dummy;
-    CStdString s;
-    s.Format("plugin://%s/?action=uninstall"
-             "&package=%s", therepo->ID().c_str(), m_addon->ID().c_str());
+    CStdString s = StringUtils::Format("plugin://%s/?action=uninstall"
+                                       "&package=%s", therepo->ID().c_str(), m_addon->ID().c_str());
     if (!CDirectory::GetDirectory(s, dummy))
       return false;
   }
index 38cbde6..6c69176 100644 (file)
@@ -28,6 +28,7 @@
 #include "dialogs/GUIDialogKaiToast.h"
 #include "settings/Settings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 
 namespace ADDON
 {
@@ -81,8 +82,7 @@ void CAddonStatusHandler::Process()
 {
   CSingleLock lock(m_critSection);
 
-  CStdString heading;
-  heading.Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str());
+  CStdString heading = StringUtils::Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str());
 
   /* AddOn lost connection to his backend (for ones that use Network) */
   if (m_status == ADDON_STATUS_LOST_CONNECTION)
index 2779f76..9ab8682 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "AddonVersion.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 namespace ADDON
 {
@@ -125,9 +126,7 @@ namespace ADDON
 
   CStdString AddonVersion::Print() const
   {
-    CStdString out;
-    out.Format("%s %s", g_localizeStrings.Get(24051), m_originalVersion); // "Version <str>"
-    return CStdString(out);
+    return StringUtils::Format("%s %s", g_localizeStrings.Get(24051).c_str(), m_originalVersion.c_str());
   }
 
   bool AddonVersion::SplitFileName(CStdString& ID, CStdString& version,
index f30ca70..a18e37d 100644 (file)
@@ -169,8 +169,7 @@ void CGUIDialogAddonInfo::UpdateControls()
 
 void CGUIDialogAddonInfo::OnUpdate()
 {
-  CStdString referer;
-  referer.Format("Referer=%s-%s.zip",m_localAddon->ID().c_str(),m_localAddon->Version().c_str());
+  CStdString referer = StringUtils::Format("Referer=%s-%s.zip",m_localAddon->ID().c_str(),m_localAddon->Version().c_str());
   CAddonInstaller::Get().Install(m_addon->ID(), true, referer); // force install
   Close();
 }
index abd7136..dc3f83c 100644 (file)
@@ -203,8 +203,7 @@ bool CGUIDialogAddonSettings::ShowAndGetInput(const AddonPtr &addon, bool saveTo
       return false;
 
     // Set the heading
-    CStdString heading;
-    heading.Format("$LOCALIZE[10004] - %s", addon->Name().c_str()); // "Settings - AddonName"
+    CStdString heading = StringUtils::Format("$LOCALIZE[10004] - %s", addon->Name().c_str()); // "Settings - AddonName"
     pDialog->m_strHeading = heading;
 
     pDialog->m_changed = false;
@@ -318,7 +317,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl)
             if (iSelected >= 0)
             {
               if (setting->Attribute("lvalues"))
-                value.Format("%i", iSelected);
+                value = StringUtils::Format("%i", iSelected);
               else
                 value = valuesVec[iSelected];
               ((CGUIButtonControl*) control)->SetLabel2(valuesVec[iSelected]);
@@ -447,7 +446,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl)
           }
           if (CGUIDialogNumeric::ShowAndGetTime(timedate, label))
           {
-            value.Format("%02d:%02d", timedate.wHour, timedate.wMinute);
+            value = StringUtils::Format("%02d:%02d", timedate.wHour, timedate.wMinute);
             ((CGUIButtonControl*) control)->SetLabel2(value);
           }
         }
@@ -522,15 +521,15 @@ void CGUIDialogAddonSettings::UpdateFromControls()
           if (strcmpi(type, "fileenum") == 0 || strcmpi(type, "labelenum") == 0)
             value = ((CGUISpinControlEx*) control)->GetLabel();
           else
-            value.Format("%i", ((CGUISpinControlEx*) control)->GetValue());
+            value = StringUtils::Format("%i", ((CGUISpinControlEx*) control)->GetValue());
           break;
         case CGUIControl::GUICONTROL_SETTINGS_SLIDER:
           {
             CStdString option = setting->Attribute("option");
             if (option.size() == 0 || option.CompareNoCase("float") == 0)
-              value.Format("%f", ((CGUISettingsSliderControl *)control)->GetFloatValue());
+              value = StringUtils::Format("%f", ((CGUISettingsSliderControl *)control)->GetFloatValue());
             else
-              value.Format("%i", ((CGUISettingsSliderControl *)control)->GetIntValue());
+              value = StringUtils::Format("%i", ((CGUISettingsSliderControl *)control)->GetIntValue());
           }
           break;
         default:
@@ -837,9 +836,9 @@ void CGUIDialogAddonSettings::CreateControls()
         {
           CStdString valuestring;
           if (elements < 2)
-            valuestring.Format(valueformat.c_str(), rangestart);
+            valuestring = StringUtils::Format(valueformat.c_str(), rangestart);
           else
-            valuestring.Format(valueformat.c_str(), rangestart+(rangeend-rangestart)/(elements-1)*i);
+            valuestring = StringUtils::Format(valueformat.c_str(), rangestart+(rangeend-rangestart)/(elements-1)*i);
           ((CGUISpinControlEx *)pControl)->AddLabel(valuestring, i);
         }
         ((CGUISpinControlEx *)pControl)->SetValue(atoi(m_settings[id]));
@@ -1033,7 +1032,7 @@ bool CGUIDialogAddonSettings::GetCondition(const CStdString &condition, const in
         if (((CGUISpinControlEx*) control2)->GetFloatValue() > 0.0f)
           value = ((CGUISpinControlEx*) control2)->GetLabel();
         else
-          value.Format("%i", ((CGUISpinControlEx*) control2)->GetValue());
+          value = StringUtils::Format("%i", ((CGUISpinControlEx*) control2)->GetValue());
         break;
       default:
         break;
index d2d1484..ed69ccd 100644 (file)
@@ -337,8 +337,7 @@ void CGUIWindowAddonBrowser::SetItemLabel2(CFileItemPtr item)
   unsigned int percent;
   if (CAddonInstaller::Get().GetProgress(item->GetProperty("Addon.ID").asString(), percent))
   {
-    CStdString progress;
-    progress.Format(g_localizeStrings.Get(24042).c_str(), percent);
+    CStdString progress = StringUtils::Format(g_localizeStrings.Get(24042).c_str(), percent);
     item->SetProperty("Addon.Status", progress);
     item->SetProperty("Addon.Downloading", true);
   }
index e61ceb8..9615a74 100644 (file)
@@ -739,13 +739,13 @@ std::vector<CMusicAlbumInfo> CScraper::FindAlbum(CCurlFile &fcurl, const CStdStr
         CStdString sArtist;
         CStdString sAlbumName;
         if (XMLUtils::GetString(pxeAlbum, "artist", sArtist) && !sArtist.empty())
-          sAlbumName.Format("%s - %s", sArtist.c_str(), sTitle.c_str());
+          sAlbumName = StringUtils::Format("%s - %s", sArtist.c_str(), sTitle.c_str());
         else
           sAlbumName = sTitle;
 
         CStdString sYear;
         if (XMLUtils::GetString(pxeAlbum, "year", sYear) && !sYear.empty())
-          sAlbumName.Format("%s (%s)", sAlbumName.c_str(), sYear.c_str());
+          sAlbumName = StringUtils::Format("%s (%s)", sAlbumName.c_str(), sYear.c_str());
 
         // if no URL is provided, use the URL we got back from CreateAlbumSearchUrl
         // (e.g., in case we only got one result back and were sent to the detail page)
index 4bda000..6cdad02 100644 (file)
@@ -89,12 +89,11 @@ bool CCDDARipJob::DoWork()
   CGUIDialogExtendedProgressBar* pDlgProgress = 
       (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
   CGUIDialogProgressBarHandle* handle = pDlgProgress->GetHandle(g_localizeStrings.Get(605));
-  CStdString strLine0;
+
   int iTrack = atoi(m_input.substr(13, m_input.size() - 13 - 5).c_str());
-  strLine0.Format("%02i. %s - %s", iTrack,
-                  StringUtils::Join(m_tag.GetArtist(),
-                              g_advancedSettings.m_musicItemSeparator).c_str(),
-                  m_tag.GetTitle().c_str());
+  CStdString strLine0 = StringUtils::Format("%02i. %s - %s", iTrack,
+                                            StringUtils::Join(m_tag.GetArtist(), g_advancedSettings.m_musicItemSeparator).c_str(),
+                                            m_tag.GetTitle().c_str());
   handle->SetText(strLine0);
 
   // start ripping
@@ -212,8 +211,7 @@ CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
     return NULL;
 
   // we have to set the tags before we init the Encoder
-  CStdString strTrack;
-  strTrack.Format("%i", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10));
+  CStdString strTrack = StringUtils::Format("%i", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10));
 
   encoder->SetComment("Ripped with XBMC");
   encoder->SetArtist(StringUtils::Join(m_tag.GetArtist(),
index 1e11534..c0bcd98 100644 (file)
@@ -244,8 +244,8 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag
   if (strAlbumDir.Find("%B") != -1)
   {
     CStdString strAlbum = infoTag.GetAlbum();
-    if (strAlbum.IsEmpty()) 
-      strAlbum.Format("Unknown Album %s", CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime().c_str());
+    if (strAlbum.IsEmpty())
+      strAlbum = StringUtils::Format("Unknown Album %s", CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime().c_str());
     else
       strAlbum.Replace('/', '_');
     strAlbumDir.Replace("%B", strAlbum);
@@ -300,7 +300,7 @@ CStdString CCDDARipper::GetTrackName(CFileItem *item)
   // grab the label to use it as our ripped filename
   CStdString track = destItem.GetLabel();
   if (track.IsEmpty())
-    track.Format("%s%02i", "Track-", trackNumber);
+    track = StringUtils::Format("%s%02i", "Track-", trackNumber);
   track += GetExtension(CSettings::Get().GetInt("audiocds.encoder"));
 
   return track;
index f5f699c..5138a9b 100644 (file)
@@ -27,6 +27,7 @@
 #include "Application.h"
 #include "threads/SingleLock.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "settings/Settings.h"
 #include <pulse/pulseaudio.h>
 #include <pulse/simple.h>
@@ -353,9 +354,8 @@ static void SinkInfo(pa_context *c, const pa_sink_info *i, int eol, void *userda
 
     if (add)
     {
-      CStdString desc, sink;
-      desc.Format("%s (PulseAudio)", i->description);
-      sink.Format("pulse:%s@default", i->name);
+      CStdString desc = StringUtils::Format("%s (PulseAudio)", i->description);
+      CStdString sink = StringUtils::Format("pulse:%s@default", i->name);
       sinkStruct->list->push_back(AEDevice(desc, sink));
       CLog::Log(LOGDEBUG, "PulseAudio: Found %s with devicestring %s", desc.c_str(), sink.c_str());
     }
@@ -375,8 +375,7 @@ void CPulseAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
   sinkStruct.passthrough = passthrough;
   sinkStruct.mainloop = m_MainLoop;
   sinkStruct.list = &devices;
-  CStdString def;
-  def.Format("%s (PulseAudio)",g_localizeStrings.Get(409).c_str());
+  CStdString def = StringUtils::Format("%s (PulseAudio)",g_localizeStrings.Get(409).c_str());
   devices.push_back(AEDevice(def, "pulse:default@default"));
   WaitForOperation(pa_context_get_sink_info_list(m_Context,
                    SinkInfo, &sinkStruct), m_MainLoop, "EnumerateAudioSinks");
index d4565e9..61e4c4e 100644 (file)
@@ -76,6 +76,7 @@
 #include <dlfcn.h>
 #endif
 #include "utils/Environment.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 using namespace XFILE;
@@ -204,8 +205,9 @@ extern "C" void __stdcall update_emu_environ()
     if (!CSettings::Get().GetString("network.httpproxyusername").empty() &&
         !CSettings::Get().GetString("network.httpproxypassword").empty())
     {
-      strProxy.Format("%s:%s@", CSettings::Get().GetString("network.httpproxyusername").c_str(),
-                                CSettings::Get().GetString("network.httpproxypassword").c_str());
+      strProxy = StringUtils::Format("%s:%s@",
+                                     CSettings::Get().GetString("network.httpproxyusername").c_str(),
+                                     CSettings::Get().GetString("network.httpproxypassword").c_str());
     }
 
     strProxy += CSettings::Get().GetString("network.httpproxyserver");
index c6f26a6..0d7cfc6 100644 (file)
@@ -29,6 +29,7 @@
 #include "windowing/WindowingFactory.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 
 CDummyVideoPlayer::CDummyVideoPlayer(IPlayerCallback& callback)
     : IPlayer(callback),
@@ -289,8 +290,7 @@ void CDummyVideoPlayer::Render()
     int mins = (int)(m_clock / 60000);
     int secs = (int)((m_clock / 1000) % 60);
     int ms = (int)(m_clock % 1000);
-    CStdString currentTime;
-    currentTime.Format("Video goes here %02i:%02i:%03i", mins, secs, ms);
+    CStdString currentTime = StringUtils::Format("Video goes here %02i:%02i:%03i", mins, secs, ms);
     float posX = (vw.x1 + vw.x2) * 0.5f;
     float posY = (vw.y1 + vw.y2) * 0.5f;
     CGUITextLayout::DrawText(font, posX, posY, 0xffffffff, 0, currentTime, XBFONT_CENTER_X | XBFONT_CENTER_Y);
index 0bc2068..a33591d 100644 (file)
@@ -30,6 +30,7 @@
 #include "threads/SingleLock.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 
 #include "Application.h"
 #include "ApplicationMessenger.h"
@@ -211,11 +212,10 @@ CStdString CXBMCRenderManager::GetVSyncState()
     avgerror += m_errorbuff[i];
   avgerror /= ERRORBUFFSIZE;
 
-  CStdString state;
-  state.Format("sync:%+3d%% avg:%3d%% error:%2d%%"
-              ,     MathUtils::round_int(m_presentcorr * 100)
-              ,     MathUtils::round_int(avgerror      * 100)
-              , abs(MathUtils::round_int(m_presenterr  * 100)));
+  CStdString state = StringUtils::Format("sync:%+3d%% avg:%3d%% error:%2d%%"
+                                         ,     MathUtils::round_int(m_presentcorr * 100)
+                                         ,     MathUtils::round_int(avgerror      * 100)
+                                         , abs(MathUtils::round_int(m_presenterr  * 100)));
   return state;
 }
 
index 9b9ef50..3e105d3 100644 (file)
@@ -64,6 +64,7 @@
 #include "DVDStreamInfo.h"
 #include "settings/Settings.h"
 #include "utils/SystemInfo.h"
+#include "utils/StringUtils.h"
 
 CDVDVideoCodec* CDVDFactoryCodec::OpenCodec(CDVDVideoCodec* pCodec, CDVDStreamInfo &hints, CDVDCodecOptions &options )
 {
@@ -318,8 +319,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne
   }
 #endif
 
-  CStdString value;
-  value.Format("%d", surfaces);
+  CStdString value = StringUtils::Format("%d", surfaces);
   options.m_keys.push_back(CDVDCodecOption("surfaces", value));
   if( (pCodec = OpenCodec(new CDVDVideoCodecFFmpeg(), hint, options)) ) return pCodec;
 
index 223f110..2fadb4d 100644 (file)
@@ -103,7 +103,7 @@ int CDVDOverlayCodecSSA::Decode(DemuxPacket *pPacket)
       if(pos == CStdString::npos)
         continue;
 
-      line2.Format("%d,%s,%s", m_order++, layer.get(), line.Mid(pos+1));
+      line2 = StringUtils::Format("%d,%s,%s", m_order++, layer.get(), line.Mid(pos+1).c_str());
 
       m_libass->DecodeDemuxPkt((char*)line2.c_str(), line2.length(), beg, end - beg);
 
index 06329d5..e1b57ce 100644 (file)
@@ -30,6 +30,7 @@
 #include "settings/Settings.h"
 #include "utils/AMLUtils.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "utils/TimeUtils.h"
 
 #include <unistd.h>
index 3b316ae..95c8093 100644 (file)
@@ -60,6 +60,7 @@
 #ifdef TARGET_DARWIN_OSX
 #include "VDA.h"
 #endif
+#include "utils/StringUtils.h"
 
 using namespace boost;
 
@@ -730,16 +731,14 @@ int CDVDVideoCodecFFmpeg::FilterOpen(const CStdString& filters, bool scale)
   AVFilter* srcFilter = m_dllAvFilter.avfilter_get_by_name("buffer");
   AVFilter* outFilter = m_dllAvFilter.avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
 
-  CStdString args;
-
-  args.Format("%d:%d:%d:%d:%d:%d:%d",
-    m_pCodecContext->width,
-    m_pCodecContext->height,
-    m_pCodecContext->pix_fmt,
-    m_pCodecContext->time_base.num,
-    m_pCodecContext->time_base.den,
-    m_pCodecContext->sample_aspect_ratio.num,
-    m_pCodecContext->sample_aspect_ratio.den);
+  CStdString args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
+                                        m_pCodecContext->width,
+                                        m_pCodecContext->height,
+                                        m_pCodecContext->pix_fmt,
+                                        m_pCodecContext->time_base.num,
+                                        m_pCodecContext->time_base.den,
+                                        m_pCodecContext->sample_aspect_ratio.num,
+                                        m_pCodecContext->sample_aspect_ratio.den);
 
   if ((result = m_dllAvFilter.avfilter_graph_create_filter(&m_pFilterIn, srcFilter, "src", args, NULL, m_pFilterGraph)) < 0)
   {
index 5296dec..bd46a38 100644 (file)
@@ -39,6 +39,7 @@
 #include "settings/MediaSettings.h"
 #include "boost/shared_ptr.hpp"
 #include "utils/AutoPtrHandle.h"
+#include "utils/StringUtils.h"
 #include "settings/AdvancedSettings.h"
 #include "settings/MediaSettings.h"
 #include "cores/VideoRenderers/RenderManager.h"
@@ -270,8 +271,7 @@ static const pci_device NoDeintProcForProgDevices[] = {
 
 static CStdString GUIDToString(const GUID& guid)
 {
-  CStdString buffer;
-  buffer.Format("%08X-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+  CStdString buffer = StringUtils::Format("%08X-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"
               , guid.Data1, guid.Data2, guid.Data3
               , guid.Data4[0], guid.Data4[1]
               , guid.Data4[2], guid.Data4[3], guid.Data4[4]
index a8a4ad9..6475f33 100644 (file)
@@ -22,6 +22,7 @@
 #include "DVDDemuxBXA.h"
 #include "DVDDemuxUtils.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "../DVDClock.h"
 
 // AirTunes audio Demuxer.
@@ -41,9 +42,7 @@ public:
   {}
   void GetStreamInfo(string& strInfo)
   {
-    CStdString info;
-    info.Format("%s", m_codec.c_str());
-    strInfo = info;
+    strInfo = StringUtils::Format("%s", m_codec.c_str());
   }
 };
 
index af05077..87a367f 100644 (file)
@@ -48,6 +48,7 @@
 #include "threads/Thread.h"
 #include "threads/SystemClock.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 
 void CDemuxStreamAudioFFmpeg::GetStreamInfo(std::string& strInfo)
@@ -122,10 +123,8 @@ void ff_avutil_log(void* ptr, int level, const char* format, va_list va)
     default            : type = LOGDEBUG;   break;
   }
 
-  CStdString message, prefix;
-  message.FormatV(format, va);
-
-  prefix.Format("ffmpeg[%X]: ", threadId);
+  CStdString message = StringUtils::FormatV(format, va);
+  CStdString prefix = StringUtils::Format("ffmpeg[%X]: ", threadId);
   if(avc)
   {
     if(avc->item_name)
index 40551c4..2862fee 100644 (file)
@@ -27,6 +27,7 @@
 #include "DVDClock.h"
 #include "dialogs/GUIDialogKaiToast.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include <arpa/inet.h>
 
 extern "C" {
@@ -50,13 +51,12 @@ public:
   {}
   void GetStreamInfo(std::string& strInfo)
   {
-    CStdString info;
-    info.Format("%s, delay: %u, drops: %ub %up %ui"
-               , m_codec.c_str()
-               , m_parent->m_QueueStatus.delay
-               , m_parent->m_QueueStatus.bdrops
-               , m_parent->m_QueueStatus.pdrops
-               , m_parent->m_QueueStatus.idrops);
+    CStdString info = StringUtils::Format("%s, delay: %u, drops: %ub %up %ui"
+                                          , m_codec.c_str()
+                                          , m_parent->m_QueueStatus.delay
+                                          , m_parent->m_QueueStatus.bdrops
+                                          , m_parent->m_QueueStatus.pdrops
+                                          , m_parent->m_QueueStatus.idrops);
     strInfo = info;
   }
 };
@@ -74,8 +74,7 @@ public:
   {}
   void GetStreamInfo(string& strInfo)
   {
-    CStdString info;
-    info.Format("%s", m_codec.c_str());
+    CStdString info = StringUtils::Format("%s", m_codec.c_str());
     strInfo = info;
   }
 };
index 7b742ea..26d950f 100644 (file)
@@ -699,7 +699,7 @@ bool CDVDPlayer::OpenInputStream()
 
     // find any upnp subtitles
     CStdString key("upnp:subtitle:1");
-    for(unsigned s = 1; m_item.HasProperty(key); key.Format("upnp:subtitle:%u", ++s))
+    for(unsigned s = 1; m_item.HasProperty(key); key = StringUtils::Format("upnp:subtitle:%u", ++s))
       filenames.push_back(m_item.GetProperty(key).asString());
 
     for(unsigned int i=0;i<filenames.size();i++)
@@ -2697,7 +2697,7 @@ bool CDVDPlayer::SeekScene(bool bPlus)
 void CDVDPlayer::GetAudioInfo(CStdString& strAudioInfo)
 {
   { CSingleLock lock(m_StateSection);
-    strAudioInfo.Format("D(%s)", m_StateInput.demux_audio.c_str());
+    strAudioInfo = StringUtils::Format("D(%s)", m_StateInput.demux_audio.c_str());
   }
   strAudioInfo.AppendFormat("\nP(%s)", m_dvdPlayerAudio.GetPlayerInfo().c_str());
 }
@@ -2705,7 +2705,7 @@ void CDVDPlayer::GetAudioInfo(CStdString& strAudioInfo)
 void CDVDPlayer::GetVideoInfo(CStdString& strVideoInfo)
 {
   { CSingleLock lock(m_StateSection);
-    strVideoInfo.Format("D(%s)", m_StateInput.demux_video.c_str());
+    strVideoInfo = StringUtils::Format("D(%s)", m_StateInput.demux_video.c_str());
   }
   strVideoInfo.AppendFormat("\nP(%s)", m_dvdPlayerVideo.GetPlayerInfo().c_str());
 }
@@ -2737,14 +2737,14 @@ void CDVDPlayer::GetGeneralInfo(CStdString& strGeneralInfo)
         strBuf.AppendFormat(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay));
     }
 
-    strGeneralInfo.Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s )"
-                         , dDelay
-                         , dDiff
-                         , strEDL.c_str()
-                         , (int)(CThread::GetRelativeUsage()*100)
-                         , (int)(m_dvdPlayerAudio.GetRelativeUsage()*100)
-                         , (int)(m_dvdPlayerVideo.GetRelativeUsage()*100)
-                         , strBuf.c_str());
+    strGeneralInfo = StringUtils::Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s )"
+                                         , dDelay
+                                         , dDiff
+                                         , strEDL.c_str()
+                                         , (int)(CThread::GetRelativeUsage()*100)
+                                         , (int)(m_dvdPlayerAudio.GetRelativeUsage()*100)
+                                         , (int)(m_dvdPlayerVideo.GetRelativeUsage()*100)
+                                         , strBuf.c_str());
 
   }
 }
index b265f03..d511ab3 100644 (file)
@@ -750,7 +750,7 @@ bool COMXPlayer::OpenInputStream()
 
     // find any upnp subtitles
     CStdString key("upnp:subtitle:1");
-    for(unsigned s = 1; m_item.HasProperty(key); key.Format("upnp:subtitle:%u", ++s))
+    for(unsigned s = 1; m_item.HasProperty(key); key = StringUtils::Format("upnp:subtitle:%u", ++s))
       filenames.push_back(m_item.GetProperty(key).asString());
 
     for(unsigned int i=0;i<filenames.size();i++)
@@ -2941,7 +2941,7 @@ bool COMXPlayer::SeekScene(bool bPlus)
 void COMXPlayer::GetAudioInfo(CStdString &strAudioInfo)
 {
   { CSingleLock lock(m_StateSection);
-    strAudioInfo.Format("D(%s)", m_StateInput.demux_audio.c_str());
+    strAudioInfo = StringUtils::Format("D(%s)", m_StateInput.demux_audio.c_str());
   }
   strAudioInfo.AppendFormat("\nP(%s)", m_omxPlayerAudio.GetPlayerInfo().c_str());
 }
@@ -2949,7 +2949,7 @@ void COMXPlayer::GetAudioInfo(CStdString &strAudioInfo)
 void COMXPlayer::GetVideoInfo(CStdString &strVideoInfo)
 {
   { CSingleLock lock(m_StateSection);
-    strVideoInfo.Format("D(%s)", m_StateInput.demux_video.c_str());
+    strVideoInfo = StringUtils::Format("D(%s)", m_StateInput.demux_video.c_str());
   }
   strVideoInfo.AppendFormat("\nP(%s)", m_omxPlayerVideo.GetPlayerInfo().c_str());
 }
@@ -2979,7 +2979,7 @@ void COMXPlayer::GetGeneralInfo(CStdString& strGeneralInfo)
         strBuf.AppendFormat(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay));
     }
 
-    strGeneralInfo.Format("C( ad:% 6.3f a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s af:%d%% vf:%d%% amp:% 5.2f )"
+    strGeneralInfo = StringUtils::Format("C( ad:% 6.3f a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s af:%d%% vf:%d%% amp:% 5.2f )"
                          , m_omxPlayerAudio.GetDelay()
                          , dDiff
                          , strEDL.c_str()
index c643175..68ae12f 100644 (file)
@@ -31,6 +31,7 @@
 //#include "MathUtils.h"
 #include "PCMRemap.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "settings/Settings.h"
 #include "settings/AdvancedSettings.h"
 #ifdef _WIN32
@@ -416,7 +417,7 @@ void CPCMRemap::BuildMap()
         dst->copy  = false;
       }
 
-      f.Format("%s(%f%s) ",  PCMChannelStr(dst->channel).c_str(), dst->level, dst->copy ? "*" : "");
+      f = StringUtils::Format("%s(%f%s) ",  PCMChannelStr(dst->channel).c_str(), dst->level, dst->copy ? "*" : "");
       s += f;
     }
     CLog::Log(LOGDEBUG, "CPCMRemap: %s = %s\n", PCMChannelStr(m_outMap[out_ch]).c_str(), s.c_str());
@@ -759,7 +760,7 @@ CStdString CPCMRemap::PCMChannelStr(enum PCMChannels ename)
   CStdString namestr;
 
   if (namepos < 0 || namepos >= (int)(sizeof(PCMChannelName) / sizeof(const char*)))
-    namestr.Format("UNKNOWN CHANNEL:%i", namepos);
+    namestr = StringUtils::Format("UNKNOWN CHANNEL:%i", namepos);
   else
     namestr = PCMChannelName[namepos];
 
index 011f06b..ca127cd 100644 (file)
@@ -390,7 +390,7 @@ CStdString CDatabaseQueryRule::FormatWhereClause(const CStdString &negate, const
     else if (GetFieldType(m_field) == SECONDS_FIELD)
       fmt = "CAST(%s as INTEGER)";
 
-    query.Format(fmt.c_str(), GetField(m_field,strType).c_str());
+    query = StringUtils::Format(fmt.c_str(), GetField(m_field,strType).c_str());
     query += negate + parameter;
   }
 
index f2015c0..68e990b 100644 (file)
@@ -44,6 +44,7 @@
 #include "TextureCache.h"
 #include "video/windows/GUIWindowVideoBase.h"
 #include "URL.h"
+#include "utils/StringUtils.h"
 
 #ifdef TARGET_WINDOWS
 #include "WIN32Util.h"
@@ -565,7 +566,7 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI
       // password entry and re-entry succeeded, write out the lock data
       share->m_iHasLock = 2;
       CMediaSourceSettings::Get().UpdateSource(type, share->strName, "lockcode", strNewPassword);
-      strNewPassword.Format("%i",share->m_iLockMode);
+      strNewPassword = StringUtils::Format("%i", share->m_iLockMode);
       CMediaSourceSettings::Get().UpdateSource(type, share->strName, "lockmode", strNewPassword);
       CMediaSourceSettings::Get().UpdateSource(type, share->strName, "badpwdcount", "0");
       CMediaSourceSettings::Get().Save();
@@ -624,7 +625,7 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI
       CStdString strNewPW;
       CStdString strNewLockMode;
       if (CGUIDialogLockSettings::ShowAndGetLock(share->m_iLockMode,strNewPW))
-        strNewLockMode.Format("%i",share->m_iLockMode);
+        strNewLockMode = StringUtils::Format("%i",share->m_iLockMode);
       else
         return false;
       // password ReSet and re-entry succeeded, write out the lock data
index a07bd4f..d0d1419 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "GUIDialogGamepad.h"
 #include "utils/md5.h"
+#include "utils/StringUtils.h"
 #include "guilib/GUIAudioManager.h"
 #include "guilib/GUIWindowManager.h"
 #include "GUIDialogOK.h"
@@ -231,7 +232,7 @@ int CGUIDialogGamepad::ShowAndVerifyPassword(CStdString& strPassword, const CStd
   if (0 < iRetries)
   {
     // Show a string telling user they have iRetries retries left
-    strLine2.Format("%s %i %s", g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
+    strLine2 = StringUtils::Format("%s %i %s", g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
   }
 
   // make a copy of strPassword to prevent from overwriting it later
index 978b402..1e770ce 100644 (file)
@@ -29,6 +29,7 @@
 #include "playlists/SmartPlayList.h"
 #include "utils/log.h"
 #include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
 #include "video/VideoDatabase.h"
 
 #define TIMEOUT_DELAY             500
@@ -378,8 +379,7 @@ void CGUIDialogMediaFilter::SetupPage()
   else if (m_mediaType == "songs")
     localizedMediaId = 134;
 
-  CStdString format;
-  format.Format(g_localizeStrings.Get(1275).c_str(), g_localizeStrings.Get(localizedMediaId).c_str());
+  CStdString format = StringUtils::Format(g_localizeStrings.Get(1275).c_str(), g_localizeStrings.Get(localizedMediaId).c_str());
   SET_CONTROL_LABEL(CONTROL_HEADING, format);
 
   // now we can finally set the label/values of the button settings (genre, actors etc)
@@ -496,11 +496,10 @@ void CGUIDialogMediaFilter::OnSettingChanged(SettingInfo &setting)
         }
         else
         {
-          CStdString tmp;
-          tmp.Format("%.1f", *valueLower);
+          CStdString tmp = StringUtils::Format("%.1f", *valueLower);
           filter.rule->m_parameter.push_back(tmp);
           tmp.clear();
-          tmp.Format("%.1f", *valueUpper);
+          tmp = StringUtils::Format("%.1f", *valueUpper);
           filter.rule->m_parameter.push_back(tmp);
         }
       }
@@ -650,7 +649,7 @@ void CGUIDialogMediaFilter::UpdateControls()
       else
       {
         CONTROL_ENABLE(itFilter->second.controlIndex);
-        label.Format("%s [%d]", label, size);
+        label = StringUtils::Format("%s [%d]", label.c_str(), size);
       }
       SET_CONTROL_LABEL(itFilter->second.controlIndex, label);
     }
@@ -757,8 +756,7 @@ void CGUIDialogMediaFilter::OnBrowse(const Filter &filter, CFileItemList &items,
   CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
   pDialog->Reset();
   pDialog->SetItems(&selectItems);
-  CStdString strHeading;
-  strHeading.Format(g_localizeStrings.Get(13401), g_localizeStrings.Get(filter.label));
+  CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(13401), g_localizeStrings.Get(filter.label).c_str());
   pDialog->SetHeading(strHeading);
   pDialog->SetMultiSelection(true);
 
@@ -833,7 +831,7 @@ void CGUIDialogMediaFilter::GetRange(const Filter &filter, float &min, float &in
       else if (m_mediaType == "tvshows")
       {
         table = "tvshowview";
-        year.Format("strftime(\"%%Y\", %s)", DatabaseUtils::GetField(FieldYear, MediaTypeTvShow, DatabaseQueryPartWhere));
+        year = StringUtils::Format("strftime(\"%%Y\", %s)", DatabaseUtils::GetField(FieldYear, MediaTypeTvShow, DatabaseQueryPartWhere).c_str());
       }
       else if (m_mediaType == "musicvideos")
       {
@@ -876,7 +874,7 @@ void CGUIDialogMediaFilter::GetRange(const Filter &filter, float &min, float &in
 
     if (m_mediaType == "episodes")
     {
-      CStdString field; field.Format("CAST(strftime(\"%%s\", c%02d) AS INTEGER)", VIDEODB_ID_EPISODE_AIRED);
+      CStdString field = StringUtils::Format("CAST(strftime(\"%%s\", c%02d) AS INTEGER)", VIDEODB_ID_EPISODE_AIRED);
       
       GetMinMax("episodeview", field, min, max);
       interval = 60 * 60 * 24 * 7; // 1 week
@@ -968,9 +966,9 @@ CStdString CGUIDialogMediaFilter::RangeAsFloat(float valueLower, float valueUppe
 {
   CStdString text;
   if (valueLower != valueUpper)
-    text.Format(g_localizeStrings.Get(21467).c_str(), valueLower, valueUpper);
+    text = StringUtils::Format(g_localizeStrings.Get(21467).c_str(), valueLower, valueUpper);
   else
-    text.Format("%.1f", valueLower);
+    text = StringUtils::Format("%.1f", valueLower);
   return text;
 }
 
@@ -978,9 +976,11 @@ CStdString CGUIDialogMediaFilter::RangeAsInt(float valueLower, float valueUpper,
 {
   CStdString text;
   if (valueLower != valueUpper)
-    text.Format(g_localizeStrings.Get(21468).c_str(), MathUtils::round_int((double)valueLower), MathUtils::round_int((double)valueUpper));
+    text = StringUtils::Format(g_localizeStrings.Get(21468).c_str(),
+                               MathUtils::round_int((double)valueLower),
+                               MathUtils::round_int((double)valueUpper));
   else
-    text.Format("%d", MathUtils::round_int((double)valueLower));
+    text = StringUtils::Format("%d", MathUtils::round_int((double)valueLower));
   return text;
 }
 
@@ -990,9 +990,12 @@ CStdString CGUIDialogMediaFilter::RangeAsDate(float valueLower, float valueUpper
   CDateTime to = (time_t)valueUpper;
   CStdString text;
   if (valueLower != valueUpper)
-    text.Format(g_localizeStrings.Get(21469).c_str(), from.GetAsLocalizedDate(), to.GetAsLocalizedDate());
+    text = StringUtils::Format(g_localizeStrings.Get(21469).c_str(),
+                               from.GetAsLocalizedDate().c_str(),
+                               to.GetAsLocalizedDate().c_str());
   else
-    text.Format("%s", from.GetAsLocalizedDate());
+    text = StringUtils::Format("%s",
+                               from.GetAsLocalizedDate().c_str());
   return text;
 }
 
@@ -1002,8 +1005,10 @@ CStdString CGUIDialogMediaFilter::RangeAsTime(float valueLower, float valueUpper
   CDateTime to = (time_t)valueUpper;
   CStdString text;
   if (valueLower != valueUpper)
-    text.Format(g_localizeStrings.Get(21469).c_str(), from.GetAsLocalizedTime("mm:ss"), to.GetAsLocalizedTime("mm:ss"));
+    text = StringUtils::Format(g_localizeStrings.Get(21469).c_str(),
+                               from.GetAsLocalizedTime("mm:ss").c_str(),
+                               to.GetAsLocalizedTime("mm:ss").c_str());
   else
-    text.Format("%s", from.GetAsLocalizedTime("mm:ss"));
+    text = StringUtils::Format("%s", from.GetAsLocalizedTime("mm:ss").c_str());
   return text;
 }
index da48705..e080dd8 100644 (file)
@@ -26,6 +26,7 @@
 #include "guilib/Key.h"
 #include "Util.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "filesystem/Directory.h"
 #include "filesystem/PluginDirectory.h"
 #include "filesystem/PVRDirectory.h"
@@ -151,7 +152,7 @@ bool CGUIDialogMediaSource::ShowAndAddMediaSource(const CStdString &type)
           break;
       }
       if (i < pShares->size()) // found a match -  try next
-        strName.Format("%s (%i)",dialog->m_name,j++);
+        strName = StringUtils::Format("%s (%i)", dialog->m_name.c_str(), j++);
       else
         bConfirmed = true;
     }
@@ -203,7 +204,7 @@ bool CGUIDialogMediaSource::ShowAndEditMediaSource(const CStdString &type, const
           break;
       }
       if (i < pShares->size() && (*pShares)[i].strName != strOldName) // found a match -  try next
-        strName.Format("%s (%i)",dialog->m_name,j++);
+        strName = StringUtils::Format("%s (%i)", dialog->m_name.c_str(), j++);
       else
         bConfirmed = true;
     }
@@ -469,7 +470,7 @@ void CGUIDialogMediaSource::SetTypeOfMedia(const CStdString &type, bool editNotA
   else // if (type == "files");
     typeStringID = 744;  // "Files"
   CStdString format;
-  format.Format(g_localizeStrings.Get(editNotAdd ? 1028 : 1020).c_str(), g_localizeStrings.Get(typeStringID).c_str());
+  format = StringUtils::Format(g_localizeStrings.Get(editNotAdd ? 1028 : 1020).c_str(), g_localizeStrings.Get(typeStringID).c_str());
   SET_CONTROL_LABEL(CONTROL_HEADING, format);
 }
 
index 81f84bf..b999cfe 100644 (file)
@@ -304,19 +304,19 @@ void CGUIDialogNumeric::FrameMove()
   }
   else if (m_mode == INPUT_TIME)
   { // format up the time
-    strLabel.Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute);
+    strLabel = StringUtils::Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute);
     start = m_block * 3;
     end = m_block * 3 + 2;
   }
   else if (m_mode == INPUT_TIME_SECONDS)
   { // format up the time
-    strLabel.Format("%2d:%02d", m_datetime.wMinute, m_datetime.wSecond);
+    strLabel = StringUtils::Format("%2d:%02d", m_datetime.wMinute, m_datetime.wSecond);
     start = m_block * 3;
     end = m_block * 3 + 2;
   }
   else if (m_mode == INPUT_DATE)
   { // format up the date
-    strLabel.Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
+    strLabel = StringUtils::Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
     start = m_block * 3;
     end = m_block * 3 + 2;
     if (m_block == 2)
@@ -324,7 +324,7 @@ void CGUIDialogNumeric::FrameMove()
   }
   else if (m_mode == INPUT_IP_ADDRESS)
   { // format up the date
-    strLabel.Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
+    strLabel = StringUtils::Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
     start = m_block * 4;
     end = m_block * 4 + 3;
   }
@@ -595,26 +595,20 @@ void CGUIDialogNumeric::GetOutput(void *output) const
   if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS || m_mode == INPUT_DATE)
     memcpy(output, &m_datetime, sizeof(m_datetime));
   else if (m_mode == INPUT_IP_ADDRESS)
-  {
-    CStdString *ipaddress = (CStdString *)output;
-    ipaddress->Format("%d.%d.%d.%d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
-  }
+    *(CStdString *)output = StringUtils::Format("%d.%d.%d.%d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
   else if (m_mode == INPUT_NUMBER || m_mode == INPUT_PASSWORD)
-  {
-    CStdString *number = (CStdString *)output;
-    *number = m_number;
-  }
+    *(CStdString *)output = m_number;
 }
 
 CStdString CGUIDialogNumeric::GetOutput() const
 {
   CStdString output;
   if (m_mode == INPUT_DATE)
-    output.Format("%02i/%02i/%04i", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
+    output = StringUtils::Format("%02i/%02i/%04i", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
   else if (m_mode == INPUT_TIME)
-    output.Format("%i:%02i", m_datetime.wHour, m_datetime.wMinute);
+    output = StringUtils::Format("%i:%02i", m_datetime.wHour, m_datetime.wMinute);
   else if (m_mode == INPUT_TIME_SECONDS)
-    output.Format("%i:%02i", m_datetime.wMinute, m_datetime.wSecond);
+    output = StringUtils::Format("%i:%02i", m_datetime.wMinute, m_datetime.wSecond);
   else
     GetOutput(&output);
   return output;
@@ -739,7 +733,7 @@ int CGUIDialogNumeric::ShowAndVerifyPassword(CStdString& strPassword, const CStd
   if (0 < iRetries)
   {
     // Show a string telling user they have iRetries retries left
-    strTempHeading.Format("%s. %s %i %s", strHeading.c_str(), g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
+    strTempHeading = StringUtils::Format("%s. %s %i %s", strHeading.c_str(), g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
   }
   // make a copy of strPassword to prevent from overwriting it later
   CStdString strPassTemp = strPassword;
index c635b28..453994c 100644 (file)
@@ -23,6 +23,7 @@
 #include "FileItem.h"
 #include "guilib/Key.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 #define CONTROL_HEADING       1
 #define CONTROL_LIST          3
@@ -323,8 +324,7 @@ void CGUIDialogSelect::OnInitWindow()
   }
   m_viewControl.SetCurrentView(m_useDetails ? CONTROL_DETAILS : CONTROL_LIST);
 
-  CStdString items;
-  items.Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str());
+  CStdString items = StringUtils::Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str());
   SET_CONTROL_LABEL(CONTROL_NUMBEROFFILES, items);
   
   if (m_multiSelection)
index a1ff441..d2dbba4 100644 (file)
@@ -406,7 +406,7 @@ void CGUIDialogSmartPlaylistEditor::OnWindowLoaded()
   for (unsigned int i = 0; i < sizeof(limits) / sizeof(int); i++)
   {
     CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_LIMIT, limits[i]);
-    CStdString label; label.Format(g_localizeStrings.Get(21436).c_str(), limits[i]);
+    CStdString label = StringUtils::Format(g_localizeStrings.Get(21436).c_str(), limits[i]);
     msg.SetLabel(label);
     OnMessage(msg);
   }
index 2ad0c5f..70e12ec 100644 (file)
@@ -31,6 +31,7 @@
 #include "settings/MediaSourceSettings.h"
 #include "storage/MediaManager.h"
 #include "utils/LabelFormatter.h"
+#include "utils/StringUtils.h"
 
 #define CONTROL_FIELD           15
 #define CONTROL_OPERATOR        16
@@ -329,8 +330,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse()
   CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
   pDialog->Reset();
   pDialog->SetItems(&items);
-  CStdString strHeading;
-  strHeading.Format(g_localizeStrings.Get(13401),g_localizeStrings.Get(iLabel));
+  CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(13401).c_str(), g_localizeStrings.Get(iLabel).c_str());
   pDialog->SetHeading(strHeading);
   pDialog->SetMultiSelection(m_rule.m_field != FieldPlaylist && m_rule.m_field != FieldVirtualFolder);
 
index 0e50fa9..56824bd 100644 (file)
@@ -980,7 +980,7 @@ void CEpgInfoTag::UpdatePath(void)
   CStdString path;
   {
     CSingleLock lock(m_critSection);
-    path.Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str());
+    path = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str());
   }
 
   SetPath(path);
index 8606f09..ecd46a7 100644 (file)
@@ -1529,16 +1529,16 @@ CStdString CGUIEPGGridContainer::GetLabel(int info) const
   switch (info)
   {
   case CONTAINER_NUM_PAGES:
-    label.Format("%u", (m_channels + m_channelsPerPage - 1) / m_channelsPerPage);
+    label = StringUtils::Format("%u", (m_channels + m_channelsPerPage - 1) / m_channelsPerPage);
     break;
   case CONTAINER_CURRENT_PAGE:
-    label.Format("%u", 1 + (m_channelCursor + m_channelOffset) / m_channelsPerPage );
+    label = StringUtils::Format("%u", 1 + (m_channelCursor + m_channelOffset) / m_channelsPerPage );
     break;
   case CONTAINER_POSITION:
-    label.Format("%i", 1 + m_channelCursor + m_channelOffset);
+    label = StringUtils::Format("%i", 1 + m_channelCursor + m_channelOffset);
     break;
   case CONTAINER_NUM_ITEMS:
-    label.Format("%u", m_channels);
+    label = StringUtils::Format("%u", m_channels);
     break;
   default:
       break;
index c34a74c..ee858f5 100644 (file)
@@ -32,6 +32,7 @@
 #include "File.h"
 #include "SpecialProtocol.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 
 using namespace ADDON;
@@ -247,7 +248,7 @@ CFileItemPtr CAddonsDirectory::FileItemFromAddon(const AddonPtr &addon, const CS
 
   CStdString strLabel(addon->Name());
   if (url.GetHostName().Equals("search"))
-    strLabel.Format("%s - %s", TranslateType(addon->Type(), true), addon->Name());
+    strLabel = StringUtils::Format("%s - %s", TranslateType(addon->Type(), true).c_str(), addon->Name().c_str());
 
   item->SetLabel(strLabel);
 
@@ -304,8 +305,7 @@ bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItem
     if (plugin->ProvidesSeveral())
     {
       CURL url = item->GetAsUrl();
-      CStdString opt;
-      opt.Format("?content_type=%s",content.c_str());
+      CStdString opt = StringUtils::Format("?content_type=%s",content.c_str());
       url.SetOptions(opt);
       item->SetPath(url.Get());
     }
index 4fba719..86a5409 100644 (file)
@@ -28,6 +28,7 @@
 #include "utils/URIUtils.h"
 #include <vector>
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 
 using namespace XFILE;
@@ -62,8 +63,7 @@ bool CAndroidAppDirectory::GetDirectory(const CStdString& strPath, CFileItemList
         continue;
       CFileItemPtr pItem(new CFileItem(applications[i].packageName));
       pItem->m_bIsFolder = false;
-      CStdString path;
-      path.Format("androidapp://%s/%s/%s", url.GetHostName(), dirname,  applications[i].packageName);
+      CStdString path = StringUtils::Format("androidapp://%s/%s/%s", url.GetHostName().c_str(), dirname.c_str(),  applications[i].packageName.c_str());
       pItem->SetPath(path);
       pItem->SetLabel(applications[i].packageLabel);
       pItem->SetArt("thumb", path+".png");
index ab470fd..e00e4e1 100644 (file)
@@ -21,6 +21,7 @@
 #include "BlurayDirectory.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 #include "DllLibbluray.h"
 #include "FileItem.h"
@@ -59,12 +60,12 @@ CFileItemPtr CBlurayDirectory::GetTitle(const BLURAY_TITLE_INFO* title, const CS
   CStdString buf;
   CFileItemPtr item(new CFileItem("", false));
   CURL path(m_url);
-  buf.Format("BDMV/PLAYLIST/%05d.mpls", title->playlist);
+  buf = StringUtils::Format("BDMV/PLAYLIST/%05d.mpls", title->playlist);
   path.SetFileName(buf);
   item->SetPath(path.Get());
   item->GetVideoInfoTag()->m_duration = (int)(title->duration / 90000);
   item->GetVideoInfoTag()->m_iTrack = title->playlist;
-  buf.Format(label.c_str(), title->playlist);
+  buf = StringUtils::Format(label.c_str(), title->playlist);
   item->m_strTitle = buf;
   item->SetLabel(buf);
   item->m_dwSize = 0;
index 44b6a7c..c8fc383 100644 (file)
@@ -27,6 +27,7 @@
 #include "FileItem.h"
 #include "File.h"
 #include "storage/MediaManager.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE;
 using namespace MEDIA_DETECT;
@@ -70,13 +71,11 @@ bool CCDDADirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
       continue;
 
     // Format standard cdda item label
-    CStdString strLabel;
-    strLabel.Format("Track %02.2i", i);
+    CStdString strLabel = StringUtils::Format("Track %02.2i", i);
 
     CFileItemPtr pItem(new CFileItem(strLabel));
     pItem->m_bIsFolder = false;
-    CStdString path;
-    path.Format("cdda://local/%02.2i.cdda", i);
+    CStdString path = StringUtils::Format("cdda://local/%02.2i.cdda", i);
     pItem->SetPath(path);
 
     struct __stat64 s64;
index b6b8eb1..03a6574 100644 (file)
@@ -1546,9 +1546,7 @@ void CCurlFile::SetRequestHeader(CStdString header, CStdString value)
 
 void CCurlFile::SetRequestHeader(CStdString header, long value)
 {
-  CStdString buffer;
-  buffer.Format("%ld", value);
-  m_requestheaders[header] = buffer;
+  m_requestheaders[header] = StringUtils::Format("%ld", value);
 }
 
 std::string CCurlFile::GetServerReportedCharset(void)
index 36d45de..88ccd06 100644 (file)
@@ -27,6 +27,7 @@
 #include "FileItem.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 
 namespace XFILE
 {
@@ -67,7 +68,7 @@ bool CDAAPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
 
   CStdString host = url.GetHostName();
   if (url.HasPort())
-    host.Format("%s:%i",url.GetHostName(),url.GetPort());
+    host = StringUtils::Format("%s:%i", url.GetHostName().c_str(), url.GetPort());
   m_thisHost = g_DaapClient.GetHost(host);
   if (!m_thisHost)
     return false;
@@ -179,23 +180,23 @@ bool CDAAPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
               CStdString path;
               if( m_thisHost->version_major != 3 )
               {
-                path.Format(REQUEST42,
-                                        m_thisHost->host,
-                                        g_DaapClient.m_iDatabase,
-                                        m_currentSongItems[idx].id,
-                                        m_currentSongItems[idx].songformat,
-                                        m_thisHost->sessionid,
-                                        m_thisHost->revision_number);
+                path = StringUtils::Format(REQUEST42,
+                                           m_thisHost->host,
+                                           g_DaapClient.m_iDatabase,
+                                           m_currentSongItems[idx].id,
+                                           m_currentSongItems[idx].songformat,
+                                           m_thisHost->sessionid,
+                                           m_thisHost->revision_number);
 
               }
               else
               {
-                path.Format(REQUEST45,
-                                        m_thisHost->host,
-                                        g_DaapClient.m_iDatabase,
-                                        m_currentSongItems[idx].id,
-                                        m_currentSongItems[idx].songformat,
-                                        m_thisHost->sessionid);
+                path = StringUtils::Format(REQUEST45,
+                                           m_thisHost->host,
+                                           g_DaapClient.m_iDatabase,
+                                           m_currentSongItems[idx].id,
+                                           m_currentSongItems[idx].songformat,
+                                           m_thisHost->sessionid);
               }
 
               pItem->SetPath(path);
@@ -267,23 +268,23 @@ bool CDAAPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
             CStdString path;
             if( m_thisHost->version_major != 3 )
             {
-              path.Format(REQUEST42,
-                                      m_thisHost->host,
-                                      g_DaapClient.m_iDatabase,
-                                      m_currentSongItems[c].id,
-                                      m_currentSongItems[c].songformat,
-                                      m_thisHost->sessionid,
-                                      m_thisHost->revision_number);
+              path = StringUtils::Format(REQUEST42,
+                                         m_thisHost->host,
+                                         g_DaapClient.m_iDatabase,
+                                         m_currentSongItems[c].id,
+                                         m_currentSongItems[c].songformat,
+                                         m_thisHost->sessionid,
+                                         m_thisHost->revision_number);
 
             }
             else
             {
-              path.Format(REQUEST45,
-                                      m_thisHost->host,
-                                      g_DaapClient.m_iDatabase,
-                                      m_currentSongItems[c].id,
-                                      m_currentSongItems[c].songformat,
-                                      m_thisHost->sessionid);
+              path = StringUtils::Format(REQUEST45,
+                                         m_thisHost->host,
+                                         g_DaapClient.m_iDatabase,
+                                         m_currentSongItems[c].id,
+                                         m_currentSongItems[c].songformat,
+                                         m_thisHost->sessionid);
             }
 
             pItem->SetPath(path);
index d38a4da..98d41d3 100644 (file)
@@ -24,6 +24,7 @@
 #include "DAAPFile.h"
 #include "threads/SingleLock.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include <sys/stat.h>
 
 #include "lib/libXDAAP/private.h"
@@ -169,7 +170,7 @@ bool CDAAPFile::Open(const CURL& url)
   CLog::Log(LOGDEBUG, "CDAAPFile::Open(%s)", url.GetFileName().c_str());
   CStdString host = url.GetHostName();
   if (url.HasPort())
-    host.Format("%s:%i",url.GetHostName(),url.GetPort());
+    host = StringUtils::Format("%s:%i", url.GetHostName().c_str(), url.GetPort());
   m_thisHost = g_DaapClient.GetHost(host);
   if (!m_thisHost)
     return false;
index 155246f..540feaa 100644 (file)
@@ -190,18 +190,18 @@ CStdString CFavouritesDirectory::GetExecutePath(const CFileItem &item, const std
                             !(item.IsSmartPlayList() || item.IsPlayList())))
   {
     if (!contextWindow.empty())
-      execute.Format("ActivateWindow(%s,%s,return)", contextWindow.c_str(), StringUtils::Paramify(item.GetPath()).c_str());
+      execute = StringUtils::Format("ActivateWindow(%s,%s,return)", contextWindow.c_str(), StringUtils::Paramify(item.GetPath()).c_str());
   }
   else if (item.IsScript())
-    execute.Format("RunScript(%s)", StringUtils::Paramify(item.GetPath().Mid(9)).c_str());
+    execute = StringUtils::Format("RunScript(%s)", StringUtils::Paramify(item.GetPath().Mid(9)).c_str());
   else if (item.IsAndroidApp())
-    execute.Format("StartAndroidActivity(%s)", StringUtils::Paramify(item.GetPath().Mid(26)).c_str());
+    execute = StringUtils::Format("StartAndroidActivity(%s)", StringUtils::Paramify(item.GetPath().Mid(26)).c_str());
   else  // assume a media file
   {
     if (item.IsVideoDb() && item.HasVideoInfoTag())
-      execute.Format("PlayMedia(%s)", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath).c_str());
+      execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath).c_str());
     else
-      execute.Format("PlayMedia(%s)", StringUtils::Paramify(item.GetPath()).c_str());
+      execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetPath()).c_str());
   }
   return execute;
 }
index f483d3e..1babcf1 100644 (file)
@@ -186,10 +186,9 @@ IFileDirectory* CFileDirectoryFactory::Create(const CStdString& strPath, CFileIt
         // need this crap to avoid making mistakes - yeyh for the new rar naming scheme :/
         struct __stat64 stat;
         int digits = token.size()-4;
-        CStdString strNumber, strFormat;
-        strFormat.Format("part%%0%ii",digits);
-        strNumber.Format(strFormat.c_str(),1);
-        CStdString strPath2=strPath;
+        CStdString strFormat = StringUtils::Format("part%%0%ii", digits);
+        CStdString strNumber = StringUtils::Format(strFormat.c_str(), 1);
+        CStdString strPath2 = strPath;
         strPath2.Replace(token,strNumber);
         if (atoi(token.substr(4).c_str()) > 1 && CFile::Stat(strPath2,&stat) == 0)
         {
index f96df8a..83da54a 100644 (file)
@@ -22,6 +22,7 @@
 #include "URL.h"
 #include "FileItem.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "DllHDHomeRun.h"
 
 using namespace XFILE;
@@ -61,12 +62,11 @@ bool CHomeRunDirectory::GetDirectory(const CStdString& strPath, CFileItemList &i
 
     for(int i=0;i<count;i++)
     {
-      CStdString device, ip;
       CFileItemPtr item;
       unsigned int ip_addr = result_list[i].ip_addr;
 
-      device.Format("%x", result_list[i].device_id);
-      ip.Format("%u.%u.%u.%u",
+      CStdString device = StringUtils::Format("%x", result_list[i].device_id);
+      CStdString ip = StringUtils::Format("%u.%u.%u.%u",
             (unsigned int)(ip_addr >> 24) & 0xFF, (unsigned int)(ip_addr >> 16) & 0xFF,
             (unsigned int)(ip_addr >> 8) & 0xFF, (unsigned int)(ip_addr >> 0) & 0xFF);
 
@@ -99,9 +99,9 @@ bool CHomeRunDirectory::GetDirectory(const CStdString& strPath, CFileItemList &i
 
     CStdString label;
     if(status.signal_present)
-      label.Format("Current Stream: N/A");
+      label = StringUtils::Format("Current Stream: N/A");
     else
-      label.Format("Current Stream: Channel %s, SNR %d", status.channel, status.signal_to_noise_quality);
+      label = StringUtils::Format("Current Stream: Channel %s, SNR %d", status.channel, status.signal_to_noise_quality);
 
     CStdString path = "hdhomerun://" + url.GetHostName() + "/" + url.GetFileName();
     URIUtils::RemoveSlashAtEnd(path);
index 75f79b5..524be38 100644 (file)
@@ -28,6 +28,7 @@
 #include "threads/SingleLock.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 
 extern "C" {
 #include "libhts/htsmsg.h"
@@ -386,7 +387,7 @@ bool CHTSPDirectory::GetChannels( const CURL &base
     CHTSPSession::ParseItem(it->second, tag, event, *item);
     item->m_bIsFolder = false;
     item->SetLabel(item->m_strTitle);
-    item->m_strTitle.Format("%d", it->second.num);
+    item->m_strTitle = StringUtils::Format("%d", it->second.num);
 
     items.Add(item);
   }
@@ -439,8 +440,8 @@ bool CHTSPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
     CStdString filename, label;
     for(STags::iterator it = tags.begin(); it != tags.end(); it++)
     {
-      filename.Format("tags/%d/", it->second.id);
-      label.Format("Tag: %s", it->second.name);
+      filename = StringUtils::Format("tags/%d/", it->second.id);
+      label = StringUtils::Format("Tag: %s", it->second.name.c_str());
 
       item.reset(new CFileItem("", true));
       url.SetFileName(filename);
index 01d44be..84292b7 100644 (file)
@@ -621,10 +621,8 @@ bool CHTSPSession::ParseItem(const SChannel& channel, int tagid, const SEvent& e
 {
   CVideoInfoTag* tag = item.GetVideoInfoTag();
 
-  CStdString temp;
-
   CURL url(item.GetPath());
-  temp.Format("tags/%d/%d.ts", tagid, channel.id);
+  CStdString temp = StringUtils::Format("tags/%d/%d.ts", tagid, channel.id);
   url.SetFileName(temp);
 
   tag->m_iSeason  = 0;
index 514b385..c4faeda 100644 (file)
@@ -22,6 +22,7 @@
 #include "iso9660.h"
 #include "Util.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 #include "FileItem.h"
 
@@ -53,7 +54,7 @@ bool CISO9660Directory::GetDirectory(const CStdString& strPath, CFileItemList &i
   CStdString strDirectory = url.GetFileName();
   if (strDirectory != "")
   {
-    strSearchMask.Format("\\%s", strDirectory.c_str());
+    strSearchMask = StringUtils::Format("\\%s", strDirectory.c_str());
   }
   else
   {
index 316b518..67e2bd7 100644 (file)
@@ -127,8 +127,7 @@ void CMusicDatabaseDirectory::ClearDirectoryCache(const CStdString& strDirectory
   Crc32 crc;
   crc.ComputeFromLowerCase(path);
 
-  CStdString strFileName;
-  strFileName.Format("special://temp/%08x.fi", (unsigned __int32) crc);
+  CStdString strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc);
   CFile::Delete(strFileName);
 }
 
index e39fca7..5fc75d7 100644 (file)
@@ -21,6 +21,7 @@
 #include "DirectoryNodeAlbumRecentlyAdded.h"
 #include "music/MusicDatabase.h"
 #include "FileItem.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE::MUSICDATABASEDIRECTORY;
 
@@ -64,8 +65,7 @@ bool CDirectoryNodeAlbumRecentlyAdded::GetContent(CFileItemList& items) const
   for (int i=0; i<(int)albums.size(); ++i)
   {
     CAlbum& album=albums[i];
-    CStdString strDir;
-    strDir.Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
+    CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
     CFileItemPtr pItem(new CFileItem(strDir, album));
     items.Add(pItem);
   }
index 8d9a706..80b6ae4 100644 (file)
@@ -21,6 +21,7 @@
 #include "DirectoryNodeAlbumRecentlyPlayed.h"
 #include "music/MusicDatabase.h"
 #include "FileItem.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE::MUSICDATABASEDIRECTORY;
 
@@ -64,8 +65,7 @@ bool CDirectoryNodeAlbumRecentlyPlayed::GetContent(CFileItemList& items) const
   for (int i=0; i<(int)albums.size(); ++i)
   {
     CAlbum& album=albums[i];
-    CStdString strDir;
-    strDir.Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
+    CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
     CFileItemPtr pItem(new CFileItem(strDir, album));
     items.Add(pItem);
   }
index c64353a..003f492 100644 (file)
@@ -21,6 +21,7 @@
 #include "DirectoryNodeAlbumTop100.h"
 #include "music/MusicDatabase.h"
 #include "FileItem.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE::MUSICDATABASEDIRECTORY;
 
@@ -62,8 +63,7 @@ bool CDirectoryNodeAlbumTop100::GetContent(CFileItemList& items) const
   for (int i=0; i<(int)albums.size(); ++i)
   {
     CAlbum& album=albums[i];
-    CStdString strDir;
-    strDir.Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
+    CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
     CFileItemPtr pItem(new CFileItem(strDir, album));
     items.Add(pItem);
   }
index 370e244..600f6d9 100644 (file)
@@ -22,6 +22,7 @@
 #include "FileItem.h"
 #include "music/MusicDatabase.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 namespace XFILE
 {
@@ -86,8 +87,7 @@ bool CDirectoryNodeOverview::GetContent(CFileItemList& items) const
       continue;
 
     CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(OverviewChildren[i].label)));
-    CStdString strDir;
-    strDir.Format("%s/", OverviewChildren[i].id);
+    CStdString strDir = StringUtils::Format("%s/", OverviewChildren[i].id.c_str());
     pItem->SetPath(BuildPath() + strDir);
     pItem->m_bIsFolder = true;
     pItem->SetCanQueue(false);
index 3c6e17c..0499832 100644 (file)
@@ -21,6 +21,7 @@
 #include "DirectoryNodeTop100.h"
 #include "FileItem.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 using namespace XFILE::MUSICDATABASEDIRECTORY;
@@ -58,8 +59,7 @@ bool CDirectoryNodeTop100::GetContent(CFileItemList& items) const
   for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i)
   {
     CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(Top100Children[i].label)));
-    CStdString strDir;
-    strDir.Format("%s/", Top100Children[i].id);
+    CStdString strDir = StringUtils::Format("%s/", Top100Children[i].id.c_str());
     pItem->SetPath(BuildPath() + strDir);
     pItem->m_bIsFolder = true;
     items.Add(pItem);
index 02b1480..9a8001c 100644 (file)
@@ -22,6 +22,7 @@
 #include "FileItem.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 
 using namespace MUSIC_INFO;
 using namespace XFILE;
@@ -48,10 +49,9 @@ bool CMusicFileDirectory::GetDirectory(const CStdString& strPath1, CFileItemList
 
   for (int i=0; i<iStreams; ++i)
   {
-    CStdString strLabel;
-    strLabel.Format("%s - %s %02.2i", strFileName.c_str(),g_localizeStrings.Get(554).c_str(),i+1);
+    CStdString strLabel = StringUtils::Format("%s - %s %02.2i", strFileName.c_str(), g_localizeStrings.Get(554).c_str(), i+1);
     CFileItemPtr pItem(new CFileItem(strLabel));
-    strLabel.Format("%s%s-%i.%s", strPath.c_str(),strFileName.c_str(),i+1,m_strExt.c_str());
+    strLabel = StringUtils::Format("%s%s-%i.%s", strPath.c_str(), strFileName.c_str(), i+1, m_strExt.c_str());
     pItem->SetPath(strLabel);
 
     if (m_tag.Loaded())
index f83bf63..566950a 100644 (file)
@@ -129,8 +129,7 @@ bool CMythDirectory::GetGuide(const CStdString& base, CFileItemList &items)
 
       CLog::Log(LOGDEBUG, "%s - Adding channel number %d: %s", __FUNCTION__, channum, name.c_str());
 
-      CStdString number;
-      number.Format("%d", channum); // CStdString easier for string manipulation than int.
+      CStdString number = StringUtils::Format("%d", channum); // CStdString easier for string manipulation than int.
       url.SetFileName("guide/" + number);
       CFileItemPtr item(new CFileItem(url.Get(), true));
       item->m_strTitle = number;
@@ -190,7 +189,9 @@ bool CMythDirectory::GetGuideForChannel(const CStdString& base, CFileItemList &i
       CDateTime localstart;
       if (program[i].starttime)
         localstart = CTimeUtils::GetLocalTime(program[i].starttime);
-      item->m_strTitle.Format("%s - %s", localstart.GetAsLocalizedTime("HH:mm", false), title); // e.g. 20:30 - Mythbusters
+      item->m_strTitle = StringUtils::Format("%s - %s",
+                                             localstart.GetAsLocalizedTime("HH:mm", false).c_str(),
+                                             title.c_str()); // e.g. 20:30 - Mythbusters
       if (!subtitle.IsEmpty())
         item->m_strTitle     += " - \"" + subtitle + "\""; // e.g. 20:30 - Mythbusters - "The Pirate Special"
       item->m_dateTime        = localstart;
index aba0542..ba8309a 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "PipesManager.h"
 #include "threads/SingleLock.h"
+#include "utils/StringUtils.h"
 
 #ifndef min
 #define min(a,b) ((a) < (b) ? (a) : (b))
@@ -283,9 +284,7 @@ PipesManager &PipesManager::GetInstance()
 CStdString   PipesManager::GetUniquePipeName()
 {
   CSingleLock lock(m_lock);
-  CStdString id;
-  id.Format("pipe://%d/",m_nGenIdHelper++);
-  return id;
+  return StringUtils::Format("pipe://%d/", m_nGenIdHelper++);
 }
 
 XFILE::Pipe *PipesManager::CreatePipe(const CStdString &name, int nMaxPipeSize)
index 6c95b3d..2040c28 100644 (file)
@@ -36,6 +36,7 @@
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 #include "ApplicationMessenger.h"
 #include "Application.h"
 #include "URL.h"
@@ -118,8 +119,7 @@ bool CPluginDirectory::StartScript(const CStdString& strPath, bool retrievingDir
   m_totalItems = 0;
 
   // setup our parameters to send the script
-  CStdString strHandle;
-  strHandle.Format("%i", handle);
+  CStdString strHandle = StringUtils::Format("%i", handle);
   vector<string> argv;
   argv.push_back(basePath);
   argv.push_back(strHandle);
@@ -438,8 +438,7 @@ bool CPluginDirectory::RunScriptWithParams(const CStdString& strPath)
   CStdString basePath(url.Get());
 
   // setup our parameters to send the script
-  CStdString strHandle;
-  strHandle.Format("%i", -1);
+  CStdString strHandle = StringUtils::Format("%i", -1);
   vector<string> argv;
   argv.push_back(basePath);
   argv.push_back(strHandle);
index 2549b22..4069fba 100644 (file)
@@ -30,6 +30,7 @@
 #include "threads/SingleLock.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 #if defined(TARGET_DARWIN)
 #include "osx/OSXGNUReplacements.h" // strnlen
@@ -363,10 +364,9 @@ bool CSAPSessions::ParseAnnounce(char* data, int len)
   }
 
   // add a new session to our buffer
-  CStdString path, user;
-  user = origin.username;
+  CStdString user = origin.username;
   CURL::Encode(user);
-  path.Format("sap://%s/%s/0x%x.sdp", header.origin.c_str(), desc.origin.c_str(), header.msgid);
+  CStdString path = StringUtils::Format("sap://%s/%s/0x%x.sdp", header.origin.c_str(), desc.origin.c_str(), header.msgid);
   CSession session;
   session.path           = path;
   session.origin         = header.origin;
index 1b7f4c7..1624238 100644 (file)
@@ -293,7 +293,7 @@ int CSMBDirectory::OpenDir(const CURL& url, CStdString& strAuth)
     }
 
     if (nt_error == NT_STATUS_OBJECT_NAME_NOT_FOUND)
-      cError.Format(g_localizeStrings.Get(770).c_str(),nt_error);
+      cError = StringUtils::Format(g_localizeStrings.Get(770).c_str(),nt_error);
     else
       cError = get_friendly_nt_error_msg(nt_error);
 
@@ -307,7 +307,7 @@ int CSMBDirectory::OpenDir(const CURL& url, CStdString& strAuth)
     }
 
     if (errno == ENODEV || errno == ENOENT)
-      cError.Format(g_localizeStrings.Get(770).c_str(),errno);
+      cError = StringUtils::Format(g_localizeStrings.Get(770).c_str(),errno);
     else
       cError = strerror(errno);
 
index ae39a2f..0332cec 100644 (file)
@@ -25,6 +25,7 @@
 #include "profiles/ProfilesManager.h"
 #include "utils/log.h"
 #include "utils/XMLUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 
 using namespace XFILE;
@@ -429,8 +430,7 @@ bool CSlingboxFile::SelectChannel(unsigned int uiChannel)
   else if (uiButtonsWithCode == 10)
   {
     // Prepare variables
-    CStdString strDigits;
-    strDigits.Format("%u", uiChannel);
+    CStdString strDigits = StringUtils::Format("%u", uiChannel);
     unsigned int uiNumberOfDigits = strDigits.GetLength();
 
     // Change the channel using IR commands
index fc7160b..ac3bbed 100644 (file)
@@ -29,6 +29,7 @@
 #include "FileItem.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE;
 
@@ -76,8 +77,7 @@ bool CTuxBoxDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
       bIsBouquet = false; //On Empty is Bouquet
       if (enigma2)
       {
-        CStdString strPort;
-        strPort.Format(":%i",url.GetPort());
+        CStdString strPort = StringUtils::Format(":%i",url.GetPort());
         if (strRoot.Right(strPort.GetLength()) != strPort) // If not root dir, enable Channels
           strFilter = "e2"; // Disable Bouquets for Enigma2
 
@@ -189,8 +189,8 @@ void CTuxBoxDirectory::GetRootAndChildStringEnigma2(CStdString& strBQRequest, CS
 {
   // Allways take getallservices for Enigma2
   strBQRequest = "web/getallservices"; //Bouquets and Channels
-  strXMLRootString.Format("e2servicelistrecursive");
-  strXMLChildString.Format("e2bouquet");
+  strXMLRootString = StringUtils::Format("e2servicelistrecursive");
+  strXMLChildString = StringUtils::Format("e2bouquet");
 }
 
 bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString )
@@ -200,8 +200,8 @@ bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdStrin
   {
     CLog::Log(LOGDEBUG, "%s - Default defined RootMenu : (3) Movies", __FUNCTION__);
     strBQRequest = "xml/services?mode=3&submode=4";
-    strXMLRootString.Format("movies");
-    strXMLChildString.Format("service");
+    strXMLRootString = StringUtils::Format("movies");
+    strXMLChildString = StringUtils::Format("service");
   }
   else if(g_advancedSettings.m_iTuxBoxDefaultRootMenu <= 0 || g_advancedSettings.m_iTuxBoxDefaultRootMenu == 1 ||
     g_advancedSettings.m_iTuxBoxDefaultRootMenu > 4 )
@@ -232,8 +232,8 @@ bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdStrin
         if(strBQRequest.IsEmpty())
         {
           strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
-          strXMLRootString.Format("bouquets");
-          strXMLChildString.Format("bouquet");
+          strXMLRootString = StringUtils::Format("bouquets");
+          strXMLChildString = StringUtils::Format("bouquet");
         }
       }
     }
@@ -244,29 +244,29 @@ bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdStrin
       {
         CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (1) Services", __FUNCTION__);
         strBQRequest = "xml/services?mode=0&submode=1"; //Services
-        strXMLRootString.Format("services");
-        strXMLChildString.Format("service");
+        strXMLRootString = StringUtils::Format("services");
+        strXMLChildString = StringUtils::Format("service");
       }
       else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 2)
       {
         CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (2) Satellites", __FUNCTION__);
         strBQRequest = "xml/services?mode=0&submode=2"; //Satellites
-        strXMLRootString.Format("satellites");
-        strXMLChildString.Format("satellite");
+        strXMLRootString = StringUtils::Format("satellites");
+        strXMLChildString = StringUtils::Format("satellite");
       }
       else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 3)
       {
         CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (3) Providers", __FUNCTION__);
         strBQRequest = "xml/services?mode=0&submode=3"; //Providers
-        strXMLRootString.Format("providers");
-        strXMLChildString.Format("provider");
+        strXMLRootString = StringUtils::Format("providers");
+        strXMLChildString = StringUtils::Format("provider");
       }
       else
       {
         CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (4) Bouquets", __FUNCTION__);
         strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
-        strXMLRootString.Format("bouquets");
-        strXMLChildString.Format("bouquet");
+        strXMLRootString = StringUtils::Format("bouquets");
+        strXMLChildString = StringUtils::Format("bouquet");
       }
     }
   }
index 01e915a..ecab63f 100644 (file)
@@ -22,6 +22,7 @@
 #include "VTPSession.h"
 #include "URL.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "FileItem.h"
 
 
@@ -47,13 +48,12 @@ bool CVTPDirectory::GetChannels(const CStdString& base, CFileItemList &items)
   vector<CVTPSession::Channel>::iterator it;
   for(it = channels.begin(); it != channels.end(); it++)
   {
-    CStdString buffer;
     CFileItemPtr item(new CFileItem("", false));
 
-    buffer.Format("%s/%d.ts", base.c_str(), it->index);
+    CStdString buffer = StringUtils::Format("%s/%d.ts", base.c_str(), it->index);
     item->SetPath(buffer);
     item->m_strTitle = it->name;
-    buffer.Format("%d - %s", it->index, it->name);
+    buffer = StringUtils::Format("%d - %s", it->index, it->name.c_str());
     item->SetLabel(buffer);
 
     items.Add(item);
index be42cba..ece3d1a 100644 (file)
@@ -127,8 +127,7 @@ void CVideoDatabaseDirectory::ClearDirectoryCache(const CStdString& strDirectory
   Crc32 crc;
   crc.ComputeFromLowerCase(path);
 
-  CStdString strFileName;
-  strFileName.Format("special://temp/%08x.fi", (unsigned __int32) crc);
+  CStdString strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc);
   CFile::Delete(strFileName);
 }
 
@@ -175,8 +174,7 @@ bool CVideoDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdStrin
   // get year
   if (params.GetYear() != -1)
   {
-    CStdString strTemp;
-    strTemp.Format("%i",params.GetYear());
+    CStdString strTemp = StringUtils::Format("%i",params.GetYear());
     if (!strLabel.IsEmpty())
       strLabel += " / ";
     strLabel += strTemp;
index 7e4ae39..0dd6399 100644 (file)
@@ -23,6 +23,7 @@
 #include "guilib/LocalizeStrings.h"
 #include "video/VideoDatabase.h"
 #include "video/VideoDbUrl.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE::VIDEODATABASEDIRECTORY;
 using namespace std;
@@ -78,7 +79,7 @@ bool CDirectoryNodeMoviesOverview::GetContent(CFileItemList& items) const
     }
 
     CVideoDbUrl itemUrl = videoUrl;
-    CStdString strDir; strDir.Format("%s/", MovieChildren[i].id);
+    CStdString strDir = StringUtils::Format("%s/", MovieChildren[i].id.c_str());
     itemUrl.AppendPath(strDir);
 
     CFileItemPtr pItem(new CFileItem(itemUrl.ToString(), true));
index 28000bb..5d2f133 100644 (file)
@@ -22,6 +22,7 @@
 #include "FileItem.h"
 #include "guilib/LocalizeStrings.h"
 #include "video/VideoDbUrl.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE::VIDEODATABASEDIRECTORY;
 
@@ -70,7 +71,7 @@ bool CDirectoryNodeMusicVideosOverview::GetContent(CFileItemList& items) const
     CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(MusicVideoChildren[i].label)));
 
     CVideoDbUrl itemUrl = videoUrl;
-    CStdString strDir; strDir.Format("%s/", MusicVideoChildren[i].id);
+    CStdString strDir = StringUtils::Format("%s/", MusicVideoChildren[i].id.c_str());
     itemUrl.AppendPath(strDir);
     pItem->SetPath(itemUrl.ToString());
 
index f6c91ac..70ec722 100644 (file)
@@ -26,6 +26,7 @@
 #include "settings/Settings.h"
 #include "FileItem.h"
 #include "utils/Variant.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE::VIDEODATABASEDIRECTORY;
 
@@ -56,8 +57,7 @@ CStdString CDirectoryNodeSeasons::GetLocalizedName() const
     return "";
   }
   default:
-    CStdString season;
-    season.Format(g_localizeStrings.Get(20358), GetID()); // Season <season>
+    CStdString season = StringUtils::Format(g_localizeStrings.Get(20358), GetID()); // Season <season>
     return season;
   }
 }
index 7498985..6e5e4ec 100644 (file)
@@ -22,6 +22,7 @@
 #include "FileItem.h"
 #include "guilib/LocalizeStrings.h"
 #include "video/VideoDbUrl.h"
+#include "utils/StringUtils.h"
 
 using namespace XFILE::VIDEODATABASEDIRECTORY;
 
@@ -71,7 +72,7 @@ bool CDirectoryNodeTvShowsOverview::GetContent(CFileItemList& items) const
     CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(TvShowChildren[i].label)));
 
     CVideoDbUrl itemUrl = videoUrl;
-    CStdString strDir; strDir.Format("%s/", TvShowChildren[i].id);
+    CStdString strDir = StringUtils::Format("%s/", TvShowChildren[i].id.c_str());
     itemUrl.AppendPath(strDir);
     pItem->SetPath(itemUrl.ToString());
 
index c8731cc..5a5f66d 100644 (file)
@@ -153,7 +153,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha
 
 #ifdef _DEBUG_OUTPUT
   CStdString strTmp;
-  strTmp.Format("******************   Adding dir : %s\r", path);
+  strTmp = StringUtils::Format("******************   Adding dir : %s\r", path);
   OutputDebugString( strTmp.c_str() );
 #endif
 
@@ -323,7 +323,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha
           strcpy( pFile_Pointer->name , temp_text.c_str());
 #ifdef _DEBUG_OUTPUT
           //CStdString strTmp;
-          //strTmp.Format("adding sector : %X, File : %s     size = %u     pos = %x\r",sector,temp_text.c_str(), isodir.dwFileLengthLE, isodir.dwFileLocationLE );
+          //strTmp = StringUtils::Format("adding sector : %X, File : %s     size = %u     pos = %x\r",sector,temp_text.c_str(), isodir.dwFileLengthLE, isodir.dwFileLocationLE );
           //OutputDebugString( strTmp.c_str());
 #endif
 
@@ -417,7 +417,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha
           DWORD dwFileLocation = from_733(isodir.extent);
 #ifdef _DEBUG_OUTPUT
           CStdString strTmp;
-          strTmp.Format("adding directory sector : %X, File : %s     size = %u     pos = %x\r", sector, temp_text.c_str(), from_733(isodir.size), dwFileLocation );
+          strTmp = StringUtils::Format("adding directory sector : %X, File : %s     size = %u     pos = %x\r", sector, temp_text.c_str(), from_733(isodir.size), dwFileLocation );
           OutputDebugString( strTmp.c_str());
 #endif
 
index 3b96384..7327a13 100644 (file)
@@ -88,12 +88,12 @@ TEST_F(TestFileFactory, Read)
     std::cout << "File contents:" << std::endl;
     while ((size = file.Read(buf, sizeof(buf))) > 0)
     {
-      str.Format("  %08X", count);
+      str = StringUtils::Format("  %08X", count);
       std::cout << str << "  ";
       count += size;
       for (i = 0; i < size; i++)
       {
-        str.Format("%02X ", buf[i]);
+        str = StringUtils::Format("%02X ", buf[i]);
         std::cout << str;
       }
       while (i++ < sizeof(buf))
@@ -150,12 +150,12 @@ TEST_F(TestFileFactory, Write)
     std::cout << "File contents:\n";
     while ((size = file.Read(buf, sizeof(buf))) > 0)
     {
-      str.Format("  %08X", count);
+      str = StringUtils::Format("  %08X", count);
       std::cout << str << "  ";
       count += size;
       for (i = 0; i < size; i++)
       {
-        str.Format("%02X ", buf[i]);
+        str = StringUtils::Format("%02X ", buf[i]);
         std::cout << str;
       }
       while (i++ < sizeof(buf))
index 14e109e..1e8717f 100644 (file)
@@ -166,12 +166,12 @@ TEST(TestRarFile, CorruptedFile)
   std::cout << "File contents:" << std::endl;
   while ((size = file->Read(buf, sizeof(buf))) > 0)
   {
-    str.Format("  %08X", count);
+    str = StringUtils::Format("  %08X", count);
     std::cout << str << "  ";
     count += size;
     for (i = 0; i < size; i++)
     {
-      str.Format("%02X ", buf[i]);
+      str = StringUtils::Format("%02X ", buf[i]);
       std::cout << str;
     }
     while (i++ < sizeof(buf))
index 20c5c7c..28c1633 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "filesystem/Directory.h"
 #include "filesystem/File.h"
+#include "utils/StringUtils.h"
 #include "utils/URIUtils.h"
 #include "FileItem.h"
 #include "settings/Settings.h"
@@ -189,12 +190,12 @@ TEST_F(TestZipFile, CorruptedFile)
   std::cout << "File contents:" << std::endl;
   while ((size = file->Read(buf, sizeof(buf))) > 0)
   {
-    str.Format("  %08X", count);
+    str = StringUtils::Format("  %08X", count);
     std::cout << str << "  ";
     count += size;
     for (i = 0; i < size; i++)
     {
-      str.Format("%02X ", buf[i]);
+      str = StringUtils::Format("%02X ", buf[i]);
       std::cout << str;
     }
     while (i++ < sizeof(buf))
index 26b7694..8fcbf07 100644 (file)
@@ -81,8 +81,7 @@ int CGUIAction::GetNavigation() const
 void CGUIAction::SetNavigation(int id)
 {
   if (id == 0) return;
-  CStdString strId;
-  strId.Format("%i", id);
+  CStdString strId = StringUtils::Format("%i", id);
   for (iActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (StringUtils::IsInteger(it->action) && it->condition.IsEmpty())
index 2649442..159036f 100644 (file)
@@ -528,7 +528,7 @@ void CGUIBaseContainer::OnJumpLetter(char letter, bool skip /*=false*/)
   if (m_matchTimer.GetElapsedMilliseconds() < letter_match_timeout)
     m_match.push_back(letter);
   else
-    m_match.Format("%c", letter);
+    m_match = StringUtils::Format("%c", letter);
 
   m_matchTimer.StartZero();
 
@@ -741,7 +741,7 @@ CStdString CGUIBaseContainer::GetDescription() const
   {
     CGUIListItemPtr pItem = m_items[item];
     if (pItem->m_bIsFolder)
-      strLabel.Format("[%s]", pItem->GetLabel().c_str());
+      strLabel = StringUtils::Format("[%s]", pItem->GetLabel().c_str());
     else
       strLabel = pItem->GetLabel();
   }
@@ -1148,21 +1148,21 @@ CStdString CGUIBaseContainer::GetLabel(int info) const
   switch (info)
   {
   case CONTAINER_NUM_PAGES:
-    label.Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
+    label = StringUtils::Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
     break;
   case CONTAINER_CURRENT_PAGE:
-    label.Format("%u", GetCurrentPage());
+    label = StringUtils::Format("%u", GetCurrentPage());
     break;
   case CONTAINER_POSITION:
-    label.Format("%i", GetCursor());
+    label = StringUtils::Format("%i", GetCursor());
     break;
   case CONTAINER_NUM_ITEMS:
     {
       unsigned int numItems = GetNumItems();
       if (numItems && m_items[0]->IsFileItem() && (boost::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder())
-        label.Format("%u", numItems-1);
+        label = StringUtils::Format("%u", numItems-1);
       else
-        label.Format("%u", numItems);
+        label = StringUtils::Format("%u", numItems);
     }
     break;
   default:
index 3898a1b..47cf8d8 100644 (file)
@@ -591,8 +591,7 @@ void CGUIControlFactory::GetInfoLabels(const TiXmlNode *pControlNode, const CStd
   int labelNumber = 0;
   if (XMLUtils::GetInt(pControlNode, "number", labelNumber))
   {
-    CStdString label;
-    label.Format("%i", labelNumber);
+    CStdString label = StringUtils::Format("%i", labelNumber);
     infoLabels.push_back(CGUIInfoLabel(label));
     return; // done
   }
@@ -615,8 +614,7 @@ void CGUIControlFactory::GetInfoLabels(const TiXmlNode *pControlNode, const CStd
     {
       if (infoNode->FirstChild())
       {
-        CStdString info;
-        info.Format("$INFO[%s]", infoNode->FirstChild()->Value());
+        CStdString info = StringUtils::Format("$INFO[%s]", infoNode->FirstChild()->Value());
         infoLabels.push_back(CGUIInfoLabel(info, fallback, parentID));
       }
       infoNode = infoNode->NextSibling("info");
index e081bb8..01acec3 100644 (file)
@@ -21,6 +21,7 @@
 #include "GUIControlProfiler.h"
 #include "utils/XBMCTinyXML.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 
 bool CGUIControlProfiler::m_bIsRunning = false;
 
@@ -163,16 +164,14 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent)
     xmlControl->SetAttribute("type", lpszType);
   if (m_controlID != 0)
   {
-    CStdString str;
-    str.Format("%u", m_controlID);
+    CStdString str = StringUtils::Format("%u", m_controlID);
     xmlControl->SetAttribute("id", str.c_str());
   }
 
   float pct = (float)GetTotalTime() / (float)m_pProfiler->GetTotalTime();
   if (pct > 0.01f)
   {
-    CStdString str;
-    str.Format("%.0f", pct * 100.0f);
+    CStdString str = StringUtils::Format("%.0f", pct * 100.0f);
     xmlControl->SetAttribute("percent", str.c_str());
   }
 
@@ -192,13 +191,13 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent)
     CStdString val;
     TiXmlElement *elem = new TiXmlElement("rendertime");
     xmlControl->LinkEndChild(elem);
-    val.Format("%u", rend);
+    val = StringUtils::Format("%u", rend);
     TiXmlText *text = new TiXmlText(val.c_str());
     elem->LinkEndChild(text);
 
     elem = new TiXmlElement("visibletime");
     xmlControl->LinkEndChild(elem);
-    val.Format("%u", vis);
+    val = StringUtils::Format("%u", vis);
     text = new TiXmlText(val.c_str());
     elem->LinkEndChild(text);
   }
@@ -344,8 +343,7 @@ bool CGUIControlProfiler::SaveResults(void)
   doc.InsertEndChild(decl);
 
   TiXmlElement *root = new TiXmlElement("guicontrolprofiler");
-  CStdString str;
-  str.Format("%d", m_iFrameCount);
+  CStdString str = StringUtils::Format("%d", m_iFrameCount);
   root->SetAttribute("framecount", str.c_str());
   root->SetAttribute("timeunit", "ms");
   doc.LinkEndChild(root);
index a0f62d3..7b39190 100644 (file)
@@ -126,8 +126,7 @@ CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdStrin
     CheckFont(strPath,"special://xbmc/media/Fonts",file);
 
   // check if we already have this font file loaded (font object could differ only by color or style)
-  CStdString TTFfontName;
-  TTFfontName.Format("%s_%f_%f%s", strFilename, newSize, aspect, border ? "_border" : "");
+  CStdString TTFfontName = StringUtils::Format("%s_%f_%f%s", strFilename.c_str(), newSize, aspect, border ? "_border" : "");
 
   CGUIFontTTFBase* pFontFile = GetFontFile(TTFfontName);
   if (!pFontFile)
@@ -220,8 +219,7 @@ void GUIFontManager::ReloadTTFFonts(void)
 
     RescaleFontSizeAndAspect(&newSize, &aspect, fontInfo.sourceRes, fontInfo.preserveAspect);
 
-    CStdString TTFfontName;
-    TTFfontName.Format("%s_%f_%f%s", strFilename, newSize, aspect, fontInfo.border ? "_border" : "");
+    CStdString TTFfontName = StringUtils::Format("%s_%f_%f%s", strFilename.c_str(), newSize, aspect, fontInfo.border ? "_border" : "");
     CGUIFontTTFBase* pFontFile = GetFontFile(TTFfontName);
     if (!pFontFile)
     {
index 42f1d07..64b734e 100644 (file)
@@ -27,7 +27,7 @@
 #include "GUIWindowManager.h"
 #include "settings/Settings.h"
 #include "utils/md5.h"
-
+#include "utils/StringUtils.h"
 
 #include "dialogs/GUIDialogKeyboardGeneric.h"
 #if defined(TARGET_DARWIN_IOS)
@@ -190,7 +190,10 @@ int CGUIKeyboardFactory::ShowAndVerifyPassword(CStdString& strPassword, const CS
   if (1 > iRetries && strHeading.size())
     strHeadingTemp = strHeading;
   else
-    strHeadingTemp.Format("%s - %i %s", g_localizeStrings.Get(12326).c_str(), CSettings::Get().GetInt("masterlock.maxretries") - iRetries, g_localizeStrings.Get(12343).c_str());
+    strHeadingTemp = StringUtils::Format("%s - %i %s",
+                                         g_localizeStrings.Get(12326).c_str(),
+                                         CSettings::Get().GetInt("masterlock.maxretries") - iRetries,
+                                         g_localizeStrings.Get(12343).c_str());
 
   CStdString strUserInput = "";
   if (!ShowAndGetInput(strUserInput, strHeadingTemp, false, true, autoCloseMs))  //bool hiddenInput = false/true ? TODO: GUI Setting to enable disable this feature y/n?
index b9087cc..2a229c3 100644 (file)
@@ -22,6 +22,7 @@
 #include "GUIListContainer.h"
 #include "GUIListItem.h"
 #include "Key.h"
+#include "utils/StringUtils.h"
 
 CGUIListContainer::CGUIListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems)
     : CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems)
@@ -294,8 +295,7 @@ CGUIListContainer::CGUIListContainer(int parentID, int controlID, float posX, fl
   CGUIListItemLayout layout;
   layout.CreateListControlLayouts(width, textureHeight + spaceBetweenItems, false, labelInfo, labelInfo2, textureButton, textureButtonFocus, textureHeight, itemWidth, itemHeight, "", "");
   m_layouts.push_back(layout);
-  CStdString condition;
-  condition.Format("control.hasfocus(%i)", controlID);
+  CStdString condition = StringUtils::Format("control.hasfocus(%i)", controlID);
   CStdString condition2 = "!" + condition;
   CGUIListItemLayout focusLayout;
   focusLayout.CreateListControlLayouts(width, textureHeight + spaceBetweenItems, true, labelInfo, labelInfo2, textureButton, textureButtonFocus, textureHeight, itemWidth, itemHeight, condition2, condition);
index eaa8d75..10b9511 100644 (file)
@@ -23,6 +23,7 @@
 #include "GUIListItem.h"
 #include "GUIWindowManager.h"
 #include "FileItem.h"
+#include "utils/StringUtils.h"
 
 CGUIProgressControl::CGUIProgressControl(int parentID, int controlID,
                                          float posX, float posY, float width,
@@ -205,9 +206,7 @@ bool CGUIProgressControl::UpdateColors()
 
 CStdString CGUIProgressControl::GetDescription() const
 {
-  CStdString percent;
-  percent.Format("%2.f", m_fPercent);
-  return percent;
+  return StringUtils::Format("%2.f", m_fPercent);
 }
 
 bool CGUIProgressControl::UpdateLayout(void)
index 305aecd..20715a9 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "GUIScrollBarControl.h"
 #include "Key.h"
+#include "utils/StringUtils.h"
 
 #define MIN_NIB_SIZE 4.0f
 
@@ -361,9 +362,7 @@ EVENT_RESULT CGUIScrollBar::OnMouseEvent(const CPoint &point, const CMouseEvent
 
 CStdString CGUIScrollBar::GetDescription() const
 {
-  CStdString description;
-  description.Format("%i/%i", m_offset, m_numItems);
-  return description;
+  return StringUtils::Format("%i/%i", m_offset, m_numItems);
 }
 
 bool CGUIScrollBar::UpdateColors()
index b9bbf32..92f9692 100644 (file)
@@ -22,6 +22,7 @@
 #include "GUIInfoManager.h"
 #include "Key.h"
 #include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
 #include "GUIWindowManager.h"
 
 static const SliderAction actions[] = {
@@ -251,8 +252,7 @@ void CGUISliderControl::SendClick()
   SEND_CLICK_MESSAGE(GetID(), GetParentID(), MathUtils::round_int(percent));
   if (m_action && (!m_dragging || m_action->fireOnDrag))
   {
-    CStdString action;
-    action.Format(m_action->formatString, percent);
+    CStdString action = StringUtils::Format(m_action->formatString, percent);
     CGUIMessage message(GUI_MSG_EXECUTE, m_controlID, m_parentID);
     message.SetStringParam(action);
     g_windowManager.SendMessage(message);    
@@ -597,23 +597,23 @@ CStdString CGUISliderControl::GetDescription() const
   if (m_iType == SPIN_CONTROL_TYPE_FLOAT)
   {
     if (m_rangeSelection)
-      description.Format("[%2.2f, %2.2f]", m_floatValues[0], m_floatValues[1]);
+      description = StringUtils::Format("[%2.2f, %2.2f]", m_floatValues[0], m_floatValues[1]);
     else
-      description.Format("%2.2f", m_floatValues[0]);
+      description = StringUtils::Format("%2.2f", m_floatValues[0]);
   }
   else if (m_iType == SPIN_CONTROL_TYPE_INT)
   {
     if (m_rangeSelection)
-      description.Format("[%i, %i]", m_intValues[0], m_intValues[1]);
+      description = StringUtils::Format("[%i, %i]", m_intValues[0], m_intValues[1]);
     else
-      description.Format("%i", m_intValues[0]);
+      description = StringUtils::Format("%i", m_intValues[0]);
   }
   else
   {
     if (m_rangeSelection)
-      description.Format("[%i%%, %i%%]", MathUtils::round_int(m_percentValues[0]), MathUtils::round_int(m_percentValues[1]));
+      description = StringUtils::Format("[%i%%, %i%%]", MathUtils::round_int(m_percentValues[0]), MathUtils::round_int(m_percentValues[1]));
     else
-      description.Format("%i%%", MathUtils::round_int(m_percentValues[0]));
+      description = StringUtils::Format("%i%%", MathUtils::round_int(m_percentValues[0]));
   }
   return description;
 }
index 46c8697..25356d2 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "GUISpinControl.h"
 #include "Key.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 
@@ -364,11 +365,11 @@ void CGUISpinControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyr
   {
     if (m_bShowRange)
     {
-      text.Format("%i/%i", m_iValue, m_iEnd);
+      text = StringUtils::Format("%i/%i", m_iValue, m_iEnd);
     }
     else
     {
-      text.Format("%i", m_iValue);
+      text = StringUtils::Format("%i", m_iValue);
     }
   }
   else if (m_iType == SPIN_CONTROL_TYPE_PAGE)
@@ -378,17 +379,17 @@ void CGUISpinControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyr
     int currentPage = m_currentItem / m_itemsPerPage + 1;
     if (m_currentItem >= m_numItems - m_itemsPerPage)
       currentPage = numPages;
-    text.Format("%i/%i", currentPage, numPages);
+    text = StringUtils::Format("%i/%i", currentPage, numPages);
   }
   else if (m_iType == SPIN_CONTROL_TYPE_FLOAT)
   {
     if (m_bShowRange)
     {
-      text.Format("%02.2f/%02.2f", m_fValue, m_fEnd);
+      text = StringUtils::Format("%02.2f/%02.2f", m_fValue, m_fEnd);
     }
     else
     {
-      text.Format("%02.2f", m_fValue);
+      text = StringUtils::Format("%02.2f", m_fValue);
     }
   }
   else
@@ -397,14 +398,14 @@ void CGUISpinControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyr
     {
       if (m_bShowRange)
       {
-        text.Format("(%i/%i) %s", m_iValue + 1, (int)m_vecLabels.size(), CStdString(m_vecLabels[m_iValue]).c_str() );
+        text = StringUtils::Format("(%i/%i) %s", m_iValue + 1, (int)m_vecLabels.size(), CStdString(m_vecLabels[m_iValue]).c_str() );
       }
       else
       {
-        text.Format("%s", CStdString(m_vecLabels[m_iValue]).c_str() );
+        text = StringUtils::Format("%s", CStdString(m_vecLabels[m_iValue]).c_str() );
       }
     }
-    else text.Format("?%i?", m_iValue);
+    else text = StringUtils::Format("?%i?", m_iValue);
 
   }
 
@@ -947,9 +948,7 @@ EVENT_RESULT CGUISpinControl::OnMouseEvent(const CPoint &point, const CMouseEven
 
 CStdString CGUISpinControl::GetDescription() const
 {
-  CStdString strLabel;
-  strLabel.Format("%i/%i", 1 + GetValue(), GetMaximum());
-  return strLabel;
+  return StringUtils::Format("%i/%i", 1 + GetValue(), GetMaximum());
 }
 
 bool CGUISpinControl::IsFocusedOnUp() const
index fbfbc9c..0de08c1 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "GUISpinControlEx.h"
+#include "utils/StringUtils.h"
 
 CGUISpinControlEx::CGUISpinControlEx(int parentID, int controlID, float posX, float posY, float width, float height, float spinWidth, float spinHeight, const CLabelInfo& spinInfo, const CTextureInfo &textureFocus, const CTextureInfo &textureNoFocus, const CTextureInfo& textureUp, const CTextureInfo& textureDown, const CTextureInfo& textureUpFocus, const CTextureInfo& textureDownFocus, const CLabelInfo& labelInfo, int iType)
     : CGUISpinControl(parentID, controlID, posX, posY, spinWidth, spinHeight, textureUp, textureDown, textureUpFocus, textureDownFocus, spinInfo, iType)
@@ -123,9 +124,7 @@ const CStdString CGUISpinControlEx::GetCurrentLabel() const
 
 CStdString CGUISpinControlEx::GetDescription() const
 {
-  CStdString strLabel;
-  strLabel.Format("%s (%s)", m_buttonControl.GetDescription(), GetLabel());
-  return strLabel;
+  return StringUtils::Format("%s (%s)", m_buttonControl.GetDescription().c_str(), GetLabel().c_str());
 }
 
 void CGUISpinControlEx::SetItemInvalid(bool invalid)
index ec7b6c2..81059ea 100644 (file)
@@ -22,6 +22,7 @@
 #include "GUIInfoManager.h"
 #include "utils/XBMCTinyXML.h"
 #include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 
@@ -354,10 +355,10 @@ CStdString CGUITextBox::GetLabel(int info) const
   switch (info)
   {
   case CONTAINER_NUM_PAGES:
-    label.Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
+    label = StringUtils::Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
     break;
   case CONTAINER_CURRENT_PAGE:
-    label.Format("%u", GetCurrentPage());
+    label = StringUtils::Format("%u", GetCurrentPage());
     break;
   default:
     break;
index d976531..314e1fd 100644 (file)
@@ -27,7 +27,7 @@
 #include "utils/log.h"
 #include "XBTF.h"
 #include "JpegIO.h"
-
+#include "utils/StringUtils.h"
 #include <setjmp.h>
 
 #define EXIF_TAG_ORIENTATION    0x0112
@@ -593,8 +593,7 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int wid
 // override libjpeg's error function to avoid an exit() call
 void CJpegIO::jpeg_error_exit(j_common_ptr cinfo)
 {
-  CStdString msg;
-  msg.Format("Error %i: %s",cinfo->err->msg_code, cinfo->err->jpeg_message_table[cinfo->err->msg_code]);
+  CStdString msg = StringUtils::Format("Error %i: %s",cinfo->err->msg_code, cinfo->err->jpeg_message_table[cinfo->err->msg_code]);
   CLog::Log(LOGWARNING, "JpegIO: %s", msg.c_str());
 
   my_error_mgr *myerr = (my_error_mgr*)cinfo->err;
index eff5315..07a6868 100644 (file)
@@ -25,6 +25,7 @@
 #include "threads/SingleLock.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "addons/Skin.h"
 #ifdef _DEBUG
 #include "utils/TimeUtils.h"
@@ -173,8 +174,7 @@ void CTextureMap::Dump() const
   if (!m_referenceCount)
     return;   // nothing to see here
 
-  CStdString strLog;
-  strLog.Format("  texture:%s has %i frames %i refcount\n", m_textureName.c_str(), m_texture.m_textures.size(), m_referenceCount);
+  CStdString strLog = StringUtils::Format("  texture:%s has %i frames %i refcount\n", m_textureName.c_str(), m_texture.m_textures.size(), m_referenceCount);
   OutputDebugString(strLog.c_str());
 }
 
@@ -511,8 +511,7 @@ void CGUITextureManager::Cleanup()
 
 void CGUITextureManager::Dump() const
 {
-  CStdString strLog;
-  strLog.Format("total texturemaps size:%i\n", m_vecTextures.size());
+  CStdString strLog = StringUtils::Format("total texturemaps size:%i\n", m_vecTextures.size());
   OutputDebugString(strLog.c_str());
 
   for (int i = 0; i < (int)m_vecTextures.size(); ++i)
index 152a1a8..4debb33 100644 (file)
@@ -579,22 +579,22 @@ int CBuiltins::Execute(const CStdString& execString)
           }
 
           if (plugin->Provides(CPluginSource::VIDEO))
-            cmd.Format("ActivateWindow(Video,plugin://%s%s,return)", addonid, urlParameters);
+            cmd = StringUtils::Format("ActivateWindow(Video,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
           else if (plugin->Provides(CPluginSource::AUDIO))
-            cmd.Format("ActivateWindow(Music,plugin://%s%s,return)", addonid, urlParameters);
+            cmd = StringUtils::Format("ActivateWindow(Music,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
           else if (plugin->Provides(CPluginSource::EXECUTABLE))
-            cmd.Format("ActivateWindow(Programs,plugin://%s%s,return)", addonid, urlParameters);
+            cmd = StringUtils::Format("ActivateWindow(Programs,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
           else if (plugin->Provides(CPluginSource::IMAGE))
-            cmd.Format("ActivateWindow(Pictures,plugin://%s%s,return)", addonid, urlParameters);
+            cmd = StringUtils::Format("ActivateWindow(Pictures,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
           else
             // Pass the script name (params[0]) and all the parameters
             // (params[1] ... params[x]) separated by a comma to RunPlugin
-            cmd.Format("RunPlugin(%s)", StringUtils::JoinString(params, ","));
+            cmd = StringUtils::Format("RunPlugin(%s)", StringUtils::JoinString(params, ",").c_str());
         }
         else if (addon->Type() >= ADDON_SCRIPT && addon->Type() <= ADDON_SCRIPT_LYRICS)
           // Pass the script name (params[0]) and all the parameters
           // (params[1] ... params[x]) separated by a comma to RunScript
-          cmd.Format("RunScript(%s)", StringUtils::JoinString(params, ","));
+          cmd = StringUtils::Format("RunScript(%s)", StringUtils::JoinString(params, ",").c_str());
 
         return Execute(cmd);
       }
index c4885a2..7aed8b3 100644 (file)
@@ -194,9 +194,9 @@ JSONRPC_STATUS CAddonsOperations::ExecuteAddon(const CStdString &method, ITransp
   
   CStdString cmd;
   if (params.size() == 0)
-    cmd.Format("RunAddon(%s)", id.c_str());
+    cmd = StringUtils::Format("RunAddon(%s)", id.c_str());
   else
-    cmd.Format("RunAddon(%s, %s)", id.c_str(), argv.c_str());
+    cmd = StringUtils::Format("RunAddon(%s, %s)", id.c_str(), argv.c_str());
   CApplicationMessenger::Get().ExecBuiltIn(cmd, parameterObject["wait"].asBoolean());
   
   return ACK;
index 5f92236..bbc5c0d 100644 (file)
@@ -287,8 +287,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedAlbums(const CStdString &method, I
   CFileItemList items;
   for (unsigned int index = 0; index < albums.size(); index++)
   {
-    CStdString path;
-    path.Format("musicdb://recentlyaddedalbums/%i/", albums[index].idAlbum);
+    CStdString path = StringUtils::Format("musicdb://recentlyaddedalbums/%i/", albums[index].idAlbum);
 
     CFileItemPtr item;
     FillAlbumItem(albums[index], path, item);
@@ -338,8 +337,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedAlbums(const CStdString &method,
   CFileItemList items;
   for (unsigned int index = 0; index < albums.size(); index++)
   {
-    CStdString path;
-    path.Format("musicdb://recentlyplayedalbums/%i/", albums[index].idAlbum);
+    CStdString path = StringUtils::Format("musicdb://recentlyplayedalbums/%i/", albums[index].idAlbum);
 
     CFileItemPtr item;
     FillAlbumItem(albums[index], path, item);
@@ -526,7 +524,7 @@ JSONRPC_STATUS CAudioLibrary::Scan(const CStdString &method, ITransportLayer *tr
   if (directory.empty())
     cmd = "updatelibrary(music)";
   else
-    cmd.Format("updatelibrary(music, %s)", StringUtils::Paramify(directory).c_str());
+    cmd = StringUtils::Format("updatelibrary(music, %s)", StringUtils::Paramify(directory).c_str());
 
   CApplicationMessenger::Get().ExecBuiltIn(cmd);
   return ACK;
@@ -536,11 +534,11 @@ JSONRPC_STATUS CAudioLibrary::Export(const CStdString &method, ITransportLayer *
 {
   CStdString cmd;
   if (parameterObject["options"].isMember("path"))
-    cmd.Format("exportlibrary(music, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()));
+    cmd = StringUtils::Format("exportlibrary(music, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()).c_str());
   else
-    cmd.Format("exportlibrary(music, true, %s, %s)",
-      parameterObject["options"]["images"].asBoolean() ? "true" : "false",
-      parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false");
+    cmd = StringUtils::Format("exportlibrary(music, true, %s, %s)",
+                              parameterObject["options"]["images"].asBoolean() ? "true" : "false",
+                              parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false");
 
   CApplicationMessenger::Get().ExecBuiltIn(cmd);
   return ACK;
index e6bccb2..3d8ae34 100644 (file)
@@ -23,6 +23,7 @@
 #include "utils/log.h"
 #include "utils/StdString.h"
 #include "utils/JSONVariantParser.h"
+#include "utils/StringUtils.h"
 #include "JSONRPC.h"
 #include "PlayerOperations.h"
 #include "PlaylistOperations.h"
@@ -623,7 +624,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
   // Let's check the type of the provided parameter
   if (!IsType(value, type))
   {
-    errorMessage.Format("Invalid type %s received", ValueTypeToString(value.type()));
+    errorMessage = StringUtils::Format("Invalid type %s received", ValueTypeToString(value.type()));
     errorData["message"] = errorMessage.c_str();
     return InvalidParams;
   }
@@ -668,7 +669,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
       if (status != OK)
       {
         CLog::Log(LOGDEBUG, "JSONRPC: Value does not match extended type %s of type %s", extends.at(extendsIndex)->ID.c_str(), name.c_str());
-        errorMessage.Format("value does not match extended type %s", extends.at(extendsIndex)->ID.c_str(), name.c_str());
+        errorMessage = StringUtils::Format("value does not match extended type %s", extends.at(extendsIndex)->ID.c_str(), name.c_str());
         errorData["message"] = errorMessage.c_str();
         return status;
       }
@@ -686,11 +687,11 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
     {
       CLog::Log(LOGDEBUG, "JSONRPC: Number of array elements does not match minItems and/or maxItems in type %s", name.c_str());
       if (minItems > 0 && maxItems > 0)
-        errorMessage.Format("Between %d and %d array items expected but %d received", minItems, maxItems, value.size());
+        errorMessage = StringUtils::Format("Between %d and %d array items expected but %d received", minItems, maxItems, value.size());
       else if (minItems > 0)
-        errorMessage.Format("At least %d array items expected but only %d received", minItems, value.size());
+        errorMessage = StringUtils::Format("At least %d array items expected but only %d received", minItems, value.size());
       else
-        errorMessage.Format("Only %d array items expected but %d received", maxItems, value.size());
+        errorMessage = StringUtils::Format("Only %d array items expected but %d received", maxItems, value.size());
       errorData["message"] = errorMessage.c_str();
       return InvalidParams;
     }
@@ -710,7 +711,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
         if (status != OK)
         {
           CLog::Log(LOGDEBUG, "JSONRPC: Array element at index %u does not match in type %s", arrayIndex, name.c_str());
-          errorMessage.Format("array element at index %u does not match", arrayIndex);
+          errorMessage = StringUtils::Format("array element at index %u does not match", arrayIndex);
           errorData["message"] = errorMessage.c_str();
           return status;
         }
@@ -730,7 +731,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
       if (value.size() < items.size() || (value.size() != items.size() && additionalItems.size() == 0))
       {
         CLog::Log(LOGDEBUG, "JSONRPC: One of the array elements does not match in type %s", name.c_str());
-        errorMessage.Format("%d array elements expected but %d received", items.size(), value.size());
+        errorMessage = StringUtils::Format("%d array elements expected but %d received", items.size(), value.size());
         errorData["message"] = errorMessage.c_str();
         return InvalidParams;
       }
@@ -770,7 +771,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
           if (!ok)
           {
             CLog::Log(LOGDEBUG, "JSONRPC: Array contains non-conforming additional items in type %s", name.c_str());
-            errorMessage.Format("Array element at index %u does not match the \"additionalItems\" schema", arrayIndex);
+            errorMessage = StringUtils::Format("Array element at index %u does not match the \"additionalItems\" schema", arrayIndex);
             errorData["message"] = errorMessage.c_str();
             return InvalidParams;
           }
@@ -789,7 +790,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
           if (outputValue[checkingIndex] == outputValue[checkedIndex])
           {
             CLog::Log(LOGDEBUG, "JSONRPC: Not unique array element at index %u and %u in type %s", checkingIndex, checkedIndex, name.c_str());
-            errorMessage.Format("Array element at index %u is not unique (same as array element at index %u)", checkingIndex, checkedIndex);
+            errorMessage = StringUtils::Format("Array element at index %u is not unique (same as array element at index %u)", checkingIndex, checkedIndex);
             errorData["message"] = errorMessage.c_str();
             return InvalidParams;
           }
@@ -914,10 +915,10 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
     {
       CLog::Log(LOGDEBUG, "JSONRPC: Value does not lay between minimum and maximum in type %s", name.c_str());
       if (value.isDouble())
-        errorMessage.Format("Value between %f (%s) and %f (%s) expected but %f received", 
+        errorMessage = StringUtils::Format("Value between %f (%s) and %f (%s) expected but %f received", 
           minimum, exclusiveMinimum ? "exclusive" : "inclusive", maximum, exclusiveMaximum ? "exclusive" : "inclusive", numberValue);
       else
-        errorMessage.Format("Value between %d (%s) and %d (%s) expected but %d received", 
+        errorMessage = StringUtils::Format("Value between %d (%s) and %d (%s) expected but %d received", 
           (int)minimum, exclusiveMinimum ? "exclusive" : "inclusive", (int)maximum, exclusiveMaximum ? "exclusive" : "inclusive", (int)numberValue);
       errorData["message"] = errorMessage.c_str();
       return InvalidParams;
@@ -926,7 +927,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
     if ((HasType(type, IntegerValue) && divisibleBy > 0 && ((int)numberValue % divisibleBy) != 0))
     {
       CLog::Log(LOGDEBUG, "JSONRPC: Value does not meet divisibleBy requirements in type %s", name.c_str());
-      errorMessage.Format("Value should be divisible by %d but %d received", divisibleBy, (int)numberValue);
+      errorMessage = StringUtils::Format("Value should be divisible by %d but %d received", divisibleBy, (int)numberValue);
       errorData["message"] = errorMessage.c_str();
       return InvalidParams;
     }
@@ -939,7 +940,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
     if (size < minLength)
     {
       CLog::Log(LOGDEBUG, "JSONRPC: Value does not meet minLength requirements in type %s", name.c_str());
-      errorMessage.Format("Value should have a minimum length of %d but has a length of %d", minLength, size);
+      errorMessage = StringUtils::Format("Value should have a minimum length of %d but has a length of %d", minLength, size);
       errorData["message"] = errorMessage.c_str();
       return InvalidParams;
     }
@@ -947,7 +948,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant &
     if (maxLength >= 0 && size > maxLength)
     {
       CLog::Log(LOGDEBUG, "JSONRPC: Value does not meet maxLength requirements in type %s", name.c_str());
-      errorMessage.Format("Value should have a maximum length of %d but has a length of %d", maxLength, size);
+      errorMessage = StringUtils::Format("Value should have a maximum length of %d but has a length of %d", maxLength, size);
       errorData["message"] = errorMessage.c_str();
       return InvalidParams;
     }
@@ -1380,9 +1381,7 @@ bool CJSONServiceDescription::prepareDescription(std::string &description, CVari
 
   if (description.at(0) != '{')
   {
-    CStdString json;
-    json.Format("{%s}", description);
-    description = json;
+    description = StringUtils::Format("{%s}", description.c_str());
   }
 
   descriptionObject = CJSONVariantParser::Parse((const unsigned char *)description.c_str(), description.size());
index cdd84b6..206abbb 100644 (file)
@@ -222,8 +222,7 @@ JSONRPC_STATUS CVideoLibrary::GetSeasons(const CStdString &method, ITransportLay
 
   int tvshowID = (int)parameterObject["tvshowid"].asInteger();
 
-  CStdString strPath;
-  strPath.Format("videodb://tvshows/titles/%i/", tvshowID);
+  CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/", tvshowID);
   CFileItemList items;
   if (!videodatabase.GetSeasonsNav(strPath, items, -1, -1, -1, -1, tvshowID, false))
     return InternalError;
@@ -264,8 +263,7 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodes(const CStdString &method, ITransportLa
   int tvshowID = (int)parameterObject["tvshowid"].asInteger();
   int season   = (int)parameterObject["season"].asInteger();
   
-  CStdString strPath;
-  strPath.Format("videodb://tvshows/titles/%i/%i/", tvshowID, season);
+  CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/%i/", tvshowID, season);
 
   CVideoDbUrl videoUrl;
   videoUrl.FromString(strPath);
@@ -324,7 +322,7 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodeDetails(const CStdString &method, ITrans
   if (tvshowid <= 0)
     tvshowid = videodatabase.GetTvShowForEpisode(id);
 
-  CStdString basePath; basePath.Format("videodb://tvshows/titles/%ld/%ld/%ld", tvshowid, infos.m_iSeason, id);
+  CStdString basePath = StringUtils::Format("videodb://tvshows/titles/%ld/%ld/%ld", tvshowid, infos.m_iSeason, id);
   pItem->SetPath(basePath);
 
   HandleFileItem("episodeid", true, "episodedetails", pItem, parameterObject, parameterObject["properties"], result, false);
@@ -761,7 +759,7 @@ JSONRPC_STATUS CVideoLibrary::Scan(const CStdString &method, ITransportLayer *tr
   if (directory.empty())
     cmd = "updatelibrary(video)";
   else
-    cmd.Format("updatelibrary(video, %s)", StringUtils::Paramify(directory).c_str());
+    cmd = StringUtils::Format("updatelibrary(video, %s)", StringUtils::Paramify(directory).c_str());
 
   CApplicationMessenger::Get().ExecBuiltIn(cmd);
   return ACK;
@@ -771,12 +769,12 @@ JSONRPC_STATUS CVideoLibrary::Export(const CStdString &method, ITransportLayer *
 {
   CStdString cmd;
   if (parameterObject["options"].isMember("path"))
-    cmd.Format("exportlibrary(video, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()));
+    cmd = StringUtils::Format("exportlibrary(video, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()).c_str());
   else
-    cmd.Format("exportlibrary(video, true, %s, %s, %s)",
-      parameterObject["options"]["images"].asBoolean() ? "true" : "false",
-      parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false",
-      parameterObject["options"]["actorthumbs"].asBoolean() ? "true" : "false");
+    cmd = StringUtils::Format("exportlibrary(video, true, %s, %s, %s)",
+                              parameterObject["options"]["images"].asBoolean() ? "true" : "false",
+                              parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false",
+                              parameterObject["options"]["actorthumbs"].asBoolean() ? "true" : "false");
 
   CApplicationMessenger::Get().ExecBuiltIn(cmd);
   return ACK;
index bfc51d2..93f9232 100644 (file)
@@ -25,6 +25,7 @@
 #include "addons/GUIDialogAddonSettings.h"
 #include "guilib/GUIWindowManager.h"
 #include "GUIUserMessages.h"
+#include "utils/StringUtils.h"
 
 using namespace ADDON;
 
@@ -150,9 +151,7 @@ namespace XBMCAddon
         return pAddon->Profile();
       else if (strcmpi(id, "stars") == 0)
       {
-        CStdString tmps;
-        tmps.Format("%d", pAddon->Stars());
-        return tmps;
+        return StringUtils::Format("%d", pAddon->Stars());
       }
       else if (strcmpi(id, "summary") == 0)
         return pAddon->Summary();
index 91ec366..492f981 100644 (file)
@@ -29,6 +29,7 @@
 #include "dialogs/GUIDialogKaiToast.h"
 #include "ModuleXbmcgui.h"
 #include "guilib/GUIKeyboardFactory.h"
+#include "utils/StringUtils.h"
 
 #define ACTIVE_WINDOW g_windowManager.GetActiveWindow()
 
@@ -220,7 +221,7 @@ namespace XBMCAddon
             timedate.wYear = atoi(sDefault.Right(4));
           }
           if (CGUIDialogNumeric::ShowAndGetDate(timedate, heading))
-            value.Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
+            value = StringUtils::Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
           else
             return emptyString;
         }
@@ -233,7 +234,7 @@ namespace XBMCAddon
             timedate.wMinute = atoi(sDefault.Right(2));
           }
           if (CGUIDialogNumeric::ShowAndGetTime(timedate, heading))
-            value.Format("%2d:%02d", timedate.wHour, timedate.wMinute);
+            value = StringUtils::Format("%2d:%02d", timedate.wHour, timedate.wMinute);
           else
             return emptyString;
         }
@@ -307,7 +308,7 @@ namespace XBMCAddon
               timedate.wYear = atoi(sDefault.Right(4));
             }
             if (CGUIDialogNumeric::ShowAndGetDate(timedate, heading))
-              value.Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
+              value = StringUtils::Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
             else
               value = emptyString;
           }
@@ -321,7 +322,7 @@ namespace XBMCAddon
               timedate.wMinute = atoi(sDefault.Right(2));
             }
             if (CGUIDialogNumeric::ShowAndGetTime(timedate, heading))
-              value.Format("%2d:%02d", timedate.wHour, timedate.wMinute);
+              value = StringUtils::Format("%2d:%02d", timedate.wHour, timedate.wMinute);
             else
               value = emptyString;
           }
index 9efeb0b..58565bd 100644 (file)
@@ -190,12 +190,12 @@ namespace XBMCAddon
       if (lowerKey.CompareNoCase("startoffset") == 0)
       { // special case for start offset - don't actually store in a property,
         // we store it in item.m_lStartOffset instead
-        value.Format("%f", item->m_lStartOffset / 75.0);
+        value = StringUtils::Format("%f", item->m_lStartOffset / 75.0);
       }
       else if (lowerKey.CompareNoCase("totaltime") == 0)
-        value.Format("%f", item->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds);
+        value = StringUtils::Format("%f", item->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds);
       else if (lowerKey.CompareNoCase("resumetime") == 0)
-        value.Format("%f", item->GetVideoInfoTag()->m_resumePoint.timeInSeconds);
+        value = StringUtils::Format("%f", item->GetVideoInfoTag()->m_resumePoint.timeInSeconds);
       else if (lowerKey.CompareNoCase("fanart_image") == 0)
         value = item->GetArt("fanart");
       else
@@ -544,10 +544,10 @@ namespace XBMCAddon
 
         LOCKGUI;
         CStdString property;
-        property.Format("contextmenulabel(%i)", itemCount);
+        property = StringUtils::Format("contextmenulabel(%i)", itemCount);
         item->SetProperty(property, uText);
 
-        property.Format("contextmenuaction(%i)", itemCount);
+        property = StringUtils::Format("contextmenuaction(%i)", itemCount);
         item->SetProperty(property, uAction);
       }
 
index 7b86e2f..5cf489f 100644 (file)
@@ -52,7 +52,7 @@
 #include "storage/MediaManager.h"
 #include "utils/FileUtils.h"
 #include "utils/LangCodeExpander.h"
-
+#include "utils/StringUtils.h"
 #include "CallbackHandler.h"
 #include "AddonUtils.h"
 
@@ -372,9 +372,7 @@ namespace XBMCAddon
       XBMC_TRACE;
       Crc32 crc;
       crc.ComputeFromLowerCase(path);
-      CStdString strPath;
-      strPath.Format("%08x.tbn", (unsigned __int32)crc);
-      return strPath;
+      return StringUtils::Format("%08x.tbn", (unsigned __int32)crc);;
     }
 
     String makeLegalFilename(const String& filename, bool fatX)
@@ -442,7 +440,9 @@ namespace XBMCAddon
           result.Replace("xx", "%p");
         }
       else if (strcmpi(id, "meridiem") == 0)
-        result.Format("%s/%s", g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_AM), g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_PM));
+        result = StringUtils::Format("%s/%s",
+                                     g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_AM).c_str(),
+                                     g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_PM).c_str());
 
       return result;
     }
index fd8ae14..0f15c9a 100644 (file)
@@ -27,6 +27,7 @@
 #include "addons/Skin.h"
 #include "filesystem/File.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "addons/Addon.h"
 
 // These #defs are for WindowXML
index 82b39dd..b4a75b1 100644 (file)
@@ -566,7 +566,7 @@ void CPythonInvoker::onError()
       }
     }
 
-    desc.Format(g_localizeStrings.Get(2100), script);
+    desc = StringUtils::Format(g_localizeStrings.Get(2100), script.c_str());
     pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(257), desc);
   }
 }
index f7499e6..7327bac 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "LanguageHook.h"
 #include "swig.h"
+#include "utils/StringUtils.h"
 
 #include <string>
 
@@ -173,7 +174,7 @@ namespace PythonBindings
             emptyString = PyString_FromString("");
             strRetval = PyObject_CallMethod(emptyString, (char*)"join", (char*)"O", tbList);
             
-            msg.Format("%s%s", msg.c_str(),PyString_AsString(strRetval));
+            msg = StringUtils::Format("%s%s", msg.c_str(),PyString_AsString(strRetval));
 
             Py_DECREF(tbList);
             Py_DECREF(emptyString);
index 0b57f06..aed9c07 100644 (file)
@@ -432,7 +432,7 @@ void CHALManager::HandleNewVolume(CStorageDevice *dev)
         if (dev->Label.size() > 0)
         {
           MountPoint = dev->Label.c_str();
-          TestPath.Format("/media/%s", MountPoint.c_str());
+          TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
           struct stat St;
           if (stat("/media", &St) != 0)
             return; //If /media doesn't exist something is wrong.
@@ -440,13 +440,13 @@ void CHALManager::HandleNewVolume(CStorageDevice *dev)
           {
             CLog::Log(LOGDEBUG, "HAL: Proposed Mountpoint already existed");
             MountPoint.append("_");
-            TestPath.Format("/media/%s", MountPoint.c_str());
+            TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
           }
         }
         else
         {
           MountPoint = StorageTypeToString(dev->Type);
-          TestPath.Format("/media/%s", MountPoint.c_str());
+          TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
           int Nbr = 0;
           struct stat St;
           if (stat("/media", &St) != 0)
@@ -455,8 +455,8 @@ void CHALManager::HandleNewVolume(CStorageDevice *dev)
           {
             CLog::Log(LOGDEBUG, "HAL: Proposed Mountpoint already existed");
             Nbr++;
-            MountPoint.Format("%s%i", StorageTypeToString(dev->Type), Nbr);
-            TestPath.Format("/media/%s", MountPoint.c_str());
+            MountPoint = StringUtils::Format("%s%i", StorageTypeToString(dev->Type), Nbr);
+            TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
           }
         }
         if (Mount(dev, MountPoint))
@@ -696,10 +696,10 @@ bool CHALManager::Mount(CStorageDevice *volume, CStdString mountpath)
     if (volume->FileSystem.Equals("vfat"))
     {
       int mask = umask (0);
-      temporaryString.Format("umask=%#o", mask);
+      temporaryString = StringUtils::Format("umask=%#o", mask);
       s = temporaryString.c_str();
       dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &s);
-      temporaryString.Format("uid=%u", getuid());
+      temporaryString = StringUtils::Format("uid=%u", getuid());
       s = temporaryString.c_str();
       dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &s);
       s = "shortname=mixed";
index 01a832f..6f4be17 100644 (file)
@@ -32,6 +32,7 @@
 #define BYTE char
 #include "utils/log.h"
 #include "threads/CriticalSection.h"
+#include "utils/StringUtils.h"
 #include "utils/URIUtils.h"
 #include "MediaSource.h"
 
@@ -63,20 +64,20 @@ public:
   { // Not the prettiest but it's better than having to reproduce it elsewere in the code...
     CStdString rtn, tmp1, tmp2, tmp3, tmp4;
     if (UUID.size() > 0)
-      tmp1.Format("UUID %s | ", UUID.c_str());
+      tmp1 = StringUtils::Format("UUID %s | ", UUID.c_str());
     if (FileSystem.size() > 0)
-      tmp2.Format("FileSystem %s | ", FileSystem.c_str());
+      tmp2 = StringUtils::Format("FileSystem %s | ", FileSystem.c_str());
     if (MountPoint.size() > 0)
-      tmp3.Format("Mounted on %s | ", MountPoint.c_str());
+      tmp3 = StringUtils::Format("Mounted on %s | ", MountPoint.c_str());
     if (HotPlugged)
-      tmp4.Format("HotPlugged YES | ");
+      tmp4 = StringUtils::Format("HotPlugged YES | ");
     else
-      tmp4.Format("HotPlugged NO  | ");
+      tmp4 = StringUtils::Format("HotPlugged NO  | ");
 
     if (Approved)
-      rtn.Format("%s%s%s%sType %i |Approved YES ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
+      rtn = StringUtils::Format("%s%s%s%sType %i |Approved YES ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
     else
-      rtn.Format("%s%s%s%sType %i |Approved NO  ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
+      rtn = StringUtils::Format("%s%s%s%sType %i |Approved NO  ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
 
     return  rtn;
   }
index d0f04b0..0a480bc 100644 (file)
@@ -999,7 +999,10 @@ CSong CMusicDatabase::GetSongFromDataset(bool bWithMusicDbPath/*=false*/)
   {
     CStdString strFileName = m_pDS->fv(song_strFileName).get_asString();
     CStdString strExt = URIUtils::GetExtension(strFileName);
-    song.strFileName.Format("musicdb://albums/%ld/%ld%s", m_pDS->fv(song_idAlbum).get_asInt(), m_pDS->fv(song_idSong).get_asInt(), strExt.c_str());
+    song.strFileName = StringUtils::Format("musicdb://albums/%ld/%ld%s",
+                                           m_pDS->fv(song_idAlbum).get_asInt(),
+                                           m_pDS->fv(song_idSong).get_asInt(),
+                                           strExt.c_str());
   }
 
   return song;
@@ -1048,7 +1051,7 @@ void CMusicDatabase::GetFileItemFromDataset(const dbiplus::sql_record* const rec
     CMusicDbUrl itemUrl = baseUrl;
     CStdString strFileName = record->at(song_strFileName).get_asString();
     CStdString strExt = URIUtils::GetExtension(strFileName);
-    CStdString path; path.Format("%ld%s", record->at(song_idSong).get_asInt(), strExt.c_str());
+    CStdString path = StringUtils::Format("%ld%s", record->at(song_idSong).get_asInt(), strExt.c_str());
     itemUrl.AppendPath(path);
     item->SetPath(itemUrl.ToString());
   }
@@ -1284,13 +1287,11 @@ bool CMusicDatabase::SearchArtists(const CStdString& search, CFileItemList &arti
     CStdString artistLabel(g_localizeStrings.Get(557)); // Artist
     while (!m_pDS->eof())
     {
-      CStdString path;
-      path.Format("musicdb://artists/%ld/", m_pDS->fv(0).get_asInt());
+      CStdString path = StringUtils::Format("musicdb://artists/%ld/", m_pDS->fv(0).get_asInt());
       CFileItemPtr pItem(new CFileItem(path, true));
-      CStdString label;
-      label.Format("[%s] %s", artistLabel.c_str(), m_pDS->fv(1).get_asString());
+      CStdString label = StringUtils::Format("[%s] %s", artistLabel.c_str(), m_pDS->fv(1).get_asString().c_str());
       pItem->SetLabel(label);
-      label.Format("A %s", m_pDS->fv(1).get_asString()); // sort label is stored in the title tag
+      label = StringUtils::Format("A %s", m_pDS->fv(1).get_asString().c_str()); // sort label is stored in the title tag
       pItem->GetMusicInfoTag()->SetTitle(label);
       pItem->GetMusicInfoTag()->SetDatabaseId(m_pDS->fv(0).get_asInt(), "artist");
       artists.Add(pItem);
@@ -1565,8 +1566,7 @@ bool CMusicDatabase::GetTop100AlbumSongs(const CStdString& strBaseDir, CFileItem
     if (!strBaseDir.empty() && baseUrl.FromString(strBaseDir))
       return false;
 
-    CStdString strSQL;
-    strSQL.Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100) order by albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100)");
+    CStdString strSQL = StringUtils::Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100) order by albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100)");
     CLog::Log(LOGDEBUG,"GetTop100AlbumSongs() query: %s", strSQL.c_str());
     if (!m_pDS->query(strSQL.c_str())) return false;
 
@@ -1606,8 +1606,7 @@ bool CMusicDatabase::GetRecentlyPlayedAlbums(VECALBUMS& albums)
     if (NULL == m_pDB.get()) return false;
     if (NULL == m_pDS.get()) return false;
 
-    CStdString strSQL;
-    strSQL.Format("select distinct albumview.* from song join albumview on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i", RECENTLY_PLAYED_LIMIT);
+    CStdString strSQL = StringUtils::Format("select distinct albumview.* from song join albumview on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i", RECENTLY_PLAYED_LIMIT);
     CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
     if (!m_pDS->query(strSQL.c_str())) return false;
     int iRowsFound = m_pDS->num_rows();
@@ -1644,8 +1643,7 @@ bool CMusicDatabase::GetRecentlyPlayedAlbumSongs(const CStdString& strBaseDir, C
     if (!strBaseDir.empty() && !baseUrl.FromString(strBaseDir))
       return false;
 
-    CStdString strSQL;
-    strSQL.Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select distinct albumview.idAlbum from albumview join song on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i)", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
+    CStdString strSQL = StringUtils::Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select distinct albumview.idAlbum from albumview join song on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i)", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
     CLog::Log(LOGDEBUG,"GetRecentlyPlayedAlbumSongs() query: %s", strSQL.c_str());
     if (!m_pDS->query(strSQL.c_str())) return false;
 
@@ -1685,8 +1683,7 @@ bool CMusicDatabase::GetRecentlyAddedAlbums(VECALBUMS& albums, unsigned int limi
     if (NULL == m_pDB.get()) return false;
     if (NULL == m_pDS.get()) return false;
 
-    CStdString strSQL;
-    strSQL.Format("select * from albumview where strAlbum != '' order by idAlbum desc limit %u", limit ? limit : g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
+    CStdString strSQL = StringUtils::Format("select * from albumview where strAlbum != '' order by idAlbum desc limit %u", limit ? limit : g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
 
     CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
     if (!m_pDS->query(strSQL.c_str())) return false;
@@ -1904,13 +1901,11 @@ bool CMusicDatabase::SearchAlbums(const CStdString& search, CFileItemList &album
     while (!m_pDS->eof())
     {
       CAlbum album = GetAlbumFromDataset(m_pDS.get());
-      CStdString path;
-      path.Format("musicdb://albums/%ld/", album.idAlbum);
+      CStdString path = StringUtils::Format("musicdb://albums/%ld/", album.idAlbum);
       CFileItemPtr pItem(new CFileItem(path, album));
-      CStdString label;
-      label.Format("[%s] %s", albumLabel.c_str(), album.strAlbum);
+      CStdString label = StringUtils::Format("[%s] %s", albumLabel.c_str(), album.strAlbum.c_str());
       pItem->SetLabel(label);
-      label.Format("B %s", album.strAlbum); // sort label is stored in the title tag
+      label = StringUtils::Format("B %s", album.strAlbum.c_str()); // sort label is stored in the title tag
       pItem->GetMusicInfoTag()->SetTitle(label);
       albums.Add(pItem);
       m_pDS->next();
@@ -2505,8 +2500,7 @@ bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/)
   //  Delete old info if any
   if (bRequery)
   {
-    CStdString strFile;
-    strFile.Format("%x.cddb", pCdInfo->GetCddbDiscId());
+    CStdString strFile = StringUtils::Format("%x.cddb", pCdInfo->GetCddbDiscId());
     CFile::Delete(URIUtils::AddFileToFolder(CProfilesManager::Get().GetCDDBFolder(), strFile));
   }
 
@@ -2578,8 +2572,7 @@ bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/)
       {
         pCdInfo->SetNoCDDBInfo();
         // ..no, an error occured, display it to the user
-        CStdString strErrorText;
-        strErrorText.Format("[%d] %s", cddb.getLastError(), cddb.getLastErrorText());
+        CStdString strErrorText = StringUtils::Format("[%d] %s", cddb.getLastError(), cddb.getLastErrorText());
         CGUIDialogOK::ShowAndGetInput(255, 257, strErrorText, 0);
       }
     } // if ( !cddb.queryCDinfo( pCdInfo ) )
@@ -2657,8 +2650,7 @@ void CMusicDatabase::DeleteCDDBInfo()
     {
       if (it->second == strSelectedAlbum)
       {
-        CStdString strFile;
-        strFile.Format("%x.cddb", it->first);
+        CStdString strFile = StringUtils::Format("%x.cddb", it->first);
         CFile::Delete(URIUtils::AddFileToFolder(CProfilesManager::Get().GetCDDBFolder(), strFile));
         break;
       }
@@ -2774,7 +2766,7 @@ bool CMusicDatabase::GetGenresNav(const CStdString& strBaseDir, CFileItemList& i
       pItem->GetMusicInfoTag()->SetDatabaseId(m_pDS->fv("genre.idGenre").get_asInt(), "genre");
 
       CMusicDbUrl itemUrl = musicUrl;
-      CStdString strDir; strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
       itemUrl.AppendPath(strDir);
       pItem->SetPath(itemUrl.ToString());
 
@@ -2836,7 +2828,7 @@ bool CMusicDatabase::GetYearsNav(const CStdString& strBaseDir, CFileItemList& it
       pItem->GetMusicInfoTag()->SetReleaseDate(stTime);
 
       CMusicDbUrl itemUrl = musicUrl;
-      CStdString strDir; strDir.Format("%ld/", m_pDS->fv("iYear").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("iYear").get_asInt());
       itemUrl.AppendPath(strDir);
       pItem->SetPath(itemUrl.ToString());
 
@@ -2927,7 +2919,7 @@ bool CMusicDatabase::GetCommonNav(const CStdString &strBaseDir, const CStdString
       CFileItemPtr pItem(new CFileItem(labelValue));
       
       CMusicDbUrl itemUrl = musicUrl;
-      CStdString strDir; strDir.Format("%s/", labelValue.c_str());
+      CStdString strDir = StringUtils::Format("%s/", labelValue.c_str());
       itemUrl.AppendPath(strDir);
       pItem->SetPath(itemUrl.ToString());
       
@@ -3098,7 +3090,7 @@ bool CMusicDatabase::GetArtistsByWhere(const CStdString& strBaseDir, const Filte
         CFileItemPtr pItem(new CFileItem(artist));
 
         CMusicDbUrl itemUrl = musicUrl;
-        CStdString path; path.Format("%ld/", artist.idArtist);
+        CStdString path = StringUtils::Format("%ld/", artist.idArtist);
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -3259,7 +3251,7 @@ bool CMusicDatabase::GetAlbumsByWhere(const CStdString &baseDir, const Filter &f
       try
       {
         CMusicDbUrl itemUrl = musicUrl;
-        CStdString path; path.Format("%ld/", record->at(album_idAlbum).get_asInt());
+        CStdString path = StringUtils::Format("%ld/", record->at(album_idAlbum).get_asInt());
         itemUrl.AppendPath(path);
 
         CFileItemPtr pItem(new CFileItem(itemUrl.ToString(), GetAlbumFromDataset(record)));
@@ -4618,10 +4610,7 @@ CStdString CMusicDatabase::GetItemById(const CStdString &itemType, int id)
   if (itemType.Equals("genres"))
     return GetGenreById(id);
   else if (itemType.Equals("years"))
-  {
-    CStdString tmp; tmp.Format("%d", id);
-    return tmp;
-  }
+    return StringUtils::Format("%d", id);
   else if (itemType.Equals("artists"))
     return GetArtistById(id);
   else if (itemType.Equals("albums"))
@@ -5029,8 +5018,7 @@ void CMusicDatabase::ExportKaraokeInfo(const CStdString & outFile, bool asHTML)
     while (!m_pDS->eof())
     {
       CSong song = GetSongFromDataset( false );
-      CStdString songnum;
-      songnum.Format( "%06d", song.iKaraokeNumber );
+      CStdString songnum = StringUtils::Format("%06d", song.iKaraokeNumber);
 
       if ( asHTML )
         outdoc = "<tr><td>" + songnum + "</td><td>" + StringUtils::Join(song.artist, g_advancedSettings.m_musicItemSeparator) + "</td><td>" + song.strTitle + "</td></tr>\r\n";
index b8aef21..b8a2404 100644 (file)
@@ -354,7 +354,7 @@ void CGUIDialogMusicInfo::OnGetThumb()
   for (unsigned int i = 0; i < thumbs.size(); ++i)
   {
     CStdString strItemPath;
-    strItemPath.Format("thumb://Remote%i", i);
+    strItemPath = StringUtils::Format("thumb://Remote%i", i);
     CFileItemPtr item(new CFileItem(strItemPath, false));
     item->SetArt("thumb", thumbs[i]);
     item->SetIconImage("DefaultPicture.png");
@@ -455,8 +455,7 @@ void CGUIDialogMusicInfo::OnGetFanart()
   // Grab the thumbnails from the web
   for (unsigned int i = 0; i < m_artist.fanart.GetNumFanarts(); i++)
   {
-    CStdString strItemPath;
-    strItemPath.Format("fanart://Remote%i",i);
+    CStdString strItemPath = StringUtils::Format("fanart://Remote%i",i);
     CFileItemPtr item(new CFileItem(strItemPath, false));
     CStdString thumb = m_artist.fanart.GetPreviewURL(i);
     item->SetArt("thumb", CTextureUtils::GetWrappedThumbURL(thumb));
index e9228a9..807bcd8 100644 (file)
@@ -110,8 +110,7 @@ bool CGUIDialogSongInfo::OnMessage(CGUIMessage& message)
         if (window)
         {
           CFileItem item(*m_song);
-          CStdString path;
-          path.Format("musicdb://albums/%li",m_albumId);
+          CStdString path = StringUtils::Format("musicdb://albums/%li",m_albumId);
           item.SetPath(path);
           item.m_bIsFolder = true;
           window->OnInfo(&item, true);
index dd8ec5f..10676d4 100644 (file)
@@ -26,6 +26,7 @@
 #include "FileItem.h"
 #include "guilib/Key.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 #define CONTROL_LIST           2
 #define CONTROL_PRESETS_LABEL  3
@@ -127,7 +128,7 @@ void CGUIDialogVisualisationPresetList::Update()
   CStdString strHeading;
   if (m_viz)
   {
-    strHeading.Format(g_localizeStrings.Get(13407).c_str(), m_viz->Name().c_str());
+    strHeading = StringUtils::Format(g_localizeStrings.Get(13407).c_str(), m_viz->Name().c_str());
 
     //clear filelist
     CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_LIST);
index f4795c6..68da249 100644 (file)
@@ -49,7 +49,7 @@ CMusicAlbumInfo::CMusicAlbumInfo(const CStdString& strAlbum, const CStdString& s
 void CMusicAlbumInfo::SetAlbum(CAlbum& album)
 {
   m_album = album;
-  m_album.m_strDateOfRelease.Format("%i", album.iYear);
+  m_album.m_strDateOfRelease = StringUtils::Format("%i", album.iYear);
   m_strTitle2 = "";
   m_bLoaded = true;
 }
index 89bc461..e9b2a52 100644 (file)
@@ -1210,8 +1210,7 @@ INFO_RET CMusicInfoScanner::DownloadAlbumInfo(const CAlbum& album, ADDON::Scrape
           if (pDialog)
           {
             // set the label to [relevance]  album - artist
-            CStdString strTemp;
-            strTemp.Format("[%0.2f]  %s", relevance, info.GetTitle2());
+            CStdString strTemp = StringUtils::Format("[%0.2f]  %s", relevance, info.GetTitle2().c_str());
             CFileItem item(strTemp);
             item.m_idepth = i; // use this to hold the index of the album in the scraper
             pDlg->Add(&item);
@@ -1406,7 +1405,7 @@ INFO_RET CMusicInfoScanner::DownloadArtistInfo(const CArtist& artist, ADDON::Scr
             {
               CStdString genres = StringUtils::Join(scraper.GetArtist(i).GetArtist().genre, g_advancedSettings.m_musicItemSeparator);
               if (!genres.empty())
-                strTemp.Format("[%s] %s", genres.c_str(), strTemp.c_str());
+                strTemp = StringUtils::Format("[%s] %s", genres.c_str(), strTemp.c_str());
             }
             item.SetLabel(strTemp);
             item.m_idepth = i; // use this to hold the index of the album in the scraper
index 1c1d40d..4785339 100644 (file)
@@ -24,6 +24,7 @@
 #include "guilib/Key.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 
 #define CONTROL_LABEL_SONGNUMBER    401
 #define CONTROL_LABEL_SONGNAME      402
@@ -167,8 +168,7 @@ void CGUIDialogKaraokeSongSelector::UpdateData()
   if ( m_updateData )
   {
     // Update on-screen labels
-    CStdString message;
-    message.Format( "%06d", m_selectedNumber );
+    CStdString message = StringUtils::Format("%06d", m_selectedNumber);
     message = g_localizeStrings.Get(179) + ": " + message; // Translated "Song"
 
     SET_CONTROL_LABEL(CONTROL_LABEL_SONGNUMBER, message);
index 24ddc4b..c2744cf 100644 (file)
@@ -34,6 +34,7 @@
 #include "addons/Skin.h"
 #include "utils/MathUtils.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 
 typedef struct
 {
@@ -74,7 +75,7 @@ CKaraokeLyricsText::CKaraokeLyricsText()
 
   m_colorLyrics = gLyricColors[coloridx].text;
   m_colorLyricsOutline = gLyricColors[coloridx].outline;
-  m_colorSinging.Format( "%08X", gLyricColors[coloridx].active );
+  m_colorSinging = StringUtils::Format("%08X", gLyricColors[coloridx].active);
 
   m_delayAfter = 50; // 5 seconds
   m_showLyricsBeforeStart = 50; // 7.5 seconds
@@ -705,8 +706,10 @@ void CKaraokeLyricsText::saveLyrics()
 
   for ( unsigned int i = 0; i < m_lyrics.size(); i++ )
   {
-    CStdString timing;
-    timing.Format( "%02d:%02d.%d", m_lyrics[i].timing / 600, (m_lyrics[i].timing % 600) / 10, (m_lyrics[i].timing % 10) );
+    CStdString timing = StringUtils::Format("%02d:%02d.%d",
+                                            m_lyrics[i].timing / 600,
+                                            (m_lyrics[i].timing % 600) / 10,
+                                            (m_lyrics[i].timing % 10));
 
     if ( (m_lyrics[i].flags & LYRICS_NEW_PARAGRAPH) != 0 )
       out += "\n\n";
index 01046f9..8c960dd 100644 (file)
@@ -210,9 +210,7 @@ const std::string &CMusicInfoTag::GetType() const
 
 CStdString CMusicInfoTag::GetYearString() const
 {
-  CStdString strReturn;
-  strReturn.Format("%i", m_dwReleaseDate.wYear);
-  return m_dwReleaseDate.wYear ? strReturn : "";
+  return m_dwReleaseDate.wYear ? StringUtils::Format("%i", m_dwReleaseDate.wYear) : StringUtils::Empty;
 }
 
 const CStdString &CMusicInfoTag::GetComment() const
index 76edccf..0557484 100644 (file)
@@ -365,8 +365,7 @@ void CGUIWindowMusicNav::UpdateButtons()
       StringUtils::StartsWith(m_vecItems->Get(m_vecItems->Size()-1)->GetPath(), "/-1/"))
       iItems--;
   }
-  CStdString items;
-  items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
+  CStdString items = StringUtils::Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
   SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
 
   // set the filter label
@@ -570,7 +569,7 @@ bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
         long idArtist = m_musicdatabase.GetArtistByName(item->GetLabel());
         if (idArtist == -1)
           return false;
-        CStdString path; path.Format("musicdb://artists/%ld/", idArtist);
+        CStdString path = StringUtils::Format("musicdb://artists/%ld/", idArtist);
         CArtist artist;
         m_musicdatabase.GetArtistInfo(idArtist,artist,false);
         *item = CFileItem(artist);
@@ -587,7 +586,7 @@ bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
         long idAlbum = m_musicdatabase.GetAlbumByName(item->GetLabel());
         if (idAlbum == -1)
           return false;
-        CStdString path; path.Format("musicdb://albums/%ld/", idAlbum);
+        CStdString path = StringUtils::Format("musicdb://albums/%ld/", idAlbum);
         CAlbum album;
         m_musicdatabase.GetAlbumInfo(idAlbum,album,NULL);
         *item = CFileItem(path,album);
@@ -630,7 +629,8 @@ bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
       CStdString strPath;
       CVideoDatabase database;
       database.Open();
-      strPath.Format("videodb://musicvideos/artists/%ld/",database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator)));
+      strPath = StringUtils::Format("videodb://musicvideos/artists/%ld/",
+                                    database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator)));
       g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
       return true;
     }
@@ -685,10 +685,10 @@ bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
       CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
       CONTENT_TYPE content = CONTENT_ALBUMS;
       if (params.GetAlbumId() != -1)
-        path.Format("musicdb://albums/%i/",params.GetAlbumId());
+        path = StringUtils::Format("musicdb://albums/%i/",params.GetAlbumId());
       else if (params.GetArtistId() != -1)
       {
-        path.Format("musicdb://artists/%i/",params.GetArtistId());
+        path = StringUtils::Format("musicdb://artists/%i/",params.GetArtistId());
         content = CONTENT_ARTISTS;
       }
 
index dacd315..a8b908c 100644 (file)
@@ -406,8 +406,7 @@ void CGUIWindowMusicPlayList::UpdateButtons()
   SET_CONTROL_LABEL(CONTROL_BTNREPEAT, g_localizeStrings.Get(iRepeat));
 
   // Update object count label
-  CStdString items;
-  items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
+  CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
   SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
 
   MarkPlaying();
@@ -473,7 +472,7 @@ void CGUIWindowMusicPlayList::OnItemLoaded(CFileItem* pItem)
       // No music info and it's not CDDA so we'll just show the filename
       CStdString str;
       str = CUtil::GetTitleFromPath(pItem->GetPath());
-      str.Format("%02.2i. %s ", pItem->m_iprogramCount, str);
+      str = StringUtils::Format("%02.2i. %s ", pItem->m_iprogramCount, str.c_str());
       pItem->SetLabel(str);
     }
   }
index e5ec80b..c67da93 100644 (file)
@@ -22,6 +22,7 @@
 #include "GUIWindowMusicPlaylistEditor.h"
 #include "Util.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "Autorun.h"
 #include "dialogs/GUIDialogFileBrowser.h"
 #include "filesystem/PlaylistFileDirectory.h"
@@ -177,8 +178,7 @@ void CGUIWindowMusicPlaylistEditor::UpdateButtons()
   CGUIWindowMusicBase::UpdateButtons();
 
   // Update object count label
-  CStdString items;
-  items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); // " 14 Objects"
+  CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); // " 14 Objects"
   SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
 }
 
@@ -256,8 +256,7 @@ void CGUIWindowMusicPlaylistEditor::UpdatePlaylist()
   OnMessage(msg);
 
   // indicate how many songs we have
-  CStdString items;
-  items.Format("%i %s", m_playlist->Size(), g_localizeStrings.Get(134).c_str()); // "123 Songs"
+  CStdString items = StringUtils::Format("%i %s", m_playlist->Size(), g_localizeStrings.Get(134).c_str()); // "123 Songs"
   SET_CONTROL_LABEL(CONTROL_LABEL_PLAYLIST, items);
 
   m_playlistThumbLoader.Load(*m_playlist);
index c85d48f..d10a94b 100644 (file)
@@ -37,6 +37,7 @@
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "Autorun.h"
 #include "cdrip/CDDARipper.h"
 #include "cores/IPlayer.h"
@@ -279,8 +280,7 @@ void CGUIWindowMusicSongs::UpdateButtons()
   }
 
   // Update object count label
-  CStdString items;
-  items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
+  CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
   SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
 }
 
index 662f525..3c9e8b0 100644 (file)
@@ -242,7 +242,7 @@ void CAirPlayServer::AnnounceToClients(int state)
     if (reverseHeader.size() > 0 && m_reverseSockets.find(it->m_sessionId) != m_reverseSockets.end())
     {
       //search the reverse socket to this sessionid
-      response.Format("POST /event HTTP/1.1\r\n");
+      response = StringUtils::Format("POST /event HTTP/1.1\r\n");
       reverseSocket = m_reverseSockets[it->m_sessionId]; //that is our reverse socket
       response += reverseHeader;
     }
@@ -467,7 +467,7 @@ void CAirPlayServer::CTCPClient::PushBuffer(CAirPlayServer *host, const char *bu
     const time_t ltime = time(NULL);
     char *date = asctime(gmtime(&ltime)); //Fri, 17 Dec 2010 11:18:01 GMT;
     date[strlen(date) - 1] = '\0'; // remove \n
-    response.Format("HTTP/1.1 %d %s\nDate: %s\r\n", status, statusMsg.c_str(), date);
+    response = StringUtils::Format("HTTP/1.1 %d %s\nDate: %s\r\n", status, statusMsg.c_str(), date);
     if (responseHeader.size() > 0)
     {
       response += responseHeader;
@@ -475,7 +475,7 @@ void CAirPlayServer::CTCPClient::PushBuffer(CAirPlayServer *host, const char *bu
 
     if (responseBody.size() > 0)
     {
-      response.Format("%sContent-Length: %d\r\n", response.c_str(), responseBody.size());
+      response = StringUtils::Format("%sContent-Length: %d\r\n", response.c_str(), responseBody.size());
     }
     response += "\r\n";
 
@@ -534,24 +534,23 @@ void CAirPlayServer::CTCPClient::ComposeReverseEvent( CStdString& reverseHeader,
       case EVENT_LOADING:
       case EVENT_PAUSED:
       case EVENT_STOPPED:      
-        reverseBody.Format(EVENT_INFO, m_sessionCounter, eventStrings[state]);
+        reverseBody = StringUtils::Format(EVENT_INFO, m_sessionCounter, eventStrings[state]);
         CLog::Log(LOGDEBUG, "AIRPLAY: sending event: %s", eventStrings[state]);
         break;
     }
     reverseHeader = "Content-Type: text/x-apple-plist+xml\r\n";
-    reverseHeader.Format("%sContent-Length: %d\r\n",reverseHeader.c_str(),reverseBody.size());
-    reverseHeader.Format("%sx-apple-session-id: %s\r\n",reverseHeader.c_str(),m_sessionId.c_str());
+    reverseHeader = StringUtils::Format("%sContent-Length: %d\r\n",reverseHeader.c_str(), reverseBody.size());
+    reverseHeader = StringUtils::Format("%sx-apple-session-id: %s\r\n",reverseHeader.c_str(), m_sessionId.c_str());
     m_lastEvent = state;
   }
 }
 
 void CAirPlayServer::CTCPClient::ComposeAuthRequestAnswer(CStdString& responseHeader, CStdString& responseBody)
 {
-  CStdString randomStr;
   int16_t random=rand();
-  randomStr.Format("%i", random);
+  CStdString randomStr = StringUtils::Format("%i", random);
   m_authNonce=XBMC::XBMC_MD5::GetMD5(randomStr);
-  responseHeader.Format(AUTH_REQUIRED,m_authNonce);
+  responseHeader = StringUtils::Format(AUTH_REQUIRED, m_authNonce.c_str());
   responseBody.clear();
 }
 
@@ -887,7 +886,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader,
       if (g_application.m_pPlayer->GetTotalTime())
       {
         float position = ((float) g_application.m_pPlayer->GetTime()) / 1000;
-        responseBody.Format("duration: %.6f\r\nposition: %.6f\r\n", (float)g_application.m_pPlayer->GetTotalTime() / 1000, position);
+        responseBody = StringUtils::Format("duration: %.6f\r\nposition: %.6f\r\n", (float)g_application.m_pPlayer->GetTotalTime() / 1000, position);
       }
       else 
       {
@@ -991,7 +990,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader,
         cachePosition = position + (duration * g_application.m_pPlayer->GetCachePercentage() / 100.0f);
       }
 
-      responseBody.Format(PLAYBACK_INFO, duration, cachePosition, position, (playing ? 1 : 0), duration);
+      responseBody = StringUtils::Format(PLAYBACK_INFO, duration, cachePosition, position, (playing ? 1 : 0), duration);
       responseHeader = "Content-Type: text/x-apple-plist+xml\r\n";
 
       if (g_application.m_pPlayer->IsCaching())
@@ -1001,7 +1000,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader,
     }
     else
     {
-      responseBody.Format(PLAYBACK_INFO_NOT_READY, duration, cachePosition, position, (playing ? 1 : 0), duration);
+      responseBody = StringUtils::Format(PLAYBACK_INFO_NOT_READY, duration, cachePosition, position, (playing ? 1 : 0), duration);
       responseHeader = "Content-Type: text/x-apple-plist+xml\r\n";     
     }
   }
@@ -1009,7 +1008,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader,
   else if (uri == "/server-info")
   {
     CLog::Log(LOGDEBUG, "AIRPLAY: got request %s", uri.c_str());
-    responseBody.Format(SERVER_INFO, g_application.getNetwork().GetFirstConnectedInterface()->GetMacAddress());
+    responseBody = StringUtils::Format(SERVER_INFO, g_application.getNetwork().GetFirstConnectedInterface()->GetMacAddress().c_str());
     responseHeader = "Content-Type: text/x-apple-plist+xml\r\n";
   }
 
index a02df75..3c1767c 100644 (file)
@@ -47,6 +47,7 @@
 #include "GUIInfoManager.h"
 #include "guilib/GUIWindowManager.h"
 #include "utils/Variant.h"
+#include "utils/StringUtils.h"
 #include "settings/AdvancedSettings.h"
 #include "settings/Settings.h"
 #include "utils/EndianSwap.h"
@@ -537,8 +538,9 @@ bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, con
 
   if (success)
   {
-    CStdString appName;
-    appName.Format("%s@%s", m_macAddress.c_str(), g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME).c_str());
+    CStdString appName = StringUtils::Format("%s@%s",
+                                             m_macAddress.c_str(),
+                                             g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME).c_str());
 
     std::vector<std::pair<std::string, std::string> > txt;
     txt.push_back(std::make_pair("txtvers",  "1"));
@@ -691,9 +693,9 @@ bool CAirTunesServer::Initialize(const CStdString &password)
   CStdString pwStr;
   CStdString portStr;
 
-  hwStr.Format("--mac=%s", m_macAddress.c_str());
-  pwStr.Format("--password=%s",password.c_str());
-  portStr.Format("--server_port=%d",m_port);
+  hwStr = StringUtils::Format("--mac=%s", m_macAddress.c_str());
+  pwStr = StringUtils::Format("--password=%s",password.c_str());
+  portStr = StringUtils::Format("--server_port=%d",m_port);
 
   if (!password.empty())
   {
index 8425b3b..0866fbe 100644 (file)
@@ -21,6 +21,7 @@
 #include "DNSNameCache.h"
 #include "threads/SingleLock.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -47,7 +48,7 @@ bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddre
 
   if (address != INADDR_NONE)
   {
-    strIpAddress.Format("%d.%d.%d.%d", (address & 0xFF), (address & 0xFF00) >> 8, (address & 0xFF0000) >> 16, (address & 0xFF000000) >> 24 );
+    strIpAddress = StringUtils::Format("%d.%d.%d.%d", (address & 0xFF), (address & 0xFF00) >> 8, (address & 0xFF0000) >> 16, (address & 0xFF000000) >> 24 );
     return true;
   }
 
@@ -86,7 +87,11 @@ bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddre
   struct hostent *host = gethostbyname(strHostName.c_str());
   if (host && host->h_addr_list[0])
   {
-    strIpAddress.Format("%d.%d.%d.%d", (unsigned char)host->h_addr_list[0][0], (unsigned char)host->h_addr_list[0][1], (unsigned char)host->h_addr_list[0][2], (unsigned char)host->h_addr_list[0][3]);
+    strIpAddress = StringUtils::Format("%d.%d.%d.%d",
+                                       (unsigned char)host->h_addr_list[0][0],
+                                       (unsigned char)host->h_addr_list[0][1],
+                                       (unsigned char)host->h_addr_list[0][2],
+                                       (unsigned char)host->h_addr_list[0][3]);
     g_DNSCache.Add(strHostName, strIpAddress);
     return true;
   }
index e672284..02830eb 100644 (file)
@@ -24,6 +24,7 @@
 #include "guilib/GUIWindowManager.h"
 #include "guilib/GUIEditControl.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 #include "guilib/LocalizeStrings.h"
 
@@ -437,7 +438,7 @@ void CGUIDialogNetworkSetup::SetPath(const CStdString &path)
     m_protocol = NET_PROTOCOL_SMB;  // default to smb
   m_username = url.GetUserName();
   m_password = url.GetPassWord();
-  m_port.Format("%i", url.GetPort());
+  m_port = StringUtils::Format("%i", url.GetPort());
   m_server = url.GetHostName();
   m_path = url.GetFileName();
   URIUtils::RemoveSlashAtEnd(m_path);
index 10e1267..eca6c47 100644 (file)
@@ -39,6 +39,7 @@
 #include "utils/log.h"
 #include "utils/XMLUtils.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 
 #include "WakeOnAccess.h"
 
@@ -174,8 +175,7 @@ public:
       int nest_level = NestDetect::Level();
       if (nest_level > 1)
       {
-        CStdString nest;
-        nest.Format("Nesting:%d", nest_level);
+        CStdString nest = StringUtils::Format("Nesting:%d", nest_level);
         m_dialog->SetLine(2, nest);
       }
     }
@@ -363,8 +363,7 @@ void CWakeOnAccess::WakeUpHost (const CStdString& hostName, const string& custom
 
 void CWakeOnAccess::WakeUpHost(const WakeUpEntry& server)
 {
-  CStdString heading = LOCALIZED(13027);
-  heading.Format (heading, server.host);
+  CStdString heading = StringUtils::Format(LOCALIZED(13027), server.host.c_str());
 
   ProgressDialogHelper dlg (heading);
 
@@ -564,8 +563,7 @@ void CWakeOnAccess::SaveMACDiscoveryResult(const CStdString& host, const CStdStr
       {
         if (IsEnabled()) // show notification only if we have general feature enabled
         {
-          CStdString message = LOCALIZED(13034);
-          message.Format(message, host);
+          CStdString message = StringUtils::Format(LOCALIZED(13034), host.c_str());
           CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000);
         }
 
@@ -586,8 +584,7 @@ void CWakeOnAccess::SaveMACDiscoveryResult(const CStdString& host, const CStdStr
   CLog::Log(LOGDEBUG, "%s - Create new entry for host '%s'", __FUNCTION__, host.c_str());
   if (IsEnabled()) // show notification only if we have general feature enabled
   {
-    CStdString message = LOCALIZED(13035);
-    message.Format(message, host);
+    CStdString message = StringUtils::Format(LOCALIZED(13035), host.c_str());
     CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000);
   }
 
@@ -614,8 +611,7 @@ void CWakeOnAccess::OnJobComplete(unsigned int jobID, bool success, CJob *job)
     if (IsEnabled())
     {
       CStdString heading = LOCALIZED(13033);
-      CStdString message = LOCALIZED(13036);
-      message.Format(message, host);
+      CStdString message = StringUtils::Format(LOCALIZED(13036), host.c_str());
       CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, heading, message, 4000, true, 3000);
     }
   }
index 9fa969c..b05ef61 100644 (file)
@@ -543,8 +543,7 @@ int CWebServer::CreateFileDownloadResponse(struct MHD_Connection *connection, co
     {
       getData = false;
 
-      CStdString contentLength;
-      contentLength.Format("%" PRId64, fileLength);
+      CStdString contentLength = StringUtils::Format("%" PRId64, fileLength);
 
       response = MHD_create_response_from_data(0, NULL, MHD_NO, MHD_NO);
       if (response == NULL)
index 98d7511..0291297 100644 (file)
@@ -967,7 +967,7 @@ bool Xcddb::queryCDinfo(CCdInfo* pInfo)
   {
   case 200: //Found exact match
     strtok((char *)recv_buffer.c_str(), " ");
-    read_buffer.Format("cddb read %s %08x", strtok(NULL, " "), discid);
+    read_buffer = StringUtils::Format("cddb read %s %08x", strtok(NULL, " "), discid);
     break;
 
   case 210: //Found exact matches, list follows (until terminating marker)
@@ -1071,7 +1071,7 @@ bool Xcddb::isCDCached( CCdInfo* pInfo )
 CStdString Xcddb::GetCacheFile(uint32_t disc_id) const
 {
   CStdString strFileName;
-  strFileName.Format("%x.cddb", disc_id);
+  strFileName = StringUtils::Format("%x.cddb", disc_id);
   return URIUtils::AddFileToFolder(cCacheDir, strFileName);
 }
 
index eaebe41..803d58b 100644 (file)
@@ -63,6 +63,7 @@
 #include "Util.h"
 #include "utils/StringUtils.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 
@@ -71,13 +72,13 @@ CNetworkInterfaceLinux::CNetworkInterfaceLinux(CNetworkLinux* network, CStdStrin
 {
    m_network = network;
    m_interfaceName = interfaceName;
-   m_interfaceMacAdr.Format("%02X:%02X:%02X:%02X:%02X:%02X",
-                  (uint8_t)interfaceMacAddrRaw[0],
-                  (uint8_t)interfaceMacAddrRaw[1],
-                  (uint8_t)interfaceMacAddrRaw[2],
-                  (uint8_t)interfaceMacAddrRaw[3],
-                  (uint8_t)interfaceMacAddrRaw[4],
-                  (uint8_t)interfaceMacAddrRaw[5]);
+   m_interfaceMacAdr = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X",
+                                           (uint8_t)interfaceMacAddrRaw[0],
+                                           (uint8_t)interfaceMacAddrRaw[1],
+                                           (uint8_t)interfaceMacAddrRaw[2],
+                                           (uint8_t)interfaceMacAddrRaw[3],
+                                           (uint8_t)interfaceMacAddrRaw[4],
+                                           (uint8_t)interfaceMacAddrRaw[5]);
    memcpy(m_interfaceMacAddrRaw, interfaceMacAddrRaw, sizeof(m_interfaceMacAddrRaw));
 }
 
@@ -601,8 +602,8 @@ bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, CStdString
           
           u_char *cp = (u_char*)LLADDR(sdl);
           
-          mac.Format("%02X:%02X:%02X:%02X:%02X:%02X",
-                     cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
+          mac = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X",
+                                    cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
           ret = true;
           break;
         }
@@ -639,7 +640,7 @@ bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, CStdString
   }
 
   struct sockaddr* res = &areq.arp_ha;
-  mac.Format("%02X:%02X:%02X:%02X:%02X:%02X", 
+  mac = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X",
     (uint8_t) res->sa_data[0], (uint8_t) res->sa_data[1], (uint8_t) res->sa_data[2], 
     (uint8_t) res->sa_data[3], (uint8_t) res->sa_data[4], (uint8_t) res->sa_data[5]);
 
@@ -793,7 +794,7 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceLinux::GetAccessPoints(void)
                result.push_back(NetworkAccessPoint(essId, macAddress, signalLevel, encryption, channel));
             unsigned char* mac = (unsigned char*)iwe->u.ap_addr.sa_data;
             // macAddress is big-endian, write in byte chunks
-            macAddress.Format("%02x-%02x-%02x-%02x-%02x-%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+            macAddress = StringUtils::Format("%02x-%02x-%02x-%02x-%02x-%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
             // Reset the remaining fields
             essId = "";
             encryption = ENC_NONE;
index 0d0868c..235795f 100644 (file)
@@ -904,8 +904,7 @@ bool GetResource(const PLT_MediaObject* entry, CFileItem& item)
     {
       if(info.Match(PLT_ProtocolInfo("*", "*", allowed[type], "*")))
       {
-        CStdString prop;
-        prop.Format("upnp:subtitle:%d", ++subs);
+        CStdString prop = StringUtils::Format("upnp:subtitle:%d", ++subs);
         item.SetProperty(prop, (const char*)res.m_Uri);
         break;
       }
index b991b42..c8238f1 100644 (file)
@@ -38,6 +38,7 @@
 #include "URL.h"
 #include "utils/URIUtils.h"
 #include "utils/Variant.h"
+#include "utils/StringUtils.h"
 #include "playlists/PlayList.h"
 #include "GUIUserMessages.h"
 
@@ -274,10 +275,10 @@ CUPnPRenderer::Announce(AnnouncementFlag flag, const char *sender, const char *m
 
         CStdString buffer;
 
-        buffer.Format("%ld", data["volume"].asInteger());
+        buffer = StringUtils::Format("%ld", data["volume"].asInteger());
         rct->SetStateVariable("Volume", buffer.c_str());
 
-        buffer.Format("%ld", 256 * (data["volume"].asInteger() * 60 - 60) / 100);
+        buffer = StringUtils::Format("%ld", 256 * (data["volume"].asInteger() * 60 - 60) / 100);
         rct->SetStateVariable("VolumeDb", buffer.c_str());
 
         rct->SetStateVariable("Mute", data["muted"].asBoolean() ? "1" : "0");
@@ -333,9 +334,9 @@ CUPnPRenderer::UpdateState()
         if (slideshow)
         {
           CStdString index;
-          index.Format("%d", slideshow->NumSlides());
+          index = StringUtils::Format("%d", slideshow->NumSlides());
           avt->SetStateVariable("NumberOfTracks", index.c_str());
-          index.Format("%d", slideshow->CurrentSlide());
+          index = StringUtils::Format("%d", slideshow->CurrentSlide());
           avt->SetStateVariable("CurrentTrack", index.c_str());
 
         }
index a32701d..027c272 100644 (file)
@@ -881,25 +881,24 @@ CUPnPServer::OnSearchContainer(PLT_ActionReference&          action,
         if (genre.GetLength() > 0) {
             // all tracks by genre filtered by artist and/or album
             CStdString strPath;
-            strPath.Format("musicdb://genres/%ld/%ld/%ld/",
-                database.GetGenreByName((const char*)genre),
-                database.GetArtistByName((const char*)artist), // will return -1 if no artist
-                database.GetAlbumByName((const char*)album));  // will return -1 if no album
+            strPath = StringUtils::Format("musicdb://genres/%ld/%ld/%ld/",
+                                          database.GetGenreByName((const char*)genre),
+                                          database.GetArtistByName((const char*)artist), // will return -1 if no artist
+                                          database.GetAlbumByName((const char*)album));  // will return -1 if no album
 
             return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
         } else if (artist.GetLength() > 0) {
             // all tracks by artist name filtered by album if passed
             CStdString strPath;
-            strPath.Format("musicdb://artists/%ld/%ld/",
-                database.GetArtistByName((const char*)artist),
-                database.GetAlbumByName((const char*)album)); // will return -1 if no album
+            strPath = StringUtils::Format("musicdb://artists/%ld/%ld/",
+                                          database.GetArtistByName((const char*)artist),
+                                          database.GetAlbumByName((const char*)album)); // will return -1 if no album
 
             return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
         } else if (album.GetLength() > 0) {
             // all tracks by album name
-            CStdString strPath;
-            strPath.Format("musicdb://albums/%ld/",
-                database.GetAlbumByName((const char*)album));
+            CStdString strPath = StringUtils::Format("musicdb://albums/%ld/",
+                                                     database.GetAlbumByName((const char*)album));
 
             return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
         }
@@ -921,15 +920,13 @@ CUPnPServer::OnSearchContainer(PLT_ActionReference&          action,
         database.Open();
 
         if (genre.GetLength() > 0) {
-            CStdString strPath;
-            strPath.Format("musicdb://genres/%ld/%ld/",
-                database.GetGenreByName((const char*)genre),
-                database.GetArtistByName((const char*)artist)); // no artist should return -1
+            CStdString strPath = StringUtils::Format("musicdb://genres/%ld/%ld/",
+                                                     database.GetGenreByName((const char*)genre),
+                                                     database.GetArtistByName((const char*)artist)); // no artist should return -1
             return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
         } else if (artist.GetLength() > 0) {
-            CStdString strPath;
-            strPath.Format("musicdb://artists/%ld/",
-                database.GetArtistByName((const char*)artist));
+            CStdString strPath = StringUtils::Format("musicdb://artists/%ld/",
+                                                     database.GetArtistByName((const char*)artist));
             return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
         }
 
@@ -941,8 +938,7 @@ CUPnPServer::OnSearchContainer(PLT_ActionReference&          action,
         if (genre.GetLength() > 0) {
             CMusicDatabase database;
             database.Open();
-            CStdString strPath;
-            strPath.Format("musicdb://genres/%ld/", database.GetGenreByName((const char*)genre));
+            CStdString strPath = StringUtils::Format("musicdb://genres/%ld/", database.GetGenreByName((const char*)genre));
             return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
         }
         return OnBrowseDirectChildren(action, "musicdb://artists/", filter, starting_index, requested_count, sort_criteria, context);
index d642c09..6a9b250 100644 (file)
@@ -26,6 +26,7 @@
 #include "utils/log.h"
 #include "threads/SingleLock.h"
 #include "utils/CharsetConverter.h"
+#include "utils/StringUtils.h"
 
 // undefine if you want to build without the wlan stuff
 // might be needed for VS2003
@@ -78,7 +79,7 @@ CStdString CNetworkInterfaceWin32::GetMacAddress()
 {
   CStdString result;
   unsigned char* mAddr = m_adapter.Address;
-  result.Format("%02X:%02X:%02X:%02X:%02X:%02X", mAddr[0], mAddr[1], mAddr[2], mAddr[3], mAddr[4], mAddr[5]);
+  result = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X", mAddr[0], mAddr[1], mAddr[2], mAddr[3], mAddr[4], mAddr[5]);
   return result;
 }
 
@@ -301,7 +302,7 @@ bool CNetworkInterfaceWin32::GetHostMacAddress(unsigned long host, CStdString& m
   {
     if (PhysAddrLen == 6)
     {
-      mac.Format("%02X:%02X:%02X:%02X:%02X:%02X", 
+      mac = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X", 
         bPhysAddr[0], bPhysAddr[1], bPhysAddr[2], 
         bPhysAddr[3], bPhysAddr[4], bPhysAddr[5]);
       return true;
@@ -375,7 +376,7 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceWin32::GetAccessPoints(void)
         CStdString essId((char*)bss_entry.dot11Ssid.ucSSID, (unsigned int)bss_entry.dot11Ssid.uSSIDLength);
         CStdString macAddress;
         // macAddress is big-endian, write in byte chunks
-        macAddress.Format("%02x-%02x-%02x-%02x-%02x-%02x",
+        macAddress = StringUtils::Format("%02x-%02x-%02x-%02x-%02x-%02x",
           bss_entry.dot11Bssid[0], bss_entry.dot11Bssid[1], bss_entry.dot11Bssid[2],
           bss_entry.dot11Bssid[3], bss_entry.dot11Bssid[4], bss_entry.dot11Bssid[5]);
         int signalLevel = bss_entry.lRssi;
index 1e720c5..865da2b 100644 (file)
@@ -25,6 +25,7 @@
 #include "PlatformDefs.h"
 #endif
 #include "utils/StdString.h"
+#include "utils/StringUtils.h"
 
 class CSetting;
 
@@ -182,7 +183,7 @@ namespace PERIPHERALS
       if (iVal > 65536)
         iVal = 65536;
 
-      strHexString.Format("%04X", iVal);
+      strHexString = StringUtils::Format("%04X", iVal);
     };
   };
 
index ec4e9b4..2658218 100644 (file)
@@ -22,6 +22,7 @@
 #include "peripherals/Peripherals.h"
 #include <usb.h>
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 
 using namespace PERIPHERALS;
 
@@ -51,9 +52,9 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results)
                                  GetType(dev->config[0].interface[0].altsetting[0].bInterfaceClass) :
                                  GetType(dev->descriptor.bDeviceClass);
 #ifdef TARGET_FREEBSD
-      result.m_strLocation.Format("%s", dev->filename);
+      result.m_strLocation = StringUtils::Format("%s", dev->filename);
 #else
-      result.m_strLocation.Format("/bus%s/dev%s", bus->dirname, dev->filename);
+      result.m_strLocation = StringUtils::Format("/bus%s/dev%s", bus->dirname, dev->filename);
 #endif
       result.m_iSequence   = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId);
       if (!results.ContainsResult(result))
index 88c856a..6dc8034 100644 (file)
@@ -258,9 +258,9 @@ void CPeripheralBusUSB::DeviceAttachCallback(CPeripheralBusUSB* refCon, io_itera
           }
         }
         if (!ttlDeviceFilePath.empty())
-          privateDataRef->result.m_strLocation.Format("%s", ttlDeviceFilePath.c_str());
+          privateDataRef->result.m_strLocation = StringUtils::Format("%s", ttlDeviceFilePath.c_str());
         else
-          privateDataRef->result.m_strLocation.Format("%d", locationId);
+          privateDataRef->result.m_strLocation = StringUtils::Format("%d", locationId);
 
         if (bDeviceClass == kUSBCompositeClass)
           privateDataRef->result.m_type = refCon->GetType(bInterfaceClass);
index dd2db26..67edb26 100644 (file)
@@ -46,7 +46,10 @@ CPeripheral::CPeripheral(const PeripheralScanResult& scanResult) :
 {
   PeripheralTypeTranslator::FormatHexString(scanResult.m_iVendorId, m_strVendorId);
   PeripheralTypeTranslator::FormatHexString(scanResult.m_iProductId, m_strProductId);
-  m_strFileLocation.Format(scanResult.m_iSequence > 0 ? "peripherals://%s/%s_%d.dev" : "peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(scanResult.m_busType), scanResult.m_strLocation.c_str(), scanResult.m_iSequence);
+  m_strFileLocation = StringUtils::Format(scanResult.m_iSequence > 0 ? "peripherals://%s/%s_%d.dev" : "peripherals://%s/%s.dev",
+                                          PeripheralTypeTranslator::BusTypeToString(scanResult.m_busType),
+                                          scanResult.m_strLocation.c_str(),
+                                          scanResult.m_iSequence);
 }
 
 CPeripheral::~CPeripheral(void)
@@ -122,7 +125,10 @@ bool CPeripheral::Initialise(void)
     return bReturn;
 
   g_peripherals.GetSettingsFromMapping(*this);
-  m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_mappedBusType), m_strVendorId.c_str(), m_strProductId.c_str());
+  m_strSettingsFile = StringUtils::Format("special://profile/peripheral_data/%s_%s_%s.xml",
+                                          PeripheralTypeTranslator::BusTypeToString(m_mappedBusType),
+                                          m_strVendorId.c_str(),
+                                          m_strProductId.c_str());
   LoadPersistedSettings();
 
   for (unsigned int iFeaturePtr = 0; iFeaturePtr < m_features.size(); iFeaturePtr++)
@@ -426,21 +432,21 @@ void CPeripheral::PersistSettings(bool bExiting /* = false */)
       {
         CSettingInt *intSetting = (CSettingInt *) (*itr).second;
         if (intSetting)
-          strValue.Format("%d", intSetting->GetValue());
+          strValue = StringUtils::Format("%d", intSetting->GetValue());
       }
       break;
     case SettingTypeNumber:
       {
         CSettingNumber *floatSetting = (CSettingNumber *) (*itr).second;
         if (floatSetting)
-          strValue.Format("%.2f", floatSetting->GetValue());
+          strValue = StringUtils::Format("%.2f", floatSetting->GetValue());
       }
       break;
     case SettingTypeBool:
       {
         CSettingBool *boolSetting = (CSettingBool *) (*itr).second;
         if (boolSetting)
-          strValue.Format("%d", boolSetting->GetValue() ? 1:0);
+          strValue = StringUtils::Format("%d", boolSetting->GetValue() ? 1:0);
       }
       break;
     default:
index 3765365..ac4b244 100644 (file)
@@ -269,8 +269,7 @@ bool CPeripheralCecAdapter::InitialiseFeature(const PeripheralFeature feature)
       CLog::Log(LOGERROR, g_localizeStrings.Get(36040).c_str(), m_cecAdapter ? m_configuration.serverVersion : -1, CEC_LIB_SUPPORTED_VERSION);
 
       // display warning: incompatible libCEC
-      CStdString strMessage;
-      strMessage.Format(g_localizeStrings.Get(36040).c_str(), m_cecAdapter ? m_configuration.serverVersion : -1, CEC_LIB_SUPPORTED_VERSION);
+      CStdString strMessage = StringUtils::Format(g_localizeStrings.Get(36040).c_str(), m_cecAdapter ? m_configuration.serverVersion : -1, CEC_LIB_SUPPORTED_VERSION);
       CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(36000), strMessage);
       m_bError = true;
       if (m_cecAdapter)
@@ -295,7 +294,7 @@ bool CPeripheralCecAdapter::InitialiseFeature(const PeripheralFeature feature)
 
 void CPeripheralCecAdapter::SetVersionInfo(const libcec_configuration &configuration)
 {
-  m_strVersionInfo.Format("libCEC %s - firmware v%d", m_cecAdapter->ToString((cec_server_version)configuration.serverVersion), configuration.iFirmwareVersion);
+  m_strVersionInfo = StringUtils::Format("libCEC %s - firmware v%d", m_cecAdapter->ToString((cec_server_version)configuration.serverVersion), configuration.iFirmwareVersion);
 
   // append firmware build date
   if (configuration.iFirmwareBuildDate != CEC_FW_BUILD_UNKNOWN)
@@ -320,8 +319,7 @@ bool CPeripheralCecAdapter::OpenConnection(void)
   CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, m_strComPort.c_str());
 
   // scanning the CEC bus takes about 5 seconds, so display a notification to inform users that we're busy
-  CStdString strMessage;
-  strMessage.Format(g_localizeStrings.Get(21336), g_localizeStrings.Get(36000));
+  CStdString strMessage = StringUtils::Format(g_localizeStrings.Get(21336).c_str(), g_localizeStrings.Get(36000).c_str());
   CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), strMessage);
 
   bool bConnectionFailedDisplayed(false);
@@ -1217,7 +1215,7 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu
       m_configuration.iHDMIPort > CEC_MAX_HDMI_PORTNUMBER))
   {
     m_configuration.iPhysicalAddress = config.iPhysicalAddress;
-    strPhysicalAddress.Format("%x", config.iPhysicalAddress);
+    strPhysicalAddress = StringUtils::Format("%x", config.iPhysicalAddress);
   }
   bChanged |= SetSetting("physical_address", strPhysicalAddress);
 
@@ -1538,7 +1536,7 @@ bool CPeripheralCecAdapterUpdateThread::SetInitialConfiguration(void)
   // request the OSD name of the TV
   CStdString strNotification;
   cec_osd_name tvName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV);
-  strNotification.Format("%s: %s", g_localizeStrings.Get(36016), tvName.name);
+  strNotification = StringUtils::Format("%s: %s", g_localizeStrings.Get(36016).c_str(), tvName.name);
 
   CStdString strAmpName = UpdateAudioSystemStatus();
   if (!strAmpName.empty())
index 43fa12c..0718692 100644 (file)
@@ -54,7 +54,7 @@ bool CPeripheralHID::InitialiseFeature(const PeripheralFeature feature)
 
     if (m_strKeymap.IsEmpty())
     {
-      m_strKeymap.Format("v%sp%s", VendorIdAsString(), ProductIdAsString());
+      m_strKeymap = StringUtils::Format("v%sp%s", VendorIdAsString(), ProductIdAsString());
       SetSetting("keymap", m_strKeymap);
     }
 
index 7dbaeb2..4750a9b 100644 (file)
@@ -295,7 +295,7 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
   switch (info)
   {
   case SLIDE_RESOLUTION:
-    value.Format("%d x %d", m_exifInfo.Width, m_exifInfo.Height);
+    value = StringUtils::Format("%d x %d", m_exifInfo.Width, m_exifInfo.Height);
     break;
   case SLIDE_COLOUR:
     value = m_exifInfo.IsColor ? "Colour" : "Black and White";
@@ -369,7 +369,7 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
 //    value = m_exifInfo.Software;
   case SLIDE_EXIF_APERTURE:
     if (m_exifInfo.ApertureFNumber)
-      value.Format("%3.1f", m_exifInfo.ApertureFNumber);
+      value = StringUtils::Format("%3.1f", m_exifInfo.ApertureFNumber);
     break;
   case SLIDE_EXIF_ORIENTATION:
     switch (m_exifInfo.Orientation)
@@ -387,7 +387,7 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
   case SLIDE_EXIF_FOCAL_LENGTH:
     if (m_exifInfo.FocalLength)
     {
-      value.Format("%4.2fmm", m_exifInfo.FocalLength);
+      value = StringUtils::Format("%4.2fmm", m_exifInfo.FocalLength);
       if (m_exifInfo.FocalLength35mmEquiv != 0)
         value.AppendFormat("  (35mm Equivalent = %umm)", m_exifInfo.FocalLength35mmEquiv);
     }
@@ -396,7 +396,7 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
     if (m_exifInfo.Distance < 0)
       value = "Infinite";
     else if (m_exifInfo.Distance > 0)
-      value.Format("%4.2fm", m_exifInfo.Distance);
+      value = StringUtils::Format("%4.2fm", m_exifInfo.Distance);
     break;
   case SLIDE_EXIF_EXPOSURE:
     switch (m_exifInfo.ExposureProgram)
@@ -415,16 +415,16 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
     if (m_exifInfo.ExposureTime)
     {
       if (m_exifInfo.ExposureTime < 0.010f)
-        value.Format("%6.4fs", m_exifInfo.ExposureTime);
+        value = StringUtils::Format("%6.4fs", m_exifInfo.ExposureTime);
       else
-        value.Format("%5.3fs", m_exifInfo.ExposureTime);
+        value = StringUtils::Format("%5.3fs", m_exifInfo.ExposureTime);
       if (m_exifInfo.ExposureTime <= 0.5)
         value.AppendFormat(" (1/%d)", (int)(0.5 + 1/m_exifInfo.ExposureTime));
     }
     break;
   case SLIDE_EXIF_EXPOSURE_BIAS:
     if (m_exifInfo.ExposureBias != 0)
-      value.Format("%4.2f EV", m_exifInfo.ExposureBias);
+      value = StringUtils::Format("%4.2f EV", m_exifInfo.ExposureBias);
     break;
   case SLIDE_EXIF_EXPOSURE_MODE:
     switch (m_exifInfo.ExposureMode)
@@ -491,15 +491,15 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
     break;
   case SLIDE_EXIF_ISO_EQUIV:
     if (m_exifInfo.ISOequivalent)
-      value.Format("%2d", m_exifInfo.ISOequivalent);
+      value = StringUtils::Format("%2d", m_exifInfo.ISOequivalent);
     break;
   case SLIDE_EXIF_DIGITAL_ZOOM:
     if (m_exifInfo.DigitalZoomRatio)
-      value.Format("%1.3fx", m_exifInfo.DigitalZoomRatio);
+      value = StringUtils::Format("%1.3fx", m_exifInfo.DigitalZoomRatio);
     break;
   case SLIDE_EXIF_CCD_WIDTH:
     if (m_exifInfo.CCDWidth)
-      value.Format("%4.2fmm", m_exifInfo.CCDWidth);
+      value = StringUtils::Format("%4.2fmm", m_exifInfo.CCDWidth);
     break;
   case SLIDE_EXIF_GPS_LATITUDE:
     value = m_exifInfo.GpsLat;
index 202592e..341a456 100644 (file)
@@ -163,19 +163,18 @@ void CPlayListM3U::Save(const CStdString& strFileName) const
     CLog::Log(LOGERROR, "Could not save M3U playlist: [%s]", strPlaylist.c_str());
     return;
   }
-  CStdString strLine;
-  strLine.Format("%s\n",M3U_START_MARKER);
+  CStdString strLine = StringUtils::Format("%s\n",M3U_START_MARKER);
   file.Write(strLine.c_str(),strLine.size());
   for (int i = 0; i < (int)m_vecItems.size(); ++i)
   {
     CFileItemPtr item = m_vecItems[i];
     CStdString strDescription=item->GetLabel();
     g_charsetConverter.utf8ToStringCharset(strDescription);
-    strLine.Format( "%s:%i,%s\n", M3U_INFO_MARKER, item->GetMusicInfoTag()->GetDuration() / 1000, strDescription.c_str() );
+    strLine = StringUtils::Format( "%s:%i,%s\n", M3U_INFO_MARKER, item->GetMusicInfoTag()->GetDuration() / 1000, strDescription.c_str() );
     file.Write(strLine.c_str(),strLine.size());
     CStdString strFileName = ResolveURL(item);
     g_charsetConverter.utf8ToStringCharset(strFileName);
-    strLine.Format("%s\n",strFileName.c_str());
+    strLine = StringUtils::Format("%s\n",strFileName.c_str());
     file.Write(strLine.c_str(),strLine.size());
   }
   file.Close();
index 571b03b..c030af8 100644 (file)
@@ -602,9 +602,7 @@ bool CSmartPlaylistRule::CanGroupMix(Field group)
 
 CStdString CSmartPlaylistRule::GetLocalizedRule() const
 {
-  CStdString rule;
-  rule.Format("%s %s %s", GetLocalizedField(m_field).c_str(), GetLocalizedOperator(m_operator).c_str(), GetParameter().c_str());
-  return rule;
+  return StringUtils::Format("%s %s %s", GetLocalizedField(m_field).c_str(), GetLocalizedOperator(m_operator).c_str(), GetParameter().c_str());
 }
 
 CStdString CSmartPlaylistRule::GetVideoResolutionQuery(const CStdString &parameter) const
@@ -686,7 +684,7 @@ CStdString CSmartPlaylistRule::FormatParameter(const CStdString &operatorString,
   // special-casing
   if (m_field == FieldTime)
   { // translate time to seconds
-    CStdString seconds; seconds.Format("%i", StringUtils::TimeStringToSeconds(param));
+    CStdString seconds = StringUtils::Format("%i", StringUtils::TimeStringToSeconds(param));
     return db.PrepareSQL(operatorString.c_str(), seconds.c_str());
   }
   return CDatabaseQueryRule::FormatParameter(operatorString, param, db, strType);
@@ -889,7 +887,7 @@ CStdString CSmartPlaylistRuleCombination::GetWhereClause(const CDatabase &db, co
           if (playlist.GetType().Equals(strType))
           {
             if ((*it)->m_operator == CDatabaseQueryRule::OPERATOR_DOES_NOT_EQUAL)
-              currentRule.Format("NOT (%s)", playlistQuery.c_str());
+              currentRule = StringUtils::Format("NOT (%s)", playlistQuery.c_str());
             else
               currentRule = playlistQuery;
           }
index 7896bc4..c6f6a80 100644 (file)
@@ -26,6 +26,7 @@
 #include "guilib/GUIWindowManager.h"
 #include "URL.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 CGUIDialogLockSettings::CGUIDialogLockSettings(void)
     : CGUIDialogSettings(WINDOW_DIALOG_LOCK_SETTINGS, "LockSettings.xml")
@@ -48,11 +49,10 @@ void CGUIDialogLockSettings::SetupPage()
   // update our settings label
   if (m_bGetUser)
   {
-    CStdString strLabel;
     CStdString strLabel2=m_strURL;
     CURL::Decode(strLabel2);
-    strLabel.Format(g_localizeStrings.Get(20152),strLabel2.c_str());
-    SET_CONTROL_LABEL(2,strLabel);
+    CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20152), strLabel2.c_str());
+    SET_CONTROL_LABEL(2, strLabel);
   }
   else
     SET_CONTROL_LABEL(2,g_localizeStrings.Get(20066));
@@ -77,10 +77,10 @@ void CGUIDialogLockSettings::CreateSettings()
   {
     AddButton(1,20142);
     if (!m_strUser.IsEmpty())
-      m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
+      m_settings[0].name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
     AddButton(2,12326);
     if (!m_locks.code.IsEmpty())
-      m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
+      m_settings[1].name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
     if (m_saveUserDetails)
       AddBool(3, 13423, m_saveUserDetails);
     return;
@@ -89,9 +89,9 @@ void CGUIDialogLockSettings::CreateSettings()
   if (m_locks.mode > LOCK_MODE_QWERTY)
     m_locks.mode = LOCK_MODE_EVERYONE;
   if (m_locks.mode != LOCK_MODE_EVERYONE)
-    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
+    m_settings[0].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(m_iButtonLabel).c_str(), g_localizeStrings.Get(12336+m_locks.mode).c_str());
   else
-    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
+    m_settings[0].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(m_iButtonLabel).c_str(), g_localizeStrings.Get(1223).c_str());
 
   if (m_bDetails)
   {
@@ -125,11 +125,11 @@ void CGUIDialogLockSettings::OnSettingChanged(SettingInfo &setting)
       CStdString strHeading;
       CStdString strDecodeUrl = m_strURL;
       CURL::Decode(strDecodeUrl);
-      strHeading.Format("%s %s",g_localizeStrings.Get(14062).c_str(),strDecodeUrl.c_str());
+      strHeading = StringUtils::Format("%s %s", g_localizeStrings.Get(14062).c_str(), strDecodeUrl.c_str());
       if (CGUIKeyboardFactory::ShowAndGetInput(m_strUser,strHeading,true))
       {
         m_bChanged = true;
-        m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
+        m_settings[0].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(20142).c_str(), m_strUser.c_str());
         UpdateSetting(1);
       }
       return;
@@ -178,22 +178,21 @@ void CGUIDialogLockSettings::OnSettingChanged(SettingInfo &setting)
         EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
       m_bChanged = true;
       if (m_locks.mode != LOCK_MODE_EVERYONE)
-        setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
+        setting.name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
       else
-        setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
+        setting.name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
 
       UpdateSetting(1);
     }
   }
   if (setting.id == 2 && m_bGetUser)
   {
-    CStdString strHeading;
     CStdString strDecodeUrl = m_strURL;
     CURL::Decode(strDecodeUrl);
-    strHeading.Format("%s %s",g_localizeStrings.Get(20143).c_str(),strDecodeUrl.c_str());
+    CStdString strHeading = StringUtils::Format("%s %s", g_localizeStrings.Get(20143).c_str(), strDecodeUrl.c_str());
     if (CGUIKeyboardFactory::ShowAndGetInput(m_locks.code,strHeading,true,true))
     {
-      m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
+      m_settings[1].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(12326).c_str(), g_localizeStrings.Get(20141).c_str());
       m_bChanged = true;
       UpdateSetting(2);
     }
index 55074fe..a2b3f90 100644 (file)
@@ -439,192 +439,192 @@ int CPVRGUIInfo::TranslateIntInfo(DWORD dwInfo) const
 
 void CPVRGUIInfo::CharInfoActiveTimerTitle(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strActiveTimerTitle);
+  strValue = StringUtils::Format("%s", m_strActiveTimerTitle.c_str());
 }
 
 void CPVRGUIInfo::CharInfoActiveTimerChannelName(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strActiveTimerChannelName);
+  strValue = StringUtils::Format("%s", m_strActiveTimerChannelName.c_str());
 }
 
 void CPVRGUIInfo::CharInfoActiveTimerChannelIcon(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strActiveTimerChannelIcon);
+  strValue = StringUtils::Format("%s", m_strActiveTimerChannelIcon.c_str());
 }
 
 void CPVRGUIInfo::CharInfoActiveTimerDateTime(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strActiveTimerTime);
+  strValue = StringUtils::Format("%s", m_strActiveTimerTime.c_str());
 }
 
 void CPVRGUIInfo::CharInfoNextTimerTitle(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strNextRecordingTitle);
+  strValue = StringUtils::Format("%s", m_strNextRecordingTitle.c_str());
 }
 
 void CPVRGUIInfo::CharInfoNextTimerChannelName(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strNextRecordingChannelName);
+  strValue = StringUtils::Format("%s", m_strNextRecordingChannelName.c_str());
 }
 
 void CPVRGUIInfo::CharInfoNextTimerChannelIcon(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strNextRecordingChannelIcon);
+  strValue = StringUtils::Format("%s", m_strNextRecordingChannelIcon.c_str());
 }
 
 void CPVRGUIInfo::CharInfoNextTimerDateTime(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strNextRecordingTime);
+  strValue = StringUtils::Format("%s", m_strNextRecordingTime.c_str());
 }
 
 void CPVRGUIInfo::CharInfoPlayingDuration(CStdString &strValue) const
 {
-  strValue.Format("%s", StringUtils::SecondsToTimeString(m_iDuration / 1000, TIME_FORMAT_GUESS));
+  strValue = StringUtils::Format("%s", StringUtils::SecondsToTimeString(m_iDuration / 1000, TIME_FORMAT_GUESS).c_str());
 }
 
 void CPVRGUIInfo::CharInfoPlayingTime(CStdString &strValue) const
 {
-  strValue.Format("%s", StringUtils::SecondsToTimeString(GetStartTime()/1000, TIME_FORMAT_GUESS));
+  strValue = StringUtils::Format("%s", StringUtils::SecondsToTimeString(GetStartTime()/1000, TIME_FORMAT_GUESS).c_str());
 }
 
 void CPVRGUIInfo::CharInfoNextTimer(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strNextTimerInfo);
+  strValue = StringUtils::Format("%s", m_strNextTimerInfo.c_str());
 }
 
 void CPVRGUIInfo::CharInfoBackendNumber(CStdString &strValue) const
 {
   if (m_iActiveClients > 0)
-    strValue.Format("%u %s %u", m_iAddonInfoToggleCurrent+1, g_localizeStrings.Get(20163), m_iActiveClients);
+    strValue = StringUtils::Format("%u %s %u", m_iAddonInfoToggleCurrent+1, g_localizeStrings.Get(20163).c_str(), m_iActiveClients);
   else
-    strValue.Format("%s", g_localizeStrings.Get(14023));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(14023).c_str());
 }
 
 void CPVRGUIInfo::CharInfoTotalDiskSpace(CStdString &strValue) const
 {
-  strValue.Format("%s", m_strTotalDiskspace);
+  strValue = StringUtils::Format("%s", m_strTotalDiskspace.c_str());
 }
 
 void CPVRGUIInfo::CharInfoVideoBR(CStdString &strValue) const
 {
-  strValue.Format("%.2f Mbit/s", m_qualityInfo.dVideoBitrate);
+  strValue = StringUtils::Format("%.2f Mbit/s", m_qualityInfo.dVideoBitrate);
 }
 
 void CPVRGUIInfo::CharInfoAudioBR(CStdString &strValue) const
 {
-  strValue.Format("%.0f kbit/s", m_qualityInfo.dAudioBitrate);
+  strValue = StringUtils::Format("%.0f kbit/s", m_qualityInfo.dAudioBitrate);
 }
 
 void CPVRGUIInfo::CharInfoDolbyBR(CStdString &strValue) const
 {
-  strValue.Format("%.0f kbit/s", m_qualityInfo.dDolbyBitrate);
+  strValue = StringUtils::Format("%.0f kbit/s", m_qualityInfo.dDolbyBitrate);
 }
 
 void CPVRGUIInfo::CharInfoSignal(CStdString &strValue) const
 {
-  strValue.Format("%d %%", m_qualityInfo.iSignal / 655);
+  strValue = StringUtils::Format("%d %%", m_qualityInfo.iSignal / 655);
 }
 
 void CPVRGUIInfo::CharInfoSNR(CStdString &strValue) const
 {
-  strValue.Format("%d %%", m_qualityInfo.iSNR / 655);
+  strValue = StringUtils::Format("%d %%", m_qualityInfo.iSNR / 655);
 }
 
 void CPVRGUIInfo::CharInfoBER(CStdString &strValue) const
 {
-  strValue.Format("%08X", m_qualityInfo.iBER);
+  strValue = StringUtils::Format("%08X", m_qualityInfo.iBER);
 }
 
 void CPVRGUIInfo::CharInfoUNC(CStdString &strValue) const
 {
-  strValue.Format("%08X", m_qualityInfo.iUNC);
+  strValue = StringUtils::Format("%08X", m_qualityInfo.iUNC);
 }
 
 void CPVRGUIInfo::CharInfoFrontendName(CStdString &strValue) const
 {
   if (!strcmp(m_qualityInfo.strAdapterName, StringUtils::EmptyString))
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_qualityInfo.strAdapterName);
+    strValue = StringUtils::Format("%s", m_qualityInfo.strAdapterName);
 }
 
 void CPVRGUIInfo::CharInfoFrontendStatus(CStdString &strValue) const
 {
   if (!strcmp(m_qualityInfo.strAdapterStatus, StringUtils::EmptyString))
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_qualityInfo.strAdapterStatus);
+    strValue = StringUtils::Format("%s", m_qualityInfo.strAdapterStatus);
 }
 
 void CPVRGUIInfo::CharInfoBackendName(CStdString &strValue) const
 {
   if (m_strBackendName.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_strBackendName);
+    strValue = StringUtils::Format("%s", m_strBackendName.c_str());
 }
 
 void CPVRGUIInfo::CharInfoBackendVersion(CStdString &strValue) const
 {
   if (m_strBackendVersion.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s",  m_strBackendVersion);
+    strValue = StringUtils::Format("%s",  m_strBackendVersion.c_str());
 }
 
 void CPVRGUIInfo::CharInfoBackendHost(CStdString &strValue) const
 {
   if (m_strBackendHost.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_strBackendHost);
+    strValue = StringUtils::Format("%s", m_strBackendHost.c_str());
 }
 
 void CPVRGUIInfo::CharInfoBackendDiskspace(CStdString &strValue) const
 {
   if (m_strBackendDiskspace.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_strBackendDiskspace);
+    strValue = StringUtils::Format("%s", m_strBackendDiskspace.c_str());
 }
 
 void CPVRGUIInfo::CharInfoBackendChannels(CStdString &strValue) const
 {
   if (m_strBackendChannels.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_strBackendChannels);
+    strValue = StringUtils::Format("%s", m_strBackendChannels.c_str());
 }
 
 void CPVRGUIInfo::CharInfoBackendTimers(CStdString &strValue) const
 {
   if (m_strBackendTimers.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_strBackendTimers);
+    strValue = StringUtils::Format("%s", m_strBackendTimers.c_str());
 }
 
 void CPVRGUIInfo::CharInfoBackendRecordings(CStdString &strValue) const
 {
   if (m_strBackendRecordings.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_strBackendRecordings);
+    strValue = StringUtils::Format("%s", m_strBackendRecordings.c_str());
 }
 
 void CPVRGUIInfo::CharInfoPlayingClientName(CStdString &strValue) const
 {
   if (m_strPlayingClientName.IsEmpty())
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_strPlayingClientName);
+    strValue = StringUtils::Format("%s", m_strPlayingClientName.c_str());
 }
 
 void CPVRGUIInfo::CharInfoEncryption(CStdString &strValue) const
 {
   CPVRChannelPtr channel;
   if (g_PVRClients->GetPlayingChannel(channel))
-    strValue.Format("%s", channel->EncryptionName().c_str());
+    strValue = StringUtils::Format("%s", channel->EncryptionName().c_str());
   else
     strValue = StringUtils::EmptyString;
 }
@@ -632,25 +632,25 @@ void CPVRGUIInfo::CharInfoEncryption(CStdString &strValue) const
 void CPVRGUIInfo::CharInfoService(CStdString &strValue) const
 {
   if (!strcmp(m_qualityInfo.strServiceName, StringUtils::EmptyString))
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_qualityInfo.strServiceName);
+    strValue = StringUtils::Format("%s", m_qualityInfo.strServiceName);
 }
 
 void CPVRGUIInfo::CharInfoMux(CStdString &strValue) const
 {
   if (!strcmp(m_qualityInfo.strMuxName, StringUtils::EmptyString))
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_qualityInfo.strMuxName);
+    strValue = StringUtils::Format("%s", m_qualityInfo.strMuxName);
 }
 
 void CPVRGUIInfo::CharInfoProvider(CStdString &strValue) const
 {
   if (!strcmp(m_qualityInfo.strProviderName, StringUtils::EmptyString))
-    strValue.Format("%s", g_localizeStrings.Get(13205));
+    strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
   else
-    strValue.Format("%s", m_qualityInfo.strProviderName);
+    strValue = StringUtils::Format("%s", m_qualityInfo.strProviderName);
 }
 
 void CPVRGUIInfo::UpdateBackendCache(void)
@@ -684,8 +684,8 @@ void CPVRGUIInfo::UpdateBackendCache(void)
     {
       kBTotal /= 1024; // Convert to MBytes
       kBUsed /= 1024;  // Convert to MBytes
-      strBackendDiskspace.Format("%s %.1f GByte - %s: %.1f GByte",
-          g_localizeStrings.Get(20161), (float) kBTotal / 1024, g_localizeStrings.Get(20162), (float) kBUsed / 1024);
+      strBackendDiskspace = StringUtils::Format("%s %.1f GByte - %s: %.1f GByte",
+          g_localizeStrings.Get(20161).c_str(), (float) kBTotal / 1024, g_localizeStrings.Get(20162).c_str(), (float) kBUsed / 1024);
     }
     else
     {
@@ -694,19 +694,19 @@ void CPVRGUIInfo::UpdateBackendCache(void)
 
     int NumChannels = activeClient->second->GetChannelsAmount();
     if (NumChannels >= 0)
-      strBackendChannels.Format("%i", NumChannels);
+      strBackendChannels = StringUtils::Format("%i", NumChannels);
     else
       strBackendChannels = g_localizeStrings.Get(161);
 
     int NumTimers = activeClient->second->GetTimersAmount();
     if (NumTimers >= 0)
-      strBackendTimers.Format("%i", NumTimers);
+      strBackendTimers = StringUtils::Format("%i", NumTimers);
     else
       strBackendTimers = g_localizeStrings.Get(161);
 
     int NumRecordings = activeClient->second->GetRecordingsAmount();
     if (NumRecordings >= 0)
-      strBackendRecordings.Format("%i", NumRecordings);
+      strBackendRecordings = StringUtils::Format("%i", NumRecordings);
     else
       strBackendRecordings = g_localizeStrings.Get(161);
 
@@ -753,16 +753,16 @@ void CPVRGUIInfo::UpdateNextTimer(void)
   if (tag && tag->HasPVRTimerInfoTag())
   {
     CPVRTimerInfoTag *timer = tag->GetPVRTimerInfoTag();
-    strNextRecordingTitle.Format("%s",       timer->Title());
-    strNextRecordingChannelName.Format("%s", timer->ChannelName());
-    strNextRecordingChannelIcon.Format("%s", timer->ChannelIcon());
-    strNextRecordingTime.Format("%s",        timer->StartAsLocalTime().GetAsLocalizedDateTime(false, false));
-
-    strNextTimerInfo.Format("%s %s %s %s",
-        g_localizeStrings.Get(19106),
-        timer->StartAsLocalTime().GetAsLocalizedDate(true),
-        g_localizeStrings.Get(19107),
-        timer->StartAsLocalTime().GetAsLocalizedTime("HH:mm", false));
+    strNextRecordingTitle = StringUtils::Format("%s",       timer->Title().c_str());
+    strNextRecordingChannelName = StringUtils::Format("%s", timer->ChannelName().c_str());
+    strNextRecordingChannelIcon = StringUtils::Format("%s", timer->ChannelIcon().c_str());
+    strNextRecordingTime = StringUtils::Format("%s",        timer->StartAsLocalTime().GetAsLocalizedDateTime(false, false).c_str());
+
+    strNextTimerInfo = StringUtils::Format("%s %s %s %s",
+        g_localizeStrings.Get(19106).c_str(),
+        timer->StartAsLocalTime().GetAsLocalizedDate(true).c_str(),
+        g_localizeStrings.Get(19107).c_str(),
+        timer->StartAsLocalTime().GetAsLocalizedTime("HH:mm", false).c_str());
   }
 
   CSingleLock lock(m_critSection);
@@ -790,10 +790,10 @@ void CPVRGUIInfo::UpdateTimersToggle(void)
     if (m_iTimerInfoToggleCurrent < activeTags.size() && activeTags.at(m_iTimerInfoToggleCurrent)->HasPVRTimerInfoTag())
     {
       CPVRTimerInfoTag *tag = activeTags.at(m_iTimerInfoToggleCurrent)->GetPVRTimerInfoTag();
-      strActiveTimerTitle.Format("%s",       tag->Title());
-      strActiveTimerChannelName.Format("%s", tag->ChannelName());
-      strActiveTimerChannelIcon.Format("%s", tag->ChannelIcon());
-      strActiveTimerTime.Format("%s",        tag->StartAsLocalTime().GetAsLocalizedDateTime(false, false));
+      strActiveTimerTitle = StringUtils::Format("%s",       tag->Title().c_str());
+      strActiveTimerChannelName = StringUtils::Format("%s", tag->ChannelName().c_str());
+      strActiveTimerChannelIcon = StringUtils::Format("%s", tag->ChannelIcon().c_str());
+      strActiveTimerTime = StringUtils::Format("%s",        tag->StartAsLocalTime().GetAsLocalizedDateTime(false, false).c_str());
     }
   }
 
index 675abe3..7792753 100644 (file)
@@ -480,8 +480,7 @@ bool CPVRManager::SetWakeupCommand(void)
     {
       nextEvent.GetAsTime(iWakeupTime);
         
-      CStdString strExecCommand;
-      strExecCommand.Format("%s %d", strWakeupCommand, iWakeupTime);
+      CStdString strExecCommand = StringUtils::Format("%s %d", strWakeupCommand.c_str(), iWakeupTime);
         
       const int iReturn = system(strExecCommand.c_str());
       if (iReturn != 0)
@@ -1163,8 +1162,7 @@ bool CPVRManager::StartPlayback(PlaybackType type /* = PlaybackTypeAny */)
   {
     CLog::Log(LOGNOTICE, "PVRManager - %s - could not determine %s channel to start playback with. No last played channel found, and first channel of active group could also not be determined.", __FUNCTION__, bIsRadio ? "radio": "tv");
 
-    CStdString msg;
-    msg.Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(bIsRadio ? 19021 : 19020).c_str()); // RADIO/TV could not be played. Check the log for details.
+    CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(bIsRadio ? 19021 : 19020).c_str()); // RADIO/TV could not be played. Check the log for details.
     CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
             g_localizeStrings.Get(19166), // PVR information
             msg);
@@ -1234,8 +1232,7 @@ bool CPVRManager::PerformChannelSwitch(const CPVRChannel &channel, bool bPreview
 
     CLog::Log(LOGERROR, "PVRManager - %s - failed to switch to channel '%s'", __FUNCTION__, channel.ChannelName().c_str());
 
-    CStdString msg;
-    msg.Format(g_localizeStrings.Get(19035).c_str(), channel.ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+    CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel.ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
     CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
         g_localizeStrings.Get(19166), // PVR information
         msg);
index 349cad6..e3f77d5 100644 (file)
@@ -320,7 +320,7 @@ bool CPVRClient::GetAddonProperties(void)
   catch (exception &e) { LogException(e, "GetConnectionString()"); return false;  }
 
   /* display name = backend name:connection string */
-  strFriendlyName.Format("%s:%s", strBackendName.c_str(), strConnectionString.c_str());
+  strFriendlyName = StringUtils::Format("%s:%s", strBackendName.c_str(), strConnectionString.c_str());
 
   /* backend version number */
   try { strBackendVersion = m_pStruct->GetBackendVersion(); }
index dfe74ee..e0fb7eb 100644 (file)
@@ -105,7 +105,7 @@ CPVRChannel::CPVRChannel(const PVR_CHANNEL &channel, unsigned int iClientId)
   m_bChanged                = false;
 
   if (m_strChannelName.IsEmpty())
-    m_strChannelName.Format("%s %d", g_localizeStrings.Get(19029), m_iUniqueId);
+    m_strChannelName = StringUtils::Format("%s %d", g_localizeStrings.Get(19029).c_str(), m_iUniqueId);
 
   UpdateEncryptionName();
 }
@@ -306,7 +306,7 @@ bool CPVRChannel::SetIconPath(const CStdString &strIconPath, bool bIsUserSetIcon
   if (m_strIconPath != strIconPath)
   {
     /* update the path */
-    m_strIconPath.Format("%s", strIconPath);
+    m_strIconPath = StringUtils::Format("%s", strIconPath.c_str());
     SetChanged();
     m_bChanged = true;
 
@@ -325,7 +325,7 @@ bool CPVRChannel::SetChannelName(const CStdString &strChannelName)
   CStdString strName(strChannelName);
 
   if (strName.IsEmpty())
-    strName.Format(g_localizeStrings.Get(19085), ClientChannelNumber());
+    strName = StringUtils::Format(g_localizeStrings.Get(19085).c_str(), ClientChannelNumber());
 
   CSingleLock lock(m_critSection);
   if (m_strChannelName != strName)
@@ -442,7 +442,7 @@ bool CPVRChannel::SetClientChannelName(const CStdString &strClientChannelName)
   if (m_strClientChannelName != strClientChannelName)
   {
     /* update the client channel name */
-    m_strClientChannelName.Format("%s", strClientChannelName);
+    m_strClientChannelName = StringUtils::Format("%s", strClientChannelName.c_str());
     SetChanged();
     // this is not persisted, so don't update m_bChanged
 
@@ -459,7 +459,7 @@ bool CPVRChannel::SetInputFormat(const CStdString &strInputFormat)
   if (m_strInputFormat != strInputFormat)
   {
     /* update the input format */
-    m_strInputFormat.Format("%s", strInputFormat);
+    m_strInputFormat = StringUtils::Format("%s", strInputFormat.c_str());
     SetChanged();
     m_bChanged = true;
 
@@ -476,7 +476,7 @@ bool CPVRChannel::SetStreamURL(const CStdString &strStreamURL)
   if (m_strStreamURL != strStreamURL)
   {
     /* update the stream url */
-    m_strStreamURL.Format("%s", strStreamURL);
+    m_strStreamURL = StringUtils::Format("%s", strStreamURL.c_str());
     SetChanged();
     m_bChanged = true;
 
@@ -492,7 +492,7 @@ void CPVRChannel::UpdatePath(CPVRChannelGroupInternal* group, unsigned int iNewC
 
   CStdString strFileNameAndPath;
   CSingleLock lock(m_critSection);
-  strFileNameAndPath.Format("pvr://channels/%s/%s/%i.pvr", (m_bIsRadio ? "radio" : "tv"), group->GroupName().c_str(), iNewChannelGroupPosition);
+  strFileNameAndPath = StringUtils::Format("pvr://channels/%s/%s/%i.pvr", (m_bIsRadio ? "radio" : "tv"), group->GroupName().c_str(), iNewChannelGroupPosition);
   if (m_strFileNameAndPath != strFileNameAndPath)
   {
     m_strFileNameAndPath = strFileNameAndPath;
@@ -687,7 +687,7 @@ bool CPVRChannel::SetEPGScraper(const CStdString &strScraper)
     bool bCleanEPG = !m_strEPGScraper.IsEmpty() || strScraper.IsEmpty();
 
     /* update the scraper name */
-    m_strEPGScraper.Format("%s", strScraper);
+    m_strEPGScraper = StringUtils::Format("%s", strScraper.c_str());
     SetChanged();
     m_bChanged = true;
 
index f06c632..4ebefbd 100644 (file)
@@ -265,7 +265,7 @@ void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
     CStdString strIconPath = strBasePath + strSanitizedChannelName;
     CStdString strIconPathLower = strBasePath + strSanitizedChannelName.ToLower();
     CStdString strIconPathUid;
-    strIconPathUid.Format("%08d", groupMember.channel->UniqueID());
+    strIconPathUid = StringUtils::Format("%08d", groupMember.channel->UniqueID());
     strIconPathUid = URIUtils::AddFileToFolder(strBasePath, strIconPathUid);
 
     SetChannelIconPath(groupMember.channel, strIconPath      + ".tbn") ||
index b98bab4..c2486bf 100644 (file)
@@ -24,6 +24,7 @@
 #include "settings/Settings.h"
 #include "guilib/GUIWindowManager.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 #include "filesystem/File.h"
 
@@ -108,7 +109,7 @@ CFileItemPtr CPVRChannelGroups::GetByPath(const CStdString &strPath) const
   for (std::vector<CPVRChannelGroupPtr>::const_iterator it = m_groups.begin(); it != m_groups.end(); it++)
   {
     // check if the path matches
-    strCheckPath.Format("channels/%s/%s/", (*it)->IsRadio() ? "radio" : "tv", (*it)->GroupName().c_str());
+    strCheckPath = StringUtils::Format("channels/%s/%s/", (*it)->IsRadio() ? "radio" : "tv", (*it)->GroupName().c_str());
     if (strFileName.Left(strCheckPath.length()) == strCheckPath)
     {
       strFileName.erase(0, strCheckPath.length());
@@ -349,7 +350,7 @@ int CPVRChannelGroups::GetGroupList(CFileItemList* results) const
   CStdString strPath;
   for (std::vector<CPVRChannelGroupPtr>::const_iterator it = m_groups.begin(); it != m_groups.end(); it++)
   {
-    strPath.Format("channels/%s/%i", m_bRadio ? "radio" : "tv", (*it)->GroupID());
+    strPath = StringUtils::Format("channels/%s/%i", m_bRadio ? "radio" : "tv", (*it)->GroupID());
     CFileItemPtr group(new CFileItem(strPath, true));
     group->m_strTitle = (*it)->GroupName();
     group->SetLabel((*it)->GroupName());
index 5572c0b..a493486 100644 (file)
@@ -40,6 +40,7 @@
 #include "pvr/addons/PVRClients.h"
 #include "settings/Settings.h"
 #include "storage/MediaManager.h"
+#include "utils/StringUtils.h"
 
 #define BUTTON_OK                 4
 #define BUTTON_APPLY              5
@@ -114,9 +115,9 @@ bool CGUIDialogPVRChannelManager::OnActionMove(const CAction &action)
         unsigned int iNewSelect = bMoveUp ? m_iSelected - 1 : m_iSelected + 1;
         if (m_channelItems->Get(iNewSelect)->GetProperty("Number").asString() != "-")
         {
-          strNumber.Format("%i", m_iSelected+1);
+          strNumber = StringUtils::Format("%i", m_iSelected+1);
           m_channelItems->Get(iNewSelect)->SetProperty("Number", strNumber);
-          strNumber.Format("%i", iNewSelect+1);
+          strNumber = StringUtils::Format("%i", iNewSelect+1);
           m_channelItems->Get(m_iSelected)->SetProperty("Number", strNumber);
         }
         m_channelItems->Swap(iNewSelect, m_iSelected);
@@ -721,8 +722,7 @@ void CGUIDialogPVRChannelManager::Update()
     channelFile->SetProperty("Icon", channel->IconPath());
     channelFile->SetProperty("EPGSource", (int)0);
     channelFile->SetProperty("ParentalLocked", channel->IsLocked());
-    CStdString number; number.Format("%i", channel->ChannelNumber());
-    channelFile->SetProperty("Number", number);
+    channelFile->SetProperty("Number", StringUtils::Format("%i", channel->ChannelNumber()));
 
     if (channel->IsVirtual())
     {
@@ -834,7 +834,7 @@ void CGUIDialogPVRChannelManager::Renumber(void)
     pItem = m_channelItems->Get(iChannelPtr);
     if (pItem->GetProperty("ActiveChannel").asBoolean())
     {
-      strNumber.Format("%i", ++iNextChannelNumber);
+      strNumber = StringUtils::Format("%i", ++iNextChannelNumber);
       pItem->SetProperty("Number", strNumber);
     }
     else
index cc09fd1..1be33b8 100644 (file)
@@ -239,8 +239,7 @@ void CGUIDialogPVRChannelsOSD::GotoChannel(int item)
     if (!g_PVRManager.CheckParentalLock(*channel) ||
         !g_application.m_pPlayer->SwitchChannel(*channel))
     {
-      CStdString msg;
-      msg.Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+      CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
       CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
               g_localizeStrings.Get(19166), // PVR information
               msg);
index fd44a36..ba4957b 100644 (file)
@@ -26,6 +26,7 @@
 #include "guilib/GUIWindowManager.h"
 #include "guilib/Key.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 #include "pvr/PVRManager.h"
 #include "pvr/channels/PVRChannelGroupsContainer.h"
@@ -340,19 +341,23 @@ void CGUIDialogPVRGroupManager::Update()
     if (m_selectedGroup->IsInternalGroup())
     {
       CStdString strNewLabel;
-      strNewLabel.Format("%s %s", g_localizeStrings.Get(19022), m_bIsRadio ? g_localizeStrings.Get(19024) : g_localizeStrings.Get(19023));
+      strNewLabel = StringUtils::Format("%s %s",
+                                        g_localizeStrings.Get(19022).c_str(),
+                                        m_bIsRadio ? g_localizeStrings.Get(19024).c_str() : g_localizeStrings.Get(19023).c_str());
       SET_CONTROL_LABEL(CONTROL_UNGROUPED_LABEL, strNewLabel);
 
-      strNewLabel.Format("%s %s", g_localizeStrings.Get(19218), m_bIsRadio ? g_localizeStrings.Get(19024) : g_localizeStrings.Get(19023));
+      strNewLabel = StringUtils::Format("%s %s",
+                                        g_localizeStrings.Get(19218).c_str(),
+                                        m_bIsRadio ? g_localizeStrings.Get(19024).c_str() : g_localizeStrings.Get(19023).c_str());
       SET_CONTROL_LABEL(CONTROL_IN_GROUP_LABEL, strNewLabel);
     }
     else
     {
       CStdString strNewLabel;
-      strNewLabel.Format("%s", g_localizeStrings.Get(19219));
+      strNewLabel = StringUtils::Format("%s", g_localizeStrings.Get(19219).c_str());
       SET_CONTROL_LABEL(CONTROL_UNGROUPED_LABEL, strNewLabel);
 
-      strNewLabel.Format("%s %s", g_localizeStrings.Get(19220), m_selectedGroup->GroupName());
+      strNewLabel = StringUtils::Format("%s %s", g_localizeStrings.Get(19220).c_str(), m_selectedGroup->GroupName().c_str());
       SET_CONTROL_LABEL(CONTROL_IN_GROUP_LABEL, strNewLabel);
     }
 
index e4066ff..2ae2707 100644 (file)
@@ -172,8 +172,7 @@ bool CGUIDialogPVRGuideInfo::OnClickButtonSwitch(CGUIMessage &message)
     if (!m_progItem->GetEPGInfoTag()->HasPVRChannel() ||
         (ret = g_application.PlayFile(CFileItem(*m_progItem->GetEPGInfoTag()->ChannelTag()))) == PLAYBACK_FAIL)
     {
-      CStdString msg;
-      msg.Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(19029).c_str()); // Channel could not be played. Check the log for details.
+      CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(19029).c_str()); // Channel could not be played. Check the log for details.
       CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
     }
     else if (ret == PLAYBACK_OK)
index f03af46..b932971 100644 (file)
@@ -25,6 +25,7 @@
 #include "guilib/GUIRadioButtonControl.h"
 #include "guilib/GUISpinControlEx.h"
 #include "guilib/GUIWindowManager.h"
+#include "utils/StringUtils.h"
 
 #include "addons/include/xbmc_pvr_types.h"
 #include "pvr/PVRManager.h"
@@ -150,7 +151,7 @@ void CGUIDialogPVRGuideSearch::UpdateDurationSpin(void)
   for (int i = 1; i < 12*60/5; i++)
   {
     CStdString string;
-    string.Format(g_localizeStrings.Get(14044), i*5);
+    string = StringUtils::Format(g_localizeStrings.Get(14044), i*5);
     pSpin->AddLabel(string, i*5);
   }
   pSpin->SetValue(m_searchFilter->m_iMinimumDuration);
@@ -165,7 +166,7 @@ void CGUIDialogPVRGuideSearch::UpdateDurationSpin(void)
   for (int i = 1; i < 12*60/5; i++)
   {
     CStdString string;
-    string.Format(g_localizeStrings.Get(14044),i*5);
+    string = StringUtils::Format(g_localizeStrings.Get(14044), i*5);
     pSpin->AddLabel(string, i*5);
   }
   pSpin->SetValue(m_searchFilter->m_iMaximumDuration);
index 068960a..1b6b756 100644 (file)
@@ -22,6 +22,7 @@
 #include "guilib/GUIKeyboardFactory.h"
 #include "dialogs/GUIDialogNumeric.h"
 #include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
 
 #include "pvr/PVRManager.h"
 #include "pvr/timers/PVRTimerInfoTag.h"
@@ -74,7 +75,7 @@ void CGUIDialogPVRTimerSettings::AddChannelNames(CFileItemList &channelsList, SE
     CStdString string;
     CFileItemPtr item = channelsList[i];
     const CPVRChannel *channel = item->GetPVRChannelInfoTag();
-    string.Format("%i %s", channel->ChannelNumber(), channel->ChannelName().c_str());
+    string = StringUtils::Format("%i %s", channel->ChannelNumber(), channel->ChannelName().c_str());
     channelNames.push_back(string);
     if (channel->ChannelID() == timerChannelID)
       m_selectedChannelEntry = entry;
index ae53c3a..8ad5286 100644 (file)
@@ -130,7 +130,7 @@ bool CPVRRecording::Delete(void)
 
 bool CPVRRecording::Rename(const CStdString &strNewName)
 {
-  m_strTitle.Format("%s", strNewName);
+  m_strTitle = StringUtils::Format("%s", strNewName.c_str());
   PVR_ERROR error = g_PVRClients->RenameRecording(*this);
   if (error != PVR_ERROR_NO_ERROR)
   {
@@ -261,8 +261,7 @@ void CPVRRecording::Update(const CPVRRecording &tag)
     m_resumePoint.totalTimeInSeconds = tag.m_resumePoint.totalTimeInSeconds;
   }
 
-  CStdString strShow;
-  strShow.Format("%s - ", g_localizeStrings.Get(20364).c_str());
+  CStdString strShow = StringUtils::Format("%s - ", g_localizeStrings.Get(20364).c_str());
   if (m_strPlotOutline.Left(strShow.size()).Equals(strShow))
   {
     CStdString strEpisode = m_strPlotOutline;
@@ -271,7 +270,7 @@ void CPVRRecording::Update(const CPVRRecording &tag)
     int pos = strTitle.ReverseFind('/');
     strTitle.erase(0, pos + 1);
     strEpisode.erase(0, strShow.size());
-    m_strTitle.Format("%s - %s", strTitle.c_str(), strEpisode);
+    m_strTitle = StringUtils::Format("%s - %s", strTitle.c_str(), strEpisode.c_str());
     pos = strEpisode.Find('-');
     strEpisode.erase(0, pos + 2);
     m_strPlotOutline = strEpisode;
@@ -294,10 +293,10 @@ void CPVRRecording::UpdatePath(void)
     strTitle.Replace('/',' ');
 
     if (!m_strDirectory.IsEmpty())
-      strDirectory.Format("%s/", m_strDirectory.c_str());
+      strDirectory = StringUtils::Format("%s/", m_strDirectory.c_str());
     if (!m_strChannelName.IsEmpty())
-      strChannel.Format(" (%s)", m_strChannelName.c_str());
-    m_strFileNameAndPath.Format("pvr://recordings/%s%s, TV%s, %s.pvr", strDirectory.c_str(), strTitle.c_str(), strChannel.c_str(), strDatetime.c_str());
+      strChannel = StringUtils::Format(" (%s)", m_strChannelName.c_str());
+    m_strFileNameAndPath = StringUtils::Format("pvr://recordings/%s%s, TV%s, %s.pvr", strDirectory.c_str(), strTitle.c_str(), strChannel.c_str(), strDatetime.c_str());
   }
 }
 
index 98a93b1..111a3f3 100644 (file)
@@ -29,6 +29,8 @@
 #include "video/VideoDatabase.h"
 
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
+
 #include "pvr/PVRManager.h"
 #include "pvr/addons/PVRClients.h"
 #include "PVRRecordings.h"
@@ -139,9 +141,9 @@ void CPVRRecordings::GetSubDirectories(const CStdString &strBase, CFileItemList
 
     CStdString strFilePath;
     if(strUseBase.empty())
-      strFilePath.Format("pvr://recordings/%s/", strCurrent.c_str());
+      strFilePath = StringUtils::Format("pvr://recordings/%s/", strCurrent.c_str());
     else
-      strFilePath.Format("pvr://recordings/%s/%s/", strUseBase.c_str(), strCurrent.c_str());
+      strFilePath = StringUtils::Format("pvr://recordings/%s/%s/", strUseBase.c_str(), strCurrent.c_str());
 
     if (!results->Contains(strFilePath))
     {
@@ -186,8 +188,7 @@ void CPVRRecordings::GetSubDirectories(const CStdString &strBase, CFileItemList
 
   if (bAutoSkip && results->Size() == 1 && files.Size() == 0)
   {
-    CStdString strGetPath;
-    strGetPath.Format("%s/%s/", strUseBase.c_str(), results->Get(0)->GetLabel());
+    CStdString strGetPath = StringUtils::Format("%s/%s/", strUseBase.c_str(), results->Get(0)->GetLabel().c_str());
 
     results->Clear();
 
@@ -208,7 +209,7 @@ void CPVRRecordings::GetSubDirectories(const CStdString &strBase, CFileItemList
     if(strUseBase.empty())
       strAllPath = "pvr://recordings";
     else
-      strAllPath.Format("pvr://recordings/%s", strUseBase.c_str());
+      strAllPath = StringUtils::Format("pvr://recordings/%s", strUseBase.c_str());
     pItem->SetPath(AddAllRecordingsPathExtension(strAllPath));
     pItem->SetSpecialSort(SortSpecialOnTop);
     pItem->SetLabelPreformated(true);
index 48b946d..6488790 100644 (file)
@@ -92,7 +92,7 @@ CPVRTimerInfoTag::CPVRTimerInfoTag(const PVR_TIMER &timer, CPVRChannelPtr channe
   m_channel            = channel;
   m_bIsRadio           = channel && channel->IsRadio();
   m_state              = timer.state;
-  m_strFileNameAndPath.Format("pvr://client%i/timers/%i", m_iClientId, m_iClientIndex);
+  m_strFileNameAndPath = StringUtils::Format("pvr://client%i/timers/%i", m_iClientId, m_iClientIndex);
 
   UpdateSummary();
 }
@@ -188,44 +188,44 @@ void CPVRTimerInfoTag::UpdateSummary(void)
 
   if (!m_bIsRepeating || !m_iWeekdays)
   {
-    m_strSummary.Format("%s %s %s %s %s",
-        StartAsLocalTime().GetAsLocalizedDate(),
-        g_localizeStrings.Get(19159),
-        StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
-        g_localizeStrings.Get(19160),
-        EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+    m_strSummary = StringUtils::Format("%s %s %s %s %s",
+        StartAsLocalTime().GetAsLocalizedDate().c_str(),
+        g_localizeStrings.Get(19159).c_str(),
+        StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+        g_localizeStrings.Get(19160).c_str(),
+        EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
   }
   else if (m_FirstDay.IsValid())
   {
-    m_strSummary.Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s %s %s",
-        m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149) : "__",
-        m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150) : "__",
-        m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151) : "__",
-        m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152) : "__",
-        m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153) : "__",
-        m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154) : "__",
-        m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155) : "__",
-        g_localizeStrings.Get(19156),
-        FirstDayAsLocalTime().GetAsLocalizedDate(false),
-        g_localizeStrings.Get(19159),
-        StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
-        g_localizeStrings.Get(19160),
-        EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+    m_strSummary = StringUtils::Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s %s %s",
+        m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149).c_str() : "__",
+        m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150).c_str() : "__",
+        m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151).c_str() : "__",
+        m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152).c_str() : "__",
+        m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153).c_str() : "__",
+        m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154).c_str() : "__",
+        m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155).c_str() : "__",
+        g_localizeStrings.Get(19156).c_str(),
+        FirstDayAsLocalTime().GetAsLocalizedDate(false).c_str(),
+        g_localizeStrings.Get(19159).c_str(),
+        StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+        g_localizeStrings.Get(19160).c_str(),
+        EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
   }
   else
   {
-    m_strSummary.Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s",
-        m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149) : "__",
-        m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150) : "__",
-        m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151) : "__",
-        m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152) : "__",
-        m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153) : "__",
-        m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154) : "__",
-        m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155) : "__",
-        g_localizeStrings.Get(19159),
-        StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
-        g_localizeStrings.Get(19160),
-        EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+    m_strSummary = StringUtils::Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s",
+        m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149).c_str() : "__",
+        m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150).c_str() : "__",
+        m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151).c_str() : "__",
+        m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152).c_str() : "__",
+        m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153).c_str() : "__",
+        m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154).c_str() : "__",
+        m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155).c_str() : "__",
+        g_localizeStrings.Get(19159).c_str(),
+        StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+        g_localizeStrings.Get(19160).c_str(),
+        EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
   }
 }
 
@@ -453,12 +453,12 @@ CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTag &tag)
 
   if (tag.Plot().empty())
   {
-      newTag->m_strSummary.Format("%s %s %s %s %s",
-        newTag->StartAsLocalTime().GetAsLocalizedDate(),
-        g_localizeStrings.Get(19159),
-        newTag->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
-        g_localizeStrings.Get(19160),
-        newTag->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+    newTag->m_strSummary= StringUtils::Format("%s %s %s %s %s",
+                                              newTag->StartAsLocalTime().GetAsLocalizedDate().c_str(),
+                                              g_localizeStrings.Get(19159).c_str(),
+                                              newTag->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+                                              g_localizeStrings.Get(19160).c_str(),
+                                              newTag->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
   }
   else
   {
@@ -519,23 +519,23 @@ void CPVRTimerInfoTag::GetNotificationText(CStdString &strText) const
   {
   case PVR_TIMER_STATE_ABORTED:
   case PVR_TIMER_STATE_CANCELLED:
-    strText.Format("%s: '%s'", g_localizeStrings.Get(19224), m_strTitle.c_str());
+      strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19224).c_str(), m_strTitle.c_str());
     break;
   case PVR_TIMER_STATE_SCHEDULED:
-    strText.Format("%s: '%s'", g_localizeStrings.Get(19225), m_strTitle.c_str());
+    strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19225).c_str(), m_strTitle.c_str());
     break;
   case PVR_TIMER_STATE_RECORDING:
-    strText.Format("%s: '%s'", g_localizeStrings.Get(19226), m_strTitle.c_str());
+    strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19226).c_str(), m_strTitle.c_str());
     break;
   case PVR_TIMER_STATE_COMPLETED:
-    strText.Format("%s: '%s'", g_localizeStrings.Get(19227), m_strTitle.c_str());
+    strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19227).c_str(), m_strTitle.c_str());
     break;
   case PVR_TIMER_STATE_CONFLICT_OK:    
   case PVR_TIMER_STATE_CONFLICT_NOK:   
-    strText.Format("%s: '%s'", g_localizeStrings.Get(19277), m_strTitle.c_str());
+    strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19277).c_str(), m_strTitle.c_str());
     break;
   case PVR_TIMER_STATE_ERROR:
-    strText.Format("%s: '%s'", g_localizeStrings.Get(19278), m_strTitle.c_str());
+    strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19278).c_str(), m_strTitle.c_str());
     break;
   default:
     break;
index e96e25e..eb8dcfc 100644 (file)
@@ -187,11 +187,11 @@ bool CPVRTimers::UpdateEntries(const CPVRTimers &timers)
         if (g_PVRManager.IsStarted())
         {
           CStdString strMessage;
-          strMessage.Format("%s: '%s'",
-              (timer->EndAsUTC() <= CDateTime::GetCurrentDateTime().GetAsUTCDateTime()) ?
-                  g_localizeStrings.Get(19227) :
-                  g_localizeStrings.Get(19228),
-                  timer->m_strTitle.c_str());
+          strMessage = StringUtils::Format("%s: '%s'",
+                                           (timer->EndAsUTC() <= CDateTime::GetCurrentDateTime().GetAsUTCDateTime()) ?
+                                           g_localizeStrings.Get(19227).c_str() :
+                                           g_localizeStrings.Get(19228).c_str(),
+                                           timer->m_strTitle.c_str());
           timerNotifications.push_back(strMessage);
         }
 
@@ -485,12 +485,12 @@ bool CPVRTimers::InstantTimer(const CPVRChannel &channel)
     newTimer->m_bIsRadio          = channel.IsRadio();
 
     /* generate summary string */
-    newTimer->m_strSummary.Format("%s %s %s %s %s",
-        newTimer->StartAsLocalTime().GetAsLocalizedDate(),
-        g_localizeStrings.Get(19159),
-        newTimer->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
-        g_localizeStrings.Get(19160),
-        newTimer->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+    newTimer->m_strSummary = StringUtils::Format("%s %s %s %s %s",
+                                                 newTimer->StartAsLocalTime().GetAsLocalizedDate().c_str(),
+                                                 g_localizeStrings.Get(19159).c_str(),
+                                                 newTimer->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+                                                 g_localizeStrings.Get(19160).c_str(),
+                                                 newTimer->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
   }
 
   CDateTime startTime(0);
index cb8d017..b999599 100644 (file)
@@ -223,9 +223,9 @@ void CGUIWindowPVRChannels::UpdateData(bool bUpdateSelectedFile /* = true */)
   SetSelectedGroup(currentGroup);
 
   CStdString strPath;
-  strPath.Format("pvr://channels/%s/%s/",
+  strPath = StringUtils::Format("pvr://channels/%s/%s/",
       m_bRadio ? "radio" : "tv",
-      m_bShowHiddenChannels ? ".hidden" : currentGroup->GroupName());
+      m_bShowHiddenChannels ? ".hidden" : currentGroup->GroupName().c_str());
 
   m_parent->m_vecItems->SetPath(strPath);
   m_parent->Update(m_parent->m_vecItems->GetPath());
@@ -412,7 +412,7 @@ bool CGUIWindowPVRChannels::OnContextButtonMove(CFileItem *item, CONTEXT_BUTTON
       return bReturn;
 
     CStdString strIndex;
-    strIndex.Format("%i", channel->ChannelNumber());
+    strIndex = StringUtils::Format("%i", channel->ChannelNumber());
     CGUIDialogNumeric::ShowAndGetNumber(strIndex, g_localizeStrings.Get(19052));
     int newIndex = atoi(strIndex.c_str());
 
@@ -575,8 +575,7 @@ bool CGUIWindowPVRChannels::OnContextButtonUpdateEpg(CFileItem *item, CONTEXT_BU
 
     bReturn = UpdateEpgForChannel(item);
 
-    CStdString strMessage;
-    strMessage.Format("%s: '%s'", g_localizeStrings.Get(bReturn ? 19253 : 19254), channel->ChannelName());
+    CStdString strMessage = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(bReturn ? 19253 : 19254).c_str(), channel->ChannelName().c_str());
     CGUIDialogKaiToast::QueueNotification(bReturn ? CGUIDialogKaiToast::Info : CGUIDialogKaiToast::Error,
         g_localizeStrings.Get(19166),
         strMessage);
index f5d2d6e..e349b6e 100644 (file)
@@ -540,8 +540,7 @@ bool CGUIWindowPVRCommon::ActionPlayEpg(CFileItem *item)
 
   if (ret == PLAYBACK_FAIL)
   {
-    CStdString msg;
-    msg.Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+    CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
     CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
   }
 
@@ -721,11 +720,10 @@ bool CGUIWindowPVRCommon::PlayFile(CFileItem *item, bool bPlayMinimized /* = fal
 
     if (!bSwitchSuccessful)
     {
-      CStdString msg;
       CStdString channelName = g_localizeStrings.Get(19029); // Channel
       if (channel)
         channelName = channel->ChannelName();
-      msg.Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details.
+      CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details.
 
       CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
               g_localizeStrings.Get(19166), // PVR information
index f23b852..d264412 100644 (file)
@@ -436,8 +436,7 @@ bool CGUIWindowPVRGuide::PlayEpgItem(CFileItem *item)
   bool bReturn = PlayFile(&channelItem);
   if (!bReturn)
   {
-    CStdString msg;
-    msg.Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+    CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
     CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
   }
 
index fa4ea13..12667f2 100644 (file)
@@ -99,7 +99,7 @@ CStdString CGUIWindowPVRRecordings::GetResumeString(const CFileItem& item)
 
     // Suppress resume from 0
     if (positionInSeconds > 0)
-      resumeString.Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(positionInSeconds).c_str());
+      resumeString = StringUtils::Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(positionInSeconds).c_str());
   }
   return resumeString;
 }
index 223df8b..ad3a442 100644 (file)
@@ -462,8 +462,8 @@ bool CRenderSystemDX::CreateDevice()
   {
     m_RenderRenderer = (const char*)m_AIdentifier.Description;
     m_RenderVendor   = (const char*)m_AIdentifier.Driver;
-    m_RenderVersion.Format("%d.%d.%d.%04d", HIWORD(m_AIdentifier.DriverVersion.HighPart), LOWORD(m_AIdentifier.DriverVersion.HighPart),
-                                            HIWORD(m_AIdentifier.DriverVersion.LowPart) , LOWORD(m_AIdentifier.DriverVersion.LowPart));
+    m_RenderVersion = StringUtils::Format("%d.%d.%d.%04d", HIWORD(m_AIdentifier.DriverVersion.HighPart), LOWORD(m_AIdentifier.DriverVersion.HighPart),
+                                                           HIWORD(m_AIdentifier.DriverVersion.LowPart) , LOWORD(m_AIdentifier.DriverVersion.LowPart));
   }
 
   CLog::Log(LOGDEBUG, __FUNCTION__" - adapter %d: %s, %s, VendorId %lu, DeviceId %lu",
@@ -1004,10 +1004,7 @@ void CRenderSystemDX::Unregister(ID3DResource* resource)
 
 CStdString CRenderSystemDX::GetErrorDescription(HRESULT hr)
 {
-  CStdString strError;
-  strError.Format("%X - %s (%s)", hr, DXGetErrorString(hr), DXGetErrorDescription(hr));
-
-  return strError;
+  return StringUtils::Format("%X - %s (%s)", hr, DXGetErrorString(hr), DXGetErrorDescription(hr));
 }
 
 void CRenderSystemDX::SetStereoMode(RENDER_STEREO_MODE mode, RENDER_STEREO_VIEW view)
index 4333df8..54264b7 100644 (file)
@@ -1367,8 +1367,7 @@ void CAdvancedSettings::SetExtraLogsFromAddon(ADDON::IAddon* addon)
   m_extraLogLevels = 0;
   for (int i=LOGMASKBIT;i<31;++i)
   {
-    CStdString str;
-    str.Format("bit%i", i-LOGMASKBIT+1);
+    CStdString str = StringUtils::Format("bit%i", i-LOGMASKBIT+1);
     if (addon->GetSetting(str) == "true")
       m_extraLogLevels |= (1 << i);
   }
index 240dad5..d8f228b 100644 (file)
@@ -27,6 +27,7 @@
 #include "guilib/GUIControlGroupList.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "guilib/GUIKeyboardFactory.h"
 
 #define CONTROL_GROUP_LIST          5
@@ -215,8 +216,7 @@ void CGUIDialogSettings::UpdateSetting(unsigned int id)
   {
     CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
     if (pControl && setting.data) {
-      CStdString strIndex;
-      strIndex.Format("%i", *(int *)setting.data);
+      CStdString strIndex = StringUtils::Format("%i", *(int *)setting.data);
       pControl->SetLabel2(strIndex);
     }
   }
@@ -389,8 +389,7 @@ void CGUIDialogSettings::AddSetting(SettingInfo &setting, float width, int iCont
     pControl->SetWidth(width);
     ((CGUIEditControl *)pControl)->SetInputType(CGUIEditControl::INPUT_TYPE_NUMBER, 0);
     if (setting.data) {
-        CStdString strIndex;
-        strIndex.Format("%i", *(int *)setting.data);
+        CStdString strIndex = StringUtils::Format("%i", *(int *)setting.data);
         ((CGUIEditControl *)pControl)->SetLabel2(strIndex);
     }
   }
@@ -585,7 +584,7 @@ void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, unsig
     if (i == min && minLabel)
       format = minLabel;
     else
-      format.Format("%i", i);
+      format = StringUtils::Format("%i", i);
     setting.entry.push_back(make_pair(i, format));
   }
   m_settings.push_back(setting);
index 43b35fe..9861b9d 100644 (file)
@@ -33,6 +33,7 @@
 #include "guilib/Key.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "windowing/WindowingFactory.h"
 
 using namespace std;
@@ -74,8 +75,7 @@ bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
     {
       CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
       pDialog->SetHeading(20325);
-      CStdString strText;
-      strText.Format(g_localizeStrings.Get(20326).c_str(), g_graphicsContext.GetResInfo(m_Res[m_iCurRes]).strMode.c_str());
+      CStdString strText = StringUtils::Format(g_localizeStrings.Get(20326).c_str(), g_graphicsContext.GetResInfo(m_Res[m_iCurRes]).strMode.c_str());
       pDialog->SetLine(0, strText);
       pDialog->SetLine(1, 20327);
       pDialog->SetChoice(0, 222);
@@ -315,7 +315,7 @@ void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
       // recenter our control...
       pControl->SetPosition((info.iWidth - pControl->GetWidth()) / 2,
                             (info.iHeight - pControl->GetHeight()) / 2);
-      strStatus.Format("%s (%5.3f)", g_localizeStrings.Get(275).c_str(), info.fPixelRatio);
+      strStatus = StringUtils::Format("%s (%5.3f)", g_localizeStrings.Get(275).c_str(), info.fPixelRatio);
       SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 278);
     }
   }
@@ -330,7 +330,7 @@ void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
         {
           info.Overscan.left = pControl->GetXLocation();
           info.Overscan.top = pControl->GetYLocation();
-          strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(272).c_str(), pControl->GetXLocation(), pControl->GetYLocation());
+          strStatus = StringUtils::Format("%s (%i,%i)", g_localizeStrings.Get(272).c_str(), pControl->GetXLocation(), pControl->GetYLocation());
           SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
         }
         break;
@@ -341,7 +341,7 @@ void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
           info.Overscan.bottom = pControl->GetYLocation();
           int iXOff1 = info.iWidth - pControl->GetXLocation();
           int iYOff1 = info.iHeight - pControl->GetYLocation();
-          strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(273).c_str(), iXOff1, iYOff1);
+          strStatus = StringUtils::Format("%s (%i,%i)", g_localizeStrings.Get(273).c_str(), iXOff1, iYOff1);
           SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
         }
         break;
@@ -349,7 +349,7 @@ void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
       case CONTROL_SUBTITLES:
         {
           info.iSubtitles = pControl->GetYLocation();
-          strStatus.Format("%s (%i)", g_localizeStrings.Get(274).c_str(), pControl->GetYLocation());
+          strStatus = StringUtils::Format("%s (%i)", g_localizeStrings.Get(274).c_str(), pControl->GetYLocation());
           SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 277);
         }
         break;
@@ -362,13 +362,18 @@ void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
   // set the label control correctly
   CStdString strText;
   if (g_Windowing.IsFullScreen())
-    strText.Format("%ix%i@%.2f - %s | %s", info.iScreenWidth,
-      info.iScreenHeight, info.fRefreshRate,
-      g_localizeStrings.Get(244).c_str(), strStatus.c_str());
+    strText = StringUtils::Format("%ix%i@%.2f - %s | %s",
+                                  info.iScreenWidth,
+                                  info.iScreenHeight,
+                                  info.fRefreshRate,
+                                  g_localizeStrings.Get(244).c_str(),
+                                  strStatus.c_str());
   else
-    strText.Format("%ix%i - %s | %s", info.iScreenWidth,
-      info.iScreenHeight,
-      g_localizeStrings.Get(242).c_str(), strStatus.c_str());
+    strText = StringUtils::Format("%ix%i - %s | %s",
+                                  info.iScreenWidth,
+                                  info.iScreenHeight,
+                                  g_localizeStrings.Get(242).c_str(),
+                                  strStatus.c_str());
 
   SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, strText);
 }
index e1d94db..f1982e0 100644 (file)
@@ -23,6 +23,7 @@
 #include "guilib/GUIWindowManager.h"
 #include "dialogs/GUIDialogSelect.h"
 #include "guilib/Key.h"
+#include "utils/StringUtils.h"
 
 CAutorunMediaJob::CAutorunMediaJob(const CStdString &label, const CStdString &path)
 {
@@ -53,8 +54,7 @@ bool CAutorunMediaJob::DoWork()
   int selection = pDialog->GetSelectedLabel();
   if (selection >= 0)
   {
-    CStdString strAction;
-    strAction.Format("ActivateWindow(%s, %s)", GetWindowString(selection), m_path.c_str());
+    CStdString strAction = StringUtils::Format("ActivateWindow(%s, %s)", GetWindowString(selection), m_path.c_str());
     CBuiltins::Execute(strAction);
   }
 
index e0fe718..8984f8f 100644 (file)
@@ -44,6 +44,7 @@
 #include "utils/log.h"
 #include "dialogs/GUIDialogKaiToast.h"
 #include "utils/JobManager.h"
+#include "utils/StringUtils.h"
 #include "AutorunMediaJob.h"
 
 #include "FileItem.h"
@@ -325,7 +326,7 @@ CStdString CMediaManager::TranslateDevicePath(const CStdString& devicePath, bool
   if(bReturnAsDevice == false)
     strDevice.Replace("\\\\.\\","");
   else if(!strDevice.empty() && strDevice[1]==':')
-    strDevice.Format("\\\\.\\%c:", strDevice[0]);
+    strDevice = StringUtils::Format("\\\\.\\%c:", strDevice[0]);
 
   URIUtils::RemoveSlashAtEnd(strDevice);
 #endif
@@ -530,7 +531,7 @@ CStdString CMediaManager::GetDiskUniqueId(const CStdString& devicePath)
     pathVideoTS = g_mediaManager.TranslateDevicePath(""); 
 
   CLog::Log(LOGDEBUG, "GetDiskUniqueId: Trying to retrieve ID for path %s", pathVideoTS.c_str());
-  CStdString strID;
+
 
   CDVDInputStreamNavigator dvdNavigator(NULL);
   dvdNavigator.Open(pathVideoTS, "");
@@ -539,7 +540,7 @@ CStdString CMediaManager::GetDiskUniqueId(const CStdString& devicePath)
   CStdString serialString;
   dvdNavigator.GetDVDSerialString(serialString);
 
-  strID.Format("removable://%s_%s", labelString.c_str(), serialString.c_str());
+  CStdString strID = StringUtils::Format("removable://%s_%s", labelString.c_str(), serialString.c_str());
   CLog::Log(LOGDEBUG, "GetDiskUniqueId: Got ID %s for DVD disk", strID.c_str());
 
   return strID;
index 69c468a..7e02630 100644 (file)
@@ -22,6 +22,7 @@
 #include "settings/AdvancedSettings.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "utils/URIUtils.h"
 #include "PosixMountProvider.h"
 
@@ -164,7 +165,7 @@ CMediaSource CDeviceKitDiskDevice::ToMediaShare()
   CMediaSource source;
   source.strPath = m_MountPath;
   if (m_Label.empty())
-    source.strName.Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
+    source.strName = StringUtils::Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
   else
     source.strName = m_Label;
   if (m_isOptical)
@@ -186,15 +187,12 @@ bool CDeviceKitDiskDevice::IsApproved()
 
 CStdString CDeviceKitDiskDevice::toString()
 {
-  CStdString str;
-  str.Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
+  return StringUtils::Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
       "IsSystemInternal %s IsMounted %s IsRemovable %s IsPartition %s "
       "IsOptical %s",
       m_DeviceKitUDI.c_str(), BOOL2SZ(m_isFileSystem), m_FileSystem,
       BOOL2SZ(m_isSystemInternal), BOOL2SZ(m_isMounted),
       BOOL2SZ(m_isRemovable), BOOL2SZ(m_isPartition), BOOL2SZ(m_isOptical));
-
-  return str;
 }
 
 CDeviceKitDisksProvider::CDeviceKitDisksProvider()
index eaf1b9a..5f0daaa 100644 (file)
@@ -22,6 +22,7 @@
 #include "settings/AdvancedSettings.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "utils/URIUtils.h"
 #include "PosixMountProvider.h"
 
@@ -139,7 +140,7 @@ CMediaSource CUDiskDevice::ToMediaShare()
   CMediaSource source;
   source.strPath = m_MountPath;
   if (m_Label.empty())
-    source.strName.Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
+    source.strName = StringUtils::Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
   else
     source.strName = m_Label;
   if (m_isOptical)
@@ -162,15 +163,12 @@ bool CUDiskDevice::IsApproved()
 
 CStdString CUDiskDevice::toString()
 {
-  CStdString str;
-  str.Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
+  return StringUtils::Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
       "IsSystemInternal %s IsMounted %s IsRemovable %s IsPartition %s "
       "IsOptical %s",
       m_DeviceKitUDI.c_str(), BOOL2SZ(m_isFileSystem), m_FileSystem,
       BOOL2SZ(m_isSystemInternal), BOOL2SZ(m_isMounted),
       BOOL2SZ(m_isRemovable), BOOL2SZ(m_isPartition), BOOL2SZ(m_isOptical));
-
-  return str;
 }
 
 CUDisksProvider::CUDisksProvider()
index 1d7c6f7..df0cfcf 100644 (file)
@@ -24,6 +24,7 @@
 #include "threads/SingleLock.h"
 #include "log.h"
 #include "dialogs/GUIDialogKaiToast.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 
@@ -65,9 +66,9 @@ void CAlarmClock::Start(const CStdString& strName, float n_secs, const CStdStrin
     strStarted = g_localizeStrings.Get(13210);
   }
 
-  CStdString strMessage;
-
-  strMessage.Format(strStarted.c_str(),static_cast<int>(event.m_fSecs)/60,static_cast<int>(event.m_fSecs)%60);
+  CStdString strMessage = StringUtils::Format(strStarted.c_str(),
+                                              static_cast<int>(event.m_fSecs)/60,
+                                              static_cast<int>(event.m_fSecs)%60);
 
   if(!bSilent)
      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, strAlarmClock, strMessage);
@@ -104,7 +105,9 @@ void CAlarmClock::Stop(const CStdString& strName, bool bSilent /* false */)
   {
     float remaining = static_cast<float>(iter->second.m_fSecs-iter->second.watch.GetElapsedSeconds());
     CStdString strStarted = g_localizeStrings.Get(13212);
-    strMessage.Format(strStarted.c_str(),static_cast<int>(remaining)/60,static_cast<int>(remaining)%60);
+    strMessage = StringUtils::Format(strStarted.c_str(),
+                                     static_cast<int>(remaining)/60,
+                                     static_cast<int>(remaining)%60);
   }
   if (iter->second.m_strCommand.IsEmpty() || iter->second.m_fSecs > iter->second.watch.GetElapsedSeconds())
   {
index 866834d..88a3afe 100644 (file)
@@ -24,6 +24,7 @@
 #include "guilib/GUIWindowManager.h"
 #include "log.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 
 CAsyncFileCopy::CAsyncFileCopy() : CThread("AsyncFileCopy")
@@ -74,8 +75,7 @@ bool CAsyncFileCopy::Copy(const CStdString &from, const CStdString &to, const CS
     // and update the dialog as we go
     if (dlg && dlg->IsDialogRunning())
     {
-      CStdString speedString;
-      speedString.Format("%2.2f KB/s", m_speed / 1024);
+      CStdString speedString = StringUtils::Format("%2.2f KB/s", m_speed / 1024);
       dlg->SetHeading(heading);
       dlg->SetLine(0, url1.Get());
       dlg->SetLine(1, url2.Get());
index d54627e..2b639f6 100644 (file)
@@ -737,9 +737,9 @@ CStdString CCPUInfo::GetCoresUsageString() const
     CStdString strCore;
 #ifdef TARGET_WINDOWS
     // atm we get only the average over all cores
-    strCore.Format("CPU %d core(s) average: %3.1f%% ",m_cpuCount, iter->second.m_fPct);
+    strCore = StringUtils::Format("CPU %d core(s) average: %3.1f%% ", m_cpuCount, iter->second.m_fPct);
 #else
-    strCore.Format("CPU%d: %3.1f%% ",iter->first, iter->second.m_fPct);
+    strCore = StringUtils::Format("CPU%d: %3.1f%% ", iter->first, iter->second.m_fPct);
 #endif
     strCores+=strCore;
     iter++;
index 44f60a7..fde3d85 100644 (file)
@@ -25,6 +25,7 @@
 #include "music/MusicDatabase.h"
 #include "utils/log.h"
 #include "utils/Variant.h"
+#include "utils/StringUtils.h"
 #include "video/VideoDatabase.h"
 
 std::string DatabaseUtils::MediaTypeToString(MediaType mediaType)
@@ -171,16 +172,16 @@ std::string DatabaseUtils::GetField(Field field, MediaType mediaType, DatabaseQu
   {
     CStdString result;
     if (field == FieldId) return "musicvideoview.idMVideo";
-    else if (field == FieldTitle) result.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
-    else if (field == FieldTime) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_RUNTIME);
-    else if (field == FieldDirector) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_DIRECTOR);
-    else if (field == FieldStudio) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_STUDIOS);
-    else if (field == FieldYear) result.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
-    else if (field == FieldPlot) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_PLOT);
-    else if (field == FieldAlbum) result.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
-    else if (field == FieldArtist) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_ARTIST);
-    else if (field == FieldGenre) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_GENRE);
-    else if (field == FieldTrackNumber) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_TRACK);
+    else if (field == FieldTitle) result = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
+    else if (field == FieldTime) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_RUNTIME);
+    else if (field == FieldDirector) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_DIRECTOR);
+    else if (field == FieldStudio) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_STUDIOS);
+    else if (field == FieldYear) result = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
+    else if (field == FieldPlot) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_PLOT);
+    else if (field == FieldAlbum) result = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
+    else if (field == FieldArtist) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_ARTIST);
+    else if (field == FieldGenre) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_GENRE);
+    else if (field == FieldTrackNumber) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_TRACK);
     else if (field == FieldFilename) return "musicvideoview.strFilename";
     else if (field == FieldPath) return "musicvideoview.strPath";
     else if (field == FieldPlaycount) return "musicvideoview.playCount";
@@ -198,33 +199,33 @@ std::string DatabaseUtils::GetField(Field field, MediaType mediaType, DatabaseQu
     {
       // We need some extra logic to get the title value if sorttitle isn't set
       if (queryPart == DatabaseQueryPartOrderBy)
-        result.Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d ELSE movieview.c%02d END", VIDEODB_ID_SORTTITLE, VIDEODB_ID_SORTTITLE, VIDEODB_ID_TITLE);
+        result = StringUtils::Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d ELSE movieview.c%02d END", VIDEODB_ID_SORTTITLE, VIDEODB_ID_SORTTITLE, VIDEODB_ID_TITLE);
       else
-        result.Format("movieview.c%02d", VIDEODB_ID_TITLE);
+        result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TITLE);
     }
-    else if (field == FieldPlot) result.Format("movieview.c%02d", VIDEODB_ID_PLOT);
-    else if (field == FieldPlotOutline) result.Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
-    else if (field == FieldTagline) result.Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
-    else if (field == FieldVotes) result.Format("movieview.c%02d", VIDEODB_ID_VOTES);
+    else if (field == FieldPlot) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOT);
+    else if (field == FieldPlotOutline) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
+    else if (field == FieldTagline) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
+    else if (field == FieldVotes) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_VOTES);
     else if (field == FieldRating)
     {
       if (queryPart == DatabaseQueryPartOrderBy)
-        result.Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
+        result = StringUtils::Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
       else
-        result.Format("movieview.c%02d", VIDEODB_ID_RATING);
+        result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RATING);
     }
-    else if (field == FieldWriter) result.Format("movieview.c%02d", VIDEODB_ID_CREDITS);
-    else if (field == FieldYear) result.Format("movieview.c%02d", VIDEODB_ID_YEAR);
-    else if (field == FieldSortTitle) result.Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
-    else if (field == FieldTime) result.Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
-    else if (field == FieldMPAA) result.Format("movieview.c%02d", VIDEODB_ID_MPAA);
-    else if (field == FieldTop250) result.Format("movieview.c%02d", VIDEODB_ID_TOP250);
+    else if (field == FieldWriter) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_CREDITS);
+    else if (field == FieldYear) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_YEAR);
+    else if (field == FieldSortTitle) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
+    else if (field == FieldTime) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
+    else if (field == FieldMPAA) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_MPAA);
+    else if (field == FieldTop250) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TOP250);
     else if (field == FieldSet) return "movieview.strSet";
-    else if (field == FieldGenre) result.Format("movieview.c%02d", VIDEODB_ID_GENRE);
-    else if (field == FieldDirector) result.Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
-    else if (field == FieldStudio) result.Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
-    else if (field == FieldTrailer) result.Format("movieview.c%02d", VIDEODB_ID_TRAILER);
-    else if (field == FieldCountry) result.Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
+    else if (field == FieldGenre) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_GENRE);
+    else if (field == FieldDirector) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
+    else if (field == FieldStudio) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
+    else if (field == FieldTrailer) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TRAILER);
+    else if (field == FieldCountry) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
     else if (field == FieldFilename) return "movieview.strFilename";
     else if (field == FieldPath) return "movieview.strPath";
     else if (field == FieldPlaycount) return "movieview.playCount";
@@ -242,19 +243,19 @@ std::string DatabaseUtils::GetField(Field field, MediaType mediaType, DatabaseQu
     {
       // We need some extra logic to get the title value if sorttitle isn't set
       if (queryPart == DatabaseQueryPartOrderBy)
-        result.Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d ELSE tvshowview.c%02d END", VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_TITLE);
+        result = StringUtils::Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d ELSE tvshowview.c%02d END", VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_TITLE);
       else
-        result.Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
+        result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
     }
-    else if (field == FieldPlot) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
-    else if (field == FieldTvShowStatus) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
-    else if (field == FieldVotes) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
-    else if (field == FieldRating) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
-    else if (field == FieldYear) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
-    else if (field == FieldGenre) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
-    else if (field == FieldMPAA) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
-    else if (field == FieldStudio) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
-    else if (field == FieldSortTitle) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
+    else if (field == FieldPlot) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
+    else if (field == FieldTvShowStatus) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
+    else if (field == FieldVotes) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
+    else if (field == FieldRating) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
+    else if (field == FieldYear) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
+    else if (field == FieldGenre) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
+    else if (field == FieldMPAA) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
+    else if (field == FieldStudio) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
+    else if (field == FieldSortTitle) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
     else if (field == FieldPath) return "tvshowview.strPath";
     else if (field == FieldDateAdded) return "tvshowview.dateAdded";
     else if (field == FieldLastPlayed) return "tvshowview.lastPlayed";
@@ -269,19 +270,19 @@ std::string DatabaseUtils::GetField(Field field, MediaType mediaType, DatabaseQu
   {
     CStdString result;
     if (field == FieldId) return "episodeview.idEpisode";
-    else if (field == FieldTitle) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
-    else if (field == FieldPlot) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
-    else if (field == FieldVotes) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
-    else if (field == FieldRating) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
-    else if (field == FieldWriter) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
-    else if (field == FieldAirDate) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
-    else if (field == FieldTime) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
-    else if (field == FieldDirector) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
-    else if (field == FieldSeason) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
-    else if (field == FieldEpisodeNumber) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
-    else if (field == FieldUniqueId) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_UNIQUEID);
-    else if (field == FieldEpisodeNumberSpecialSort) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTEPISODE);
-    else if (field == FieldSeasonSpecialSort) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTSEASON);
+    else if (field == FieldTitle) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
+    else if (field == FieldPlot) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
+    else if (field == FieldVotes) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
+    else if (field == FieldRating) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
+    else if (field == FieldWriter) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
+    else if (field == FieldAirDate) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
+    else if (field == FieldTime) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
+    else if (field == FieldDirector) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
+    else if (field == FieldSeason) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
+    else if (field == FieldEpisodeNumber) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
+    else if (field == FieldUniqueId) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_UNIQUEID);
+    else if (field == FieldEpisodeNumberSpecialSort) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTEPISODE);
+    else if (field == FieldSeasonSpecialSort) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTSEASON);
     else if (field == FieldFilename) return "episodeview.strFilename";
     else if (field == FieldPath) return "episodeview.strPath";
     else if (field == FieldPlaycount) return "episodeview.playCount";
index 0ab84c4..abe966b 100644 (file)
@@ -341,15 +341,16 @@ CStdString CEdenVideoArtUpdater::GetCachedSeasonThumb(int season, const CStdStri
   else if (season == 0)
     label = g_localizeStrings.Get(20381);
   else
-    label.Format(g_localizeStrings.Get(20358), season);
+    label = StringUtils::Format(g_localizeStrings.Get(20358), season);
   return GetThumb("season" + path + label, CProfilesManager::Get().GetVideoThumbFolder(), true);
 }
 
 CStdString CEdenVideoArtUpdater::GetCachedEpisodeThumb(const CFileItem &item)
 {
   // get the locally cached thumb
-  CStdString strCRC;
-  strCRC.Format("%sepisode%i", item.GetVideoInfoTag()->m_strFileNameAndPath.c_str(), item.GetVideoInfoTag()->m_iEpisode);
+  CStdString strCRC = StringUtils::Format("%sepisode%i",
+                                          item.GetVideoInfoTag()->m_strFileNameAndPath.c_str(),
+                                          item.GetVideoInfoTag()->m_iEpisode);
   return GetThumb(strCRC, CProfilesManager::Get().GetVideoThumbFolder(), true);
 }
 
@@ -386,12 +387,11 @@ CStdString CEdenVideoArtUpdater::GetThumb(const CStdString &path, const CStdStri
   CStdString thumb;
   if (split)
   {
-    CStdString hex;
-    hex.Format("%08x", (__int32)crc);
-    thumb.Format("%c\\%08x.tbn", hex[0], (unsigned __int32)crc);
+    CStdString hex = StringUtils::Format("%08x", (__int32)crc);
+    thumb = StringUtils::Format("%c\\%08x.tbn", hex[0], (unsigned __int32)crc);
   }
   else
-    thumb.Format("%08x.tbn", (unsigned __int32)crc);
+    thumb = StringUtils::Format("%08x.tbn", (unsigned __int32)crc);
 
   return URIUtils::AddFileToFolder(path2, thumb);
 }
index e8c2e6c..4fb075b 100644 (file)
@@ -28,6 +28,7 @@
 #include "log.h"
 #include "Util.h"
 #include "URIUtils.h"
+#include "utils/StringUtils.h"
 #include "URL.h"
 #include "guilib/LocalizeStrings.h"
 #include "guilib/GUIWindowManager.h"
@@ -333,15 +334,16 @@ bool CFileOperationJob::CFileOperation::OnFileCallback(void* pContext, int iperc
   double current = data->current + ((double)ipercent * data->opWeight * (double)m_time)/ 100.0;
 
   if (avgSpeed > 1000000.0f)
-    data->base->m_avgSpeed.Format("%.1f MB/s", avgSpeed / 1000000.0f);
+    data->base->m_avgSpeed = StringUtils::Format("%.1f MB/s", avgSpeed / 1000000.0f);
   else
-    data->base->m_avgSpeed.Format("%.1f KB/s", avgSpeed / 1000.0f);
+    data->base->m_avgSpeed = StringUtils::Format("%.1f KB/s", avgSpeed / 1000.0f);
 
   if (data->base->m_handle)
   {
     CStdString line;
-    line.Format("%s (%s)", data->base->GetCurrentFile().c_str(),
-                           data->base->GetAverageSpeed().c_str());
+    line = StringUtils::Format("%s (%s)",
+                               data->base->GetCurrentFile().c_str(),
+                               data->base->GetAverageSpeed().c_str());
     data->base->m_handle->SetText(line);
     data->base->m_handle->SetPercentage((float)current);
   }
index 60c302f..7efe00e 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "HTMLUtil.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 using namespace HTML;
@@ -297,9 +298,9 @@ void CHTMLUtil::ConvertHTMLToW(const CStdStringW& strHTML, CStdStringW& strStrip
     num = strStripped.Mid(i,iPos-i);
     wchar_t val = (wchar_t)wcstol(num.c_str(),NULL,base);
     if (base == 10)
-      num.Format(L"&#%ls;",num.c_str());
+      num = StringUtils::Format(L"&#%ls;", num.c_str());
     else
-      num.Format(L"&#x%ls;",num.c_str());
+      num = StringUtils::Format(L"&#x%ls;", num.c_str());
 
     strStripped.Replace(num,CStdStringW(1,val));
     iPos = strStripped.Find(L"&#", iStart);
index 31fa1bd..8773160 100644 (file)
@@ -158,13 +158,13 @@ CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileI
   {
   case 'N':
     if (music && music->GetTrackNumber() > 0)
-      value.Format("%02.2i", music->GetTrackNumber());
+      value = StringUtils::Format("%02.2i", music->GetTrackNumber());
     if (movie&& movie->m_iTrack > 0)
-      value.Format("%02.2i", movie->m_iTrack);
+      value = StringUtils::Format("%02.2i", movie->m_iTrack);
     break;
   case 'S':
     if (music && music->GetDiscNumber() > 0)
-      value.Format("%02.2i", music->GetDiscNumber());
+      value = StringUtils::Format("%02.2i", music->GetDiscNumber());
     break;
   case 'A':
     if (music && music->GetArtist().size())
@@ -204,7 +204,7 @@ CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileI
       else if (movie->m_premiered.IsValid())
         value = movie->m_premiered.GetAsLocalizedDate();
       else if (movie->m_iYear > 0)
-        value.Format("%i",movie->m_iYear);
+        value = StringUtils::Format("%i", movie->m_iYear);
     }
     break;
   case 'F': // filename
@@ -247,25 +247,27 @@ CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileI
     if (music && music->GetRating() != '0')
       value = music->GetRating();
     else if (movie && movie->m_fRating != 0.f)
-      value.Format("%.1f", movie->m_fRating);
+      value = StringUtils::Format("%.1f", movie->m_fRating);
     break;
   case 'C': // programs count
-    value.Format("%i", item->m_iprogramCount);
+    value = StringUtils::Format("%i", item->m_iprogramCount);
     break;
   case 'K':
     value = item->m_strTitle;
     break;
   case 'M':
     if (movie && movie->m_iEpisode > 0)
-      value.Format("%i %s", movie->m_iEpisode,g_localizeStrings.Get(movie->m_iEpisode == 1 ? 20452 : 20453));
+      value = StringUtils::Format("%i %s",
+                                  movie->m_iEpisode,
+                                  g_localizeStrings.Get(movie->m_iEpisode == 1 ? 20452 : 20453).c_str());
     break;
   case 'E':
     if (movie && movie->m_iEpisode > 0)
     { // episode number
       if (movie->m_iSeason == 0)
-        value.Format("S%02.2i", movie->m_iEpisode);
+        value = StringUtils::Format("S%02.2i", movie->m_iEpisode);
       else
-        value.Format("%02.2i", movie->m_iEpisode);
+        value = StringUtils::Format("%02.2i", movie->m_iEpisode);
     }
     break;
   case 'P':
@@ -276,9 +278,9 @@ CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileI
     if (movie && movie->m_iEpisode > 0)
     { // season*100+episode number
       if (movie->m_iSeason == 0)
-        value.Format("S%02.2i", movie->m_iEpisode);
+        value = StringUtils::Format("S%02.2i", movie->m_iEpisode);
       else
-        value.Format("%ix%02.2i", movie->m_iSeason,movie->m_iEpisode);
+        value = StringUtils::Format("%ix%02.2i", movie->m_iSeason,movie->m_iEpisode);
     }
     break;
   case 'O':
@@ -295,17 +297,19 @@ CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileI
     break;
   case 'V': // Playcount
     if (music)
-      value.Format("%i", music->GetPlayCount());
+      value = StringUtils::Format("%i", music->GetPlayCount());
     if (movie)
-      value.Format("%i", movie->m_playCount);
+      value = StringUtils::Format("%i", movie->m_playCount);
     break;
   case 'X': // Bitrate
     if( !item->m_bIsFolder && item->m_dwSize != 0 )
-      value.Format("%i kbps", item->m_dwSize);
+      value = StringUtils::Format("%i kbps", item->m_dwSize);
     break;
    case 'W': // Listeners
     if( !item->m_bIsFolder && music && music->GetListeners() != 0 )
-     value.Format("%i %s", music->GetListeners(), g_localizeStrings.Get(music->GetListeners() == 1 ? 20454 : 20455));
+     value = StringUtils::Format("%i %s",
+                                 music->GetListeners(),
+                                 g_localizeStrings.Get(music->GetListeners() == 1 ? 20454 : 20455).c_str());
     break;
   case 'a': // Date Added
     if (movie && movie->m_dateAdded.IsValid())
index 4d44ef0..44aedd8 100644 (file)
@@ -22,6 +22,7 @@
 #include "utils/XBMCTinyXML.h"
 #include "LangInfo.h"
 #include "utils/log.h" 
+#include "utils/StringUtils.h"
 
 #define MAKECODE(a, b, c, d)  ((((long)(a))<<24) | (((long)(b))<<16) | (((long)(c))<<8) | (long)(d))
 #define MAKETWOCHARCODE(a, b) ((((long)(a))<<8) | (long)(b)) 
@@ -197,7 +198,7 @@ bool CLangCodeExpander::ConvertToThreeCharCode(CStdString& strThreeCharCode, con
   {
     for(unsigned int i = 0; i < sizeof(g_iso639_2) / sizeof(LCENTRY); i++)
     {
-      if (strCharCode.Equals(g_iso639_2[i].name))
+      if (StringUtils::EqualsNoCase(strCharCode, g_iso639_2[i].name))
       {
         CodeToString(g_iso639_2[i].code, strThreeCharCode);
         return true;
index 0450779..3fc3d13 100644 (file)
@@ -63,10 +63,8 @@ bool CRecentlyAddedJob::UpdateVideo()
     for (; i < items.Size(); ++i)
     {
       CFileItemPtr item = items.Get(i);
-      CStdString   value;
-      CStdString   strRating;
-      value.Format("%i", i + 1);
-      strRating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+      CStdString   value = StringUtils::Format("%i", i + 1);
+      CStdString   strRating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->m_fRating);;
       
       home->SetProperty("LatestMovie." + value + ".Title"       , item->GetLabel());
       home->SetProperty("LatestMovie." + value + ".Rating"      , strRating);
@@ -85,8 +83,7 @@ bool CRecentlyAddedJob::UpdateVideo()
   } 
   for (; i < NUM_ITEMS; ++i)
   {
-    CStdString value;
-    value.Format("%i", i + 1);
+    CStdString value = StringUtils::Format("%i", i + 1);
     home->SetProperty("LatestMovie." + value + ".Title"       , "");
     home->SetProperty("LatestMovie." + value + ".Thumb"       , "");
     home->SetProperty("LatestMovie." + value + ".Rating"      , "");
@@ -108,12 +105,9 @@ bool CRecentlyAddedJob::UpdateVideo()
       CFileItemPtr item          = TVShowItems.Get(i);
       int          EpisodeSeason = item->GetVideoInfoTag()->m_iSeason;
       int          EpisodeNumber = item->GetVideoInfoTag()->m_iEpisode;
-      CStdString   EpisodeNo;
-      CStdString   value;
-      CStdString   strRating;
-      EpisodeNo.Format("s%02de%02d", EpisodeSeason, EpisodeNumber);
-      value.Format("%i", i + 1);
-      strRating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+      CStdString   EpisodeNo = StringUtils::Format("s%02de%02d", EpisodeSeason, EpisodeNumber);
+      CStdString   value = StringUtils::Format("%i", i + 1);
+      CStdString   strRating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->m_fRating);
 
       CFileItem show(item->GetVideoInfoTag()->m_strShowPath, true);
 
@@ -141,8 +135,7 @@ bool CRecentlyAddedJob::UpdateVideo()
   } 
   for (; i < NUM_ITEMS; ++i)
   {
-    CStdString value;
-    value.Format("%i", i + 1);
+    CStdString value = StringUtils::Format("%i", i + 1);
     home->SetProperty("LatestEpisode." + value + ".ShowTitle"     , "");
     home->SetProperty("LatestEpisode." + value + ".EpisodeTitle"  , "");
     home->SetProperty("LatestEpisode." + value + ".Rating"        , "");      
@@ -165,8 +158,7 @@ bool CRecentlyAddedJob::UpdateVideo()
     for (; i < MusicVideoItems.Size(); ++i)
     {
       CFileItemPtr item = MusicVideoItems.Get(i);
-      CStdString   value;
-      value.Format("%i", i + 1);
+      CStdString   value = StringUtils::Format("%i", i + 1);
 
       home->SetProperty("LatestMusicVideo." + value + ".Title"       , item->GetLabel());
       home->SetProperty("LatestMusicVideo." + value + ".Year"        , item->GetVideoInfoTag()->m_iYear);
@@ -184,8 +176,7 @@ bool CRecentlyAddedJob::UpdateVideo()
   }
   for (; i < NUM_ITEMS; ++i)
   {
-    CStdString value;
-    value.Format("%i", i + 1);
+    CStdString value = StringUtils::Format("%i", i + 1);
     home->SetProperty("LatestMusicVideo." + value + ".Title"       , "");
     home->SetProperty("LatestMusicVideo." + value + ".Thumb"       , "");
     home->SetProperty("LatestMusicVideo." + value + ".Year"        , "");
@@ -225,8 +216,7 @@ bool CRecentlyAddedJob::UpdateMusic()
     for (; i < musicItems.Size(); ++i)
     {
       CFileItemPtr item = musicItems.Get(i);
-      CStdString   value;
-      value.Format("%i", i + 1);
+      CStdString   value = StringUtils::Format("%i", i + 1);
       
       CStdString   strRating;
       CStdString   strAlbum  = item->GetMusicInfoTag()->GetAlbum();
@@ -245,7 +235,7 @@ bool CRecentlyAddedJob::UpdateMusic()
         }
       }
 
-      strRating.Format("%c", item->GetMusicInfoTag()->GetRating());
+      strRating = StringUtils::Format("%c", item->GetMusicInfoTag()->GetRating());
       
       home->SetProperty("LatestSong." + value + ".Title"   , item->GetMusicInfoTag()->GetTitle());
       home->SetProperty("LatestSong." + value + ".Year"    , item->GetMusicInfoTag()->GetYear());
@@ -259,8 +249,7 @@ bool CRecentlyAddedJob::UpdateMusic()
   }
   for (; i < NUM_ITEMS; ++i)
   {
-    CStdString value;
-    value.Format("%i", i + 1);
+    CStdString value = StringUtils::Format("%i", i + 1);
     home->SetProperty("LatestSong." + value + ".Title"   , "");
     home->SetProperty("LatestSong." + value + ".Year"    , "");
     home->SetProperty("LatestSong." + value + ".Artist"  , "");      
@@ -278,20 +267,12 @@ bool CRecentlyAddedJob::UpdateMusic()
   { 
     for (; i < (int)albums.size(); ++i)
     {
-      CStdString value;
-      CStdString strPath;
-      CStdString strThumb;
-      CStdString strFanart;
-      CStdString strDBpath;
-      CStdString strSQLAlbum;
-      CAlbum&    album=albums[i];     
-
-      value.Format("%i", i + 1);
-      strThumb = musicdatabase.GetArtForItem(album.idAlbum, "album", "thumb");
-      strFanart = musicdatabase.GetArtistArtForItem(album.idAlbum, "album", "fanart");
-      strDBpath.Format("musicdb://albums/%i/", album.idAlbum);
-      strSQLAlbum.Format("idAlbum=%i", album.idAlbum);
-      
+      CAlbum&    album=albums[i];
+      CStdString value = StringUtils::Format("%i", i + 1);
+      CStdString strThumb = musicdatabase.GetArtForItem(album.idAlbum, "album", "thumb");
+      CStdString strFanart = musicdatabase.GetArtistArtForItem(album.idAlbum, "album", "fanart");
+      CStdString strDBpath = StringUtils::Format("musicdb://albums/%i/", album.idAlbum);
+      CStdString strSQLAlbum = StringUtils::Format("idAlbum=%i", album.idAlbum);
       CStdString strArtist = musicdatabase.GetSingleValue("albumview", "strArtists", strSQLAlbum);
       
       home->SetProperty("LatestAlbum." + value + ".Title"   , album.strAlbum);
@@ -305,8 +286,7 @@ bool CRecentlyAddedJob::UpdateMusic()
   }
   for (; i < NUM_ITEMS; ++i)
   {
-    CStdString value;
-    value.Format("%i", i + 1);
+    CStdString value = StringUtils::Format("%i", i + 1);
     home->SetProperty("LatestAlbum." + value + ".Title"   , "");
     home->SetProperty("LatestAlbum." + value + ".Year"    , "");
     home->SetProperty("LatestAlbum." + value + ".Artist"  , "");      
index 1626af7..cbbf855 100644 (file)
@@ -24,6 +24,7 @@
 #include "RegExp.h"
 #include "StdString.h"
 #include "log.h"
+#include "utils/StringUtils.h"
 
 using namespace PCRE;
 
@@ -382,8 +383,7 @@ void CRegExp::DumpOvector(int iLog /* = LOGDEBUG */)
   int size = GetSubCount(); // past the subpatterns is junk
   for (int i = 0; i <= size; i++)
   {
-    CStdString t;
-    t.Format("[%i,%i]", m_iOvector[(i*2)], m_iOvector[(i*2)+1]);
+    CStdString t = StringUtils::Format("[%i,%i]", m_iOvector[(i*2)], m_iOvector[(i*2)+1]);
     if (i != size)
       t += ",";
     str += t;
index 2a5268c..9ca4329 100644 (file)
@@ -26,6 +26,7 @@
 #include "addons/Scraper.h"
 #include "URL.h"
 #include "Util.h"
+#include "utils/StringUtils.h"
 #include "log.h"
 #include "CharsetConverter.h"
 #include "utils/StringUtils.h"
@@ -153,9 +154,8 @@ void CScraperParser::ReplaceBuffers(CStdString& strDest)
   int iIndex;
   for (int i=MAX_SCRAPER_BUFFERS-1; i>=0; i--)
   {
-    CStdString temp;
     iIndex = 0;
-    temp.Format("$$%i",i+1);
+    CStdString temp = StringUtils::Format("$$%i",i+1);
     while ((size_t)(iIndex = strDest.find(temp,iIndex)) != CStdString::npos) // COPIED FROM CStdString WITH THE ADDITION OF $ ESCAPING
     {
       strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+temp.GetLength(),m_param[i]);
@@ -503,8 +503,7 @@ void CScraperParser::ConvertJSON(CStdString &string)
     int pos = reg.GetSubStart(1);
     std::string szReplace(reg.GetMatch(1));
 
-    CStdString replace;
-    replace.Format("&#x%s;", szReplace.c_str());
+    CStdString replace = StringUtils::Format("&#x%s;", szReplace.c_str());
     string.replace(string.begin()+pos-2, string.begin()+pos+4, replace);
   }
 
@@ -516,8 +515,7 @@ void CScraperParser::ConvertJSON(CStdString &string)
     int pos2 = reg2.GetSubStart(2);
     std::string szHexValue(reg2.GetMatch(1));
 
-    CStdString replace;
-    replace.Format("%c", strtol(szHexValue.c_str(), NULL, 16));
+    CStdString replace = StringUtils::Format("%c", strtol(szHexValue.c_str(), NULL, 16));
     string.replace(string.begin()+pos1-2, string.begin()+pos2+reg2.GetSubLength(2), replace);
   }
 
index 49061f7..1ba58fa 100644 (file)
@@ -68,30 +68,22 @@ string ByFile(SortAttribute attributes, const SortItem &values)
 {
   CURL url(values.at(FieldPath).asString());
   
-  CStdString label;
-  label.Format("%s %d", url.GetFileNameWithoutPath().c_str(), values.at(FieldStartOffset).asInteger());
-  return label;
+  return StringUtils::Format("%s %d", url.GetFileNameWithoutPath().c_str(), values.at(FieldStartOffset).asInteger());
 }
 
 string ByPath(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%s %d", values.at(FieldPath).asString().c_str(), values.at(FieldStartOffset).asInteger());
-  return label;
+  return StringUtils::Format("%s %d", values.at(FieldPath).asString().c_str(), values.at(FieldStartOffset).asInteger());
 }
 
 string ByLastPlayed(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%s %s", values.at(FieldLastPlayed).asString().c_str(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%s %s", values.at(FieldLastPlayed).asString().c_str(), ByLabel(attributes, values).c_str());
 }
 
 string ByPlaycount(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i %s", (int)values.at(FieldPlaycount).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%i %s", (int)values.at(FieldPlaycount).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByDate(SortAttribute attributes, const SortItem &values)
@@ -101,23 +93,17 @@ string ByDate(SortAttribute attributes, const SortItem &values)
 
 string ByDateAdded(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%s %d", values.at(FieldDateAdded).asString().c_str(), (int)values.at(FieldId).asInteger());
-  return label;
+  return StringUtils::Format("%s %d", values.at(FieldDateAdded).asString().c_str(), (int)values.at(FieldId).asInteger());;
 }
 
 string BySize(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%"PRId64, values.at(FieldSize).asInteger());
-  return label;
+  return StringUtils::Format("%"PRId64, values.at(FieldSize).asInteger());
 }
 
 string ByDriveType(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%d %s", (int)values.at(FieldDriveType).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%d %s", (int)values.at(FieldDriveType).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByTitle(SortAttribute attributes, const SortItem &values)
@@ -134,8 +120,7 @@ string ByAlbum(SortAttribute attributes, const SortItem &values)
   if (attributes & SortAttributeIgnoreArticle)
     album = SortUtils::RemoveArticles(album);
 
-  CStdString label;
-  label.Format("%s %s", album, ArrayToString(attributes, values.at(FieldArtist)));
+  CStdString label = StringUtils::Format("%s %s", album.c_str(), ArrayToString(attributes, values.at(FieldArtist)).c_str());
 
   const CVariant &track = values.at(FieldTrackNumber);
   if (!track.isNull())
@@ -171,9 +156,7 @@ string ByArtist(SortAttribute attributes, const SortItem &values)
 
 string ByTrackNumber(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i", (int)values.at(FieldTrackNumber).asInteger());
-  return label;
+  return StringUtils::Format("%i", (int)values.at(FieldTrackNumber).asInteger());
 }
 
 string ByTime(SortAttribute attributes, const SortItem &values)
@@ -181,17 +164,15 @@ string ByTime(SortAttribute attributes, const SortItem &values)
   CStdString label;
   const CVariant &time = values.at(FieldTime);
   if (time.isInteger())
-    label.Format("%i", (int)time.asInteger());
+    label = StringUtils::Format("%i", (int)time.asInteger());
   else
-    label.Format("%s", time.asString());
+    label = StringUtils::Format("%s", time.asString().c_str());
   return label;
 }
 
 string ByProgramCount(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i", (int)values.at(FieldProgramCount).asInteger());
-  return label;
+  return StringUtils::Format("%i", (int)values.at(FieldProgramCount).asInteger());
 }
 
 string ByPlaylistOrder(SortAttribute attributes, const SortItem &values)
@@ -236,23 +217,17 @@ string BySortTitle(SortAttribute attributes, const SortItem &values)
 
 string ByRating(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%f %s", values.at(FieldRating).asFloat(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%f %s", values.at(FieldRating).asFloat(), ByLabel(attributes, values).c_str());
 }
 
 string ByVotes(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%d %s", (int)values.at(FieldVotes).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%d %s", (int)values.at(FieldVotes).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByTop250(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%d %s", (int)values.at(FieldTop250).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%d %s", (int)values.at(FieldTop250).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByMPAA(SortAttribute attributes, const SortItem &values)
@@ -290,9 +265,7 @@ string ByEpisodeNumber(SortAttribute attributes, const SortItem &values)
   if (title.empty())
     title = ByLabel(attributes, values);
 
-  CStdString label;
-  label.Format("%"PRIu64" %s", num, title.c_str());
-  return label;
+  return StringUtils::Format("%"PRIu64" %s", num, title.c_str());
 }
 
 string BySeason(SortAttribute attributes, const SortItem &values)
@@ -302,23 +275,17 @@ string BySeason(SortAttribute attributes, const SortItem &values)
   if (!specialSeason.isNull())
     season = (int)specialSeason.asInteger();
 
-  CStdString label;
-  label.Format("%i %s", season, ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%i %s", season, ByLabel(attributes, values).c_str());
 }
 
 string ByNumberOfEpisodes(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i %s", (int)values.at(FieldNumberOfEpisodes).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%i %s", (int)values.at(FieldNumberOfEpisodes).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByNumberOfWatchedEpisodes(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i %s", (int)values.at(FieldNumberOfWatchedEpisodes).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%i %s", (int)values.at(FieldNumberOfWatchedEpisodes).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByTvShowStatus(SortAttribute attributes, const SortItem &values)
@@ -338,72 +305,52 @@ string ByProductionCode(SortAttribute attributes, const SortItem &values)
 
 string ByVideoResolution(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i %s", (int)values.at(FieldVideoResolution).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%i %s", (int)values.at(FieldVideoResolution).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByVideoCodec(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%s %s", values.at(FieldVideoCodec).asString(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%s %s", values.at(FieldVideoCodec).asString().c_str(), ByLabel(attributes, values).c_str());
 }
 
 string ByVideoAspectRatio(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%f %s", values.at(FieldVideoAspectRatio).asString(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%f %s", values.at(FieldVideoAspectRatio).asString().c_str(), ByLabel(attributes, values).c_str());
 }
 
 string ByAudioChannels(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i %s", (int)values.at(FieldAudioChannels).asInteger(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%i %s", (int)values.at(FieldAudioChannels).asInteger(), ByLabel(attributes, values).c_str());
 }
 
 string ByAudioCodec(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%s %s", values.at(FieldAudioCodec).asString(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%s %s", values.at(FieldAudioCodec).asString().c_str(), ByLabel(attributes, values).c_str());
 }
 
 string ByAudioLanguage(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%s %s", values.at(FieldAudioLanguage).asString(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%s %s", values.at(FieldAudioLanguage).asString().c_str(), ByLabel(attributes, values).c_str());;
 }
 
 string BySubtitleLanguage(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%s %s", values.at(FieldSubtitleLanguage).asString(), ByLabel(attributes, values).c_str());
-  return label;
+  return StringUtils::Format("%s %s", values.at(FieldSubtitleLanguage).asString().c_str(), ByLabel(attributes, values).c_str());
 }
 
 string ByBitrate(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%"PRId64, values.at(FieldBitrate).asInteger());
-  return label;
+  return StringUtils::Format("%"PRId64, values.at(FieldBitrate).asInteger());
 }
 
 string ByListeners(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i", values.at(FieldListeners).asInteger());
-  return label;
+  return StringUtils::Format("%i", values.at(FieldListeners).asInteger());;
 }
 
 string ByRandom(SortAttribute attributes, const SortItem &values)
 {
-  CStdString label;
-  label.Format("%i", CUtil::GetRandomNumber());
-  return label;
+  return StringUtils::Format("%i", CUtil::GetRandomNumber());;
 }
 
 string ByChannel(SortAttribute attributes, const SortItem &values)
index 8cdd085..6d53523 100644 (file)
@@ -2588,523 +2588,6 @@ public:
 
 #endif  // #ifdef SS_ANSI
 
-  // -------------------------------------------------------------------------
-  // FUNCTION:  CStdStr::Format
-  //    void _cdecl Formst(CStdStringA& PCSTR szFormat, ...)
-  //    void _cdecl Format(PCSTR szFormat);
-  //
-  // DESCRIPTION:
-  //    This function does sprintf/wsprintf style formatting on CStdStringA
-  //    objects.  It looks a lot like MFC's CString::Format.  Some people
-  //    might even call this identical.  Fortunately, these people are now
-  //    dead... heh heh.
-  //
-  // PARAMETERS:
-  //    nId - ID of string resource holding the format string
-  //    szFormat - a PCSTR holding the format specifiers
-  //    argList - a va_list holding the arguments for the format specifiers.
-  //
-  // RETURN VALUE:  None.
-  // -------------------------------------------------------------------------
-  // formatting (using wsprintf style formatting)
-
-    // If they want a Format() function that safely handles string objects
-    // without casting
-
-#ifdef SS_SAFE_FORMAT
-
-    // Question:  Joe, you wacky coder you, why do you have so many overloads
-    //      of the Format() function
-    // Answer:  One reason only - CString compatability.  In short, by making
-    //      the Format() function a template this way, I can do strong typing
-    //      and allow people to pass CStdString arguments as fillers for
-    //      "%s" format specifiers without crashing their program!  The downside
-    //      is that I need to overload on the number of arguments.   If you are
-    //      passing more arguments than I have listed below in any of my
-    //      overloads, just add another one.
-    //
-    //      Yes, yes, this is really ugly.  In essence what I am doing here is
-    //      protecting people from a bad (and incorrect) programming practice
-    //      that they should not be doing anyway.  I am protecting them from
-    //      themselves.  Why am I doing this?  Well, if you had any idea the
-    //      number of times I've been emailed by people about this
-    //      "incompatability" in my code, you wouldn't ask.
-
-  void Fmt(const CT* szFmt, ...)
-  {
-    va_list argList;
-    va_start(argList, szFmt);
-    FormatV(szFmt, argList);
-    va_end(argList);
-  }
-
-#ifndef SS_ANSI
-
-    void Format(UINT nId)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-            this->swap(strFmt);
-    }
-    template<class A1>
-    void Format(UINT nId, const A1& v)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-            Fmt(strFmt, FmtArg<A1>(v)());
-    }
-    template<class A1, class A2>
-    void Format(UINT nId, const A1& v1, const A2& v2)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-           Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)());
-    }
-    template<class A1, class A2, class A3>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(),FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(),FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-           Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(), FmtArg<A10>(v10)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(),FmtArg<A10>(v10)(),FmtArg<A11>(v11)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-                FmtArg<A12>(v12)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-                FmtArg<A12>(v12)(), FmtArg<A13>(v13)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-                FmtArg<A12>(v12)(), FmtArg<A13>(v13)(),FmtArg<A14>(v14)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14, class A15>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14, const A15& v15)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-                FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
-                FmtArg<A15>(v15)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14, class A15, class A16>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14, const A15& v15,
-                const A16& v16)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-                FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
-                FmtArg<A15>(v15)(), FmtArg<A16>(v16)());
-        }
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14, class A15, class A16, class A17>
-    void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14, const A15& v15,
-                const A16& v16, const A17& v17)
-    {
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-        {
-            Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-                FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-                FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-                FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-                FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
-                FmtArg<A15>(v15)(),FmtArg<A16>(v16)(),FmtArg<A17>(v17)());
-        }
-    }
-
-#endif // #ifndef SS_ANSI
-
-    // ...now the other overload of Format: the one that takes a string literal
-
-    void Format(const CT* szFmt)
-    {
-        *this = szFmt;
-    }
-    template<class A1>
-    void Format(const CT* szFmt, const A1& v)
-    {
-        Fmt(szFmt, FmtArg<A1>(v)());
-    }
-    template<class A1, class A2>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)());
-    }
-    template<class A1, class A2, class A3>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)());
-    }
-    template<class A1, class A2, class A3, class A4>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(), FmtArg<A10>(v10)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(),FmtArg<A10>(v10)(),FmtArg<A11>(v11)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-            FmtArg<A12>(v12)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-            FmtArg<A12>(v12)(), FmtArg<A13>(v13)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-            FmtArg<A12>(v12)(), FmtArg<A13>(v13)(),FmtArg<A14>(v14)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14, class A15>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14, const A15& v15)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-            FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
-            FmtArg<A15>(v15)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14, class A15, class A16>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14, const A15& v15,
-                const A16& v16)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-            FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
-            FmtArg<A15>(v15)(), FmtArg<A16>(v16)());
-    }
-    template<class A1, class A2, class A3, class A4, class A5, class A6,
-        class A7, class A8, class A9, class A10, class A11, class A12,
-        class A13, class A14, class A15, class A16, class A17>
-    void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
-                const A4& v4, const A5& v5, const A6& v6, const A7& v7,
-                const A8& v8, const A9& v9, const A10& v10, const A11& v11,
-                const A12& v12, const A13& v13, const A14& v14, const A15& v15,
-                const A16& v16, const A17& v17)
-    {
-        Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
-            FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
-            FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
-            FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
-            FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
-            FmtArg<A15>(v15)(),FmtArg<A16>(v16)(),FmtArg<A17>(v17)());
-    }
-
-#else  // #ifdef SS_SAFE_FORMAT
-
-
-#ifndef SS_ANSI
-
-  void Format(UINT nId, ...)
-  {
-    va_list argList;
-    va_start(argList, nId);
-
-    MYTYPE strFmt;
-    if ( strFmt.Load(nId) )
-      FormatV(strFmt, argList);
-
-    va_end(argList);
-  }
-
-#endif  // #ifdef SS_ANSI
-
-  void Format(const CT* szFmt, ...)
-  {
-    va_list argList;
-    va_start(argList, szFmt);
-    FormatV(szFmt, argList);
-    va_end(argList);
-  }
-
-#endif // #ifdef SS_SAFE_FORMAT
-
   void AppendFormat(const CT* szFmt, ...)
   {
     va_list argList;
index 1a06e7c..e6995e4 100644 (file)
@@ -689,11 +689,11 @@ CStdString StringUtils::SizeToString(int64_t size)
   }
 
   if (!i)
-    strLabel.Format("%.0lf %cB ", s, prefixes[i]);
+    strLabel = StringUtils::Format("%.0lf %cB ", s, prefixes[i]);
   else if (s >= 100.0)
-    strLabel.Format("%.1lf %cB", s, prefixes[i]);
+    strLabel = StringUtils::Format("%.1lf %cB", s, prefixes[i]);
   else
-    strLabel.Format("%.2lf %cB", s, prefixes[i]);
+    strLabel = StringUtils::Format("%.2lf %cB", s, prefixes[i]);
 
   return strLabel;
 }
index d22dcc5..e24021d 100644 (file)
@@ -88,10 +88,8 @@ const CSysData &CSysInfoJob::GetData() const
 
 CStdString CSysInfoJob::GetCPUFreqInfo()
 {
-  CStdString strCPUFreq;
   double CPUFreq = GetCPUFrequency();
-  strCPUFreq.Format("%4.2fMHz", CPUFreq);
-  return strCPUFreq;
+  return StringUtils::Format("%4.2fMHz", CPUFreq);;
 }
 
 CSysData::INTERNET_STATE CSysInfoJob::GetInternetState()
@@ -122,9 +120,7 @@ CStdString CSysInfoJob::GetVideoEncoder()
 
 CStdString CSysInfoJob::GetBatteryLevel()
 {
-  CStdString strVal;
-  strVal.Format("%d%%", g_powerManager.BatteryLevel());
-  return strVal;
+  return StringUtils::Format("%d%%", g_powerManager.BatteryLevel());
 }
 
 double CSysInfoJob::GetCPUFrequency()
@@ -172,21 +168,21 @@ CStdString CSysInfoJob::GetSystemUpTime(bool bTotalUptime)
   SystemUpTime(iInputMinutes,iMinutes, iHours, iDays);
   if (iDays > 0)
   {
-    strSystemUptime.Format("%i %s, %i %s, %i %s",
-      iDays,g_localizeStrings.Get(12393),
-      iHours,g_localizeStrings.Get(12392),
-      iMinutes, g_localizeStrings.Get(12391));
+    strSystemUptime = StringUtils::Format("%i %s, %i %s, %i %s",
+                                          iDays, g_localizeStrings.Get(12393).c_str(),
+                                          iHours, g_localizeStrings.Get(12392).c_str(),
+                                          iMinutes, g_localizeStrings.Get(12391).c_str());
   }
   else if (iDays == 0 && iHours >= 1 )
   {
-    strSystemUptime.Format("%i %s, %i %s",
-      iHours,g_localizeStrings.Get(12392),
-      iMinutes, g_localizeStrings.Get(12391));
+    strSystemUptime = StringUtils::Format("%i %s, %i %s",
+                                          iHours, g_localizeStrings.Get(12392).c_str(),
+                                          iMinutes, g_localizeStrings.Get(12391).c_str());
   }
   else if (iDays == 0 && iHours == 0 &&  iMinutes >= 0)
   {
-    strSystemUptime.Format("%i %s",
-      iMinutes, g_localizeStrings.Get(12391));
+    strSystemUptime = StringUtils::Format("%i %s",
+                                          iMinutes, g_localizeStrings.Get(12391).c_str());
   }
   return strSystemUptime;
 }
@@ -501,9 +497,7 @@ CStdString CSysInfo::GetKernelVersion()
   struct utsname un;
   if (uname(&un)==0)
   {
-    CStdString strKernel;
-    strKernel.Format("%s %s %s %s", un.sysname, un.release, un.version, un.machine);
-    return strKernel;
+    return StringUtils::Format("%s %s %s %s", un.sysname, un.release, un.version, un.machine);;
   }
 
   return "";
@@ -610,19 +604,19 @@ CStdString CSysInfo::GetHddSpaceInfo(int& percent, int drive, bool shortText)
       switch(drive)
       {
       case SYSTEM_FREE_SPACE:
-        strRet.Format("%i MB %s", totalFree, g_localizeStrings.Get(160));
+        strRet = StringUtils::Format("%i MB %s", totalFree, g_localizeStrings.Get(160).c_str());
         break;
       case SYSTEM_USED_SPACE:
-        strRet.Format("%i MB %s", totalUsed, g_localizeStrings.Get(20162));
+        strRet = StringUtils::Format("%i MB %s", totalUsed, g_localizeStrings.Get(20162).c_str());
         break;
       case SYSTEM_TOTAL_SPACE:
-        strRet.Format("%i MB %s", total, g_localizeStrings.Get(20161));
+        strRet = StringUtils::Format("%i MB %s", total, g_localizeStrings.Get(20161).c_str());
         break;
       case SYSTEM_FREE_SPACE_PERCENT:
-        strRet.Format("%i %% %s", percentFree, g_localizeStrings.Get(160));
+        strRet = StringUtils::Format("%i %% %s", percentFree, g_localizeStrings.Get(160).c_str());
         break;
       case SYSTEM_USED_SPACE_PERCENT:
-        strRet.Format("%i %% %s", percentused, g_localizeStrings.Get(20162));
+        strRet = StringUtils::Format("%i %% %s", percentused, g_localizeStrings.Get(20162).c_str());
         break;
       }
     }
index eb477c6..8df2b55 100644 (file)
@@ -153,8 +153,7 @@ bool CTuxBoxUtil::CreateNewItem(const CFileItem& item, CFileItem& item_new)
       CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__);
       CLog::Log(LOGDEBUG, "%s - WARNING: Zaping Failed no Zap Point found!", __FUNCTION__);
       CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__);
-      CStdString strText;
-      strText.Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel());
+      CStdString strText = StringUtils::Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel().c_str());
       CGUIDialogOK::ShowAndGetInput(21331, strText, 21333, 0);
     }
   }
@@ -567,13 +566,23 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items )
           }
           CLog::Log(LOGDEBUG, "%s - Sending all audio pids: %s%s", __FUNCTION__, strAudioChannelPid.c_str(), strAPids.c_str());
 
-          strVideoStream.Format("0,%s,%s,%s%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), sStrmInfo.apid.Left(4).c_str(), strAPids.c_str());
+          strVideoStream = StringUtils::Format("0,%s,%s,%s%s",
+                                               sStrmInfo.pmt.Left(4).c_str(),
+                                               sStrmInfo.vpid.Left(4).c_str(),
+                                               sStrmInfo.apid.Left(4).c_str(),
+                                               strAPids.c_str());
         }
         else
-          strVideoStream.Format("0,%s,%s,%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), sStrmInfo.apid.Left(4).c_str());
+          strVideoStream = StringUtils::Format("0,%s,%s,%s",
+                                               sStrmInfo.pmt.Left(4).c_str(),
+                                               sStrmInfo.vpid.Left(4).c_str(),
+                                               sStrmInfo.apid.Left(4).c_str());
       }
       else
-        strVideoStream.Format("0,%s,%s,%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), strAudioChannelPid.Left(4).c_str());
+        strVideoStream = StringUtils::Format("0,%s,%s,%s",
+                                             sStrmInfo.pmt.Left(4).c_str(),
+                                             sStrmInfo.vpid.Left(4).c_str(),
+                                             strAudioChannelPid.Left(4).c_str());
 
       CURL streamURL;
       streamURL.SetProtocol("http");
@@ -605,13 +614,19 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items )
       if (g_application.m_pPlayer->IsPlaying() && !g_tuxbox.sZapstream.available)
         CApplicationMessenger::Get().MediaStop();
 
-      strLabel.Format("%s: %s %s-%s",items.GetLabel().c_str(), sCurSrvData.current_event_date.c_str(),sCurSrvData.current_event_start.c_str(), sCurSrvData.current_event_start.c_str());
-      strLabel2.Format("%s", sCurSrvData.current_event_description.c_str());
+      strLabel = StringUtils::Format("%s: %s %s-%s",
+                                     items.GetLabel().c_str(),
+                                     sCurSrvData.current_event_date.c_str(),
+                                     sCurSrvData.current_event_start.c_str(),
+                                     sCurSrvData.current_event_start.c_str());
+      strLabel2 = StringUtils::Format("%s", sCurSrvData.current_event_description.c_str());
 
       // Set Event details
       CStdString strGenre, strTitle;
-      strGenre.Format("%s %s  -  (%s: %s)",g_localizeStrings.Get(143),sCurSrvData.current_event_description, g_localizeStrings.Get(209),sCurSrvData.next_event_description);
-      strTitle.Format("%s",sCurSrvData.current_event_details);
+      strGenre = StringUtils::Format("%s %s  -  (%s: %s)",
+                                     g_localizeStrings.Get(143).c_str(), sCurSrvData.current_event_description.c_str(),
+                                     g_localizeStrings.Get(209).c_str(), sCurSrvData.next_event_description.c_str());
+      strTitle = StringUtils::Format("%s", sCurSrvData.current_event_details.c_str());
       int iDuration = atoi(sCurSrvData.current_event_duration.c_str());
 
       items.GetVideoInfoTag()->m_genre = StringUtils::Split(strGenre, g_advancedSettings.m_videoItemSeparator);  // VIDEOPLAYER_GENRE: current_event_description (Film Name)
@@ -1530,14 +1545,14 @@ CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName)
     while(pService)
     {
       if(pService->Attribute("name"))
-        strName.Format("%s",pService->Attribute("name"));
+        strName = StringUtils::Format("%s", pService->Attribute("name"));
 
       if(pService->Attribute("png"))
-        strPng.Format("%s",pService->Attribute("png"));
+        strPng = StringUtils::Format("%s", pService->Attribute("png"));
 
       if(strName.Equals(strServiceName))
       {
-        strPng.Format("%s%s",piconPath.c_str(), strPng.c_str());
+        strPng = StringUtils::Format("%s%s", piconPath.c_str(), strPng.c_str());
         strPng.ToLower();
         CLog::Log(LOGDEBUG, "%s %s: Path is: %s", __FUNCTION__,strServiceName.c_str(), strPng.c_str());
         return strPng;
@@ -1561,9 +1576,9 @@ CStdString CTuxBoxUtil::GetSubMode(int iMode, CStdString& strXMLRootString, CStd
 
   if(iMode <0 || iMode >4)
   {
-    strSubMode.Format("xml/services?mode=0&submode=4");
-    strXMLRootString.Format("bouquets");
-    strXMLChildString.Format("bouquet");
+    strSubMode = StringUtils::Format("xml/services?mode=0&submode=4");
+    strXMLRootString = StringUtils::Format("bouquets");
+    strXMLChildString = StringUtils::Format("bouquet");
     return strSubMode;
   }
 
@@ -1579,26 +1594,26 @@ CStdString CTuxBoxUtil::GetSubMode(int iMode, CStdString& strXMLRootString, CStd
   int iSubMode = CGUIDialogContextMenu::ShowAndGetChoice(choices);
   if (iSubMode == 1)
   {
-    strXMLRootString.Format("services");
-    strXMLChildString.Format("service");
+    strXMLRootString = StringUtils::Format("services");
+    strXMLChildString = StringUtils::Format("service");
   }
   else if (iSubMode == 2)
   {
-    strXMLRootString.Format("satellites");
-    strXMLChildString.Format("satellite");
+    strXMLRootString = StringUtils::Format("satellites");
+    strXMLChildString = StringUtils::Format("satellite");
   }
   else if (iSubMode == 3)
   {
-    strXMLRootString.Format("providers");
-    strXMLChildString.Format("provider");
+    strXMLRootString = StringUtils::Format("providers");
+    strXMLChildString = StringUtils::Format("provider");
   }
   else // if (iSubMode == 4 || iSubMode < 0)
   {
     iSubMode = 4;
-    strXMLRootString.Format("bouquets");
-    strXMLChildString.Format("bouquet");
+    strXMLRootString = StringUtils::Format("bouquets");
+    strXMLChildString = StringUtils::Format("bouquet");
   }
-  strSubMode.Format("xml/services?mode=%i&submode=%i",iMode,iSubMode);
+  strSubMode = StringUtils::Format("xml/services?mode=%i&submode=%i",iMode,iSubMode);
   return strSubMode;
 }
 //Input: url/path of share/item file/folder
@@ -1618,23 +1633,23 @@ CStdString CTuxBoxUtil::DetectSubMode(CStdString strSubMode, CStdString& strXMLR
     strTemp = strSubMode.GetAt(ipointSubMode+9);
     if(strTemp.Equals("1"))
     {
-      strXMLRootString.Format("unknowns");
-      strXMLChildString.Format("unknown");
+      strXMLRootString = StringUtils::Format("unknowns");
+      strXMLChildString = StringUtils::Format("unknown");
     }
     else if(strTemp.Equals("2"))
     {
-      strXMLRootString.Format("satellites");
-      strXMLChildString.Format("satellite");
+      strXMLRootString = StringUtils::Format("satellites");
+      strXMLChildString = StringUtils::Format("satellite");
     }
     else if(strTemp.Equals("3"))
     {
-      strXMLRootString.Format("providers");
-      strXMLChildString.Format("provider");
+      strXMLRootString = StringUtils::Format("providers");
+      strXMLChildString = StringUtils::Format("provider");
     }
     else if(strTemp.Equals("4"))
     {
-      strXMLRootString.Format("bouquets");
-      strXMLChildString.Format("bouquet");
+      strXMLRootString = StringUtils::Format("bouquets");
+      strXMLChildString = StringUtils::Format("bouquet");
     }
 
   }
index 66923d3..bceccde 100644 (file)
@@ -1104,7 +1104,7 @@ void URIUtils::CreateArchivePath(CStdString& strUrlPath,
   strUrlPath += "?cache=";
   strUrlPath += strBuffer;
 
-  strBuffer.Format("%i", wOptions);
+  strBuffer = StringUtils::Format("%i", wOptions);
   strUrlPath += "&flags=";
   strUrlPath += strBuffer;
 #endif
index 521a8ce..b9edcd5 100644 (file)
@@ -88,8 +88,7 @@ bool CWeatherJob::DoWork()
   std::vector<std::string> argv;
   argv.push_back(addon->LibPath());
 
-  CStdString strSetting;
-  strSetting.Format("%i", m_location);
+  CStdString strSetting = StringUtils::Format("%i", m_location);
   argv.push_back(strSetting);
 
   // Download our weather
@@ -227,7 +226,7 @@ int CWeatherJob::ConvertSpeed(int curSpeed)
 void CWeatherJob::FormatTemperature(CStdString &text, int temp)
 {
   CTemperature temperature = CTemperature::CreateFromCelsius(temp);
-  text.Format("%.0f", temperature.ToLocale());
+  text = StringUtils::Format("%.0f", temperature.ToLocale());
 }
 
 void CWeatherJob::LoadLocalizedToken()
@@ -346,34 +345,32 @@ void CWeatherJob::SetFromProperties()
     else
     {
       LocalizeOverviewToken(direction);
-      m_info.currentWind.Format(g_localizeStrings.Get(434).c_str(),
-          direction, speed, g_langInfo.GetSpeedUnitString().c_str());
+      m_info.currentWind = StringUtils::Format(g_localizeStrings.Get(434).c_str(),
+          direction.c_str(), speed, g_langInfo.GetSpeedUnitString().c_str());
     }
-    CStdString windspeed;
-    windspeed.Format("%i %s",speed,g_langInfo.GetSpeedUnitString().c_str());
+    CStdString windspeed = StringUtils::Format("%i %s",speed,g_langInfo.GetSpeedUnitString().c_str());
     window->SetProperty("Current.WindSpeed",windspeed);
     FormatTemperature(m_info.currentDewPoint,
         strtol(window->GetProperty("Current.DewPoint").asString().c_str(),0,10));
     if (window->GetProperty("Current.Humidity").asString().empty())
       m_info.currentHumidity.clear();
     else
-      m_info.currentHumidity.Format("%s%%",window->GetProperty("Current.Humidity").asString().c_str());
+      m_info.currentHumidity = StringUtils::Format("%s%%", window->GetProperty("Current.Humidity").asString().c_str());
     m_info.location = window->GetProperty("Current.Location").asString();
     for (int i=0;i<NUM_DAYS;++i)
     {
-      CStdString strDay;
-      strDay.Format("Day%i.Title",i);
+      CStdString strDay = StringUtils::Format("Day%i.Title",i);
       m_info.forecast[i].m_day = window->GetProperty(strDay).asString();
       LocalizeOverviewToken(m_info.forecast[i].m_day);
-      strDay.Format("Day%i.HighTemp",i);
+      strDay = StringUtils::Format("Day%i.HighTemp",i);
       FormatTemperature(m_info.forecast[i].m_high,
                     strtol(window->GetProperty(strDay).asString().c_str(),0,10));
-      strDay.Format("Day%i.LowTemp",i);
+      strDay = StringUtils::Format("Day%i.LowTemp",i);
       FormatTemperature(m_info.forecast[i].m_low,
                     strtol(window->GetProperty(strDay).asString().c_str(),0,10));
-      strDay.Format("Day%i.OutlookIcon",i);
+      strDay = StringUtils::Format("Day%i.OutlookIcon",i);
       m_info.forecast[i].m_icon = ConstructPath(window->GetProperty(strDay).asString());
-      strDay.Format("Day%i.Outlook",i);
+      strDay = StringUtils::Format("Day%i.Outlook",i);
       m_info.forecast[i].m_overview = window->GetProperty(strDay).asString();
       LocalizeOverview(m_info.forecast[i].m_overview);
     }
@@ -421,8 +418,7 @@ CStdString CWeather::GetLocation(int iLocation)
   CGUIWindow* window = g_windowManager.GetWindow(WINDOW_WEATHER);
   if (window)
   {
-    CStdString setting;
-    setting.Format("Location%i", iLocation);
+    CStdString setting = StringUtils::Format("Location%i", iLocation);
     return window->GetProperty(setting).asString();
   }
   return "";
index d4da473..97f17bb 100644 (file)
@@ -295,22 +295,19 @@ void XMLUtils::SetString(TiXmlNode* pRootNode, const char *strTag, const CStdStr
 
 void XMLUtils::SetInt(TiXmlNode* pRootNode, const char *strTag, int value)
 {
-  CStdString strValue;
-  strValue.Format("%i", value);
+  CStdString strValue = StringUtils::Format("%i", value);
   SetString(pRootNode, strTag, strValue);
 }
 
 void XMLUtils::SetLong(TiXmlNode* pRootNode, const char *strTag, long value)
 {
-  CStdString strValue;
-  strValue.Format("%ld", value);
+  CStdString strValue = StringUtils::Format("%ld", value);
   SetString(pRootNode, strTag, strValue);
 }
 
 void XMLUtils::SetFloat(TiXmlNode* pRootNode, const char *strTag, float value)
 {
-  CStdString strValue;
-  strValue.Format("%f", value);
+  CStdString strValue = StringUtils::Format("%f", value);
   SetString(pRootNode, strTag, strValue);
 }
 
@@ -321,8 +318,7 @@ void XMLUtils::SetBoolean(TiXmlNode* pRootNode, const char *strTag, bool value)
 
 void XMLUtils::SetHex(TiXmlNode* pRootNode, const char *strTag, uint32_t value)
 {
-  CStdString strValue;
-  strValue.Format("%x", value);
+  CStdString strValue = StringUtils::Format("%x", value);
   SetString(pRootNode, strTag, strValue);
 }
 
index f507238..4eb49db 100644 (file)
@@ -26,6 +26,7 @@
 #include "threads/SingleLock.h"
 #include "threads/Thread.h"
 #include "utils/StdString.h"
+#include "utils/StringUtils.h"
 #if defined(TARGET_ANDROID)
 #include "android/activity/XBMCApp.h"
 #elif defined(TARGET_WINDOWS)
@@ -96,10 +97,16 @@ void CLog::Log(int loglevel, const char *format, ... )
     }
     else if (m_repeatCount)
     {
-      CStdString strData2;
-      strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), levelNames[m_repeatLogLevel]);
+      strPrefix = StringUtils::Format(prefixFormat,
+                                      time.wHour,
+                                      time.wMinute,
+                                      time.wSecond,
+                                      (uint64_t)CThread::GetCurrentThreadId(),
+                                      levelNames[m_repeatLogLevel]);
 
-      strData2.Format("Previous line repeats %d times." LINE_ENDING, m_repeatCount);
+      CStdString strData2 = StringUtils::Format("Previous line repeats %d times."
+                                                LINE_ENDING,
+                                                m_repeatCount);
       fputs(strPrefix.c_str(), m_file);
       fputs(strData2.c_str(), m_file);
       OutputDebugString(strData2);
@@ -127,7 +134,12 @@ void CLog::Log(int loglevel, const char *format, ... )
     strData.Replace("\n", LINE_ENDING"                                            ");
     strData += LINE_ENDING;
 
-    strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), levelNames[loglevel]);
+    strPrefix = StringUtils::Format(prefixFormat,
+                                    time.wHour,
+                                    time.wMinute,
+                                    time.wSecond,
+                                    (uint64_t)CThread::GetCurrentThreadId(),
+                                    levelNames[loglevel]);
 
 //print to adb
 #if defined(TARGET_ANDROID) && defined(_DEBUG)
@@ -147,10 +159,8 @@ bool CLog::Init(const char* path)
   {
     // the log folder location is initialized in the CAdvancedSettings
     // constructor and changed in CApplication::Create()
-    CStdString strLogFile, strLogFileOld;
-
-    strLogFile.Format("%sxbmc.log", path);
-    strLogFileOld.Format("%sxbmc.old.log", path);
+    CStdString strLogFile = StringUtils::Format("%sxbmc.log", path);
+    CStdString strLogFileOld = StringUtils::Format("%sxbmc.old.log", path);
 
 #if defined(TARGET_WINDOWS)
     // the appdata folder might be redirected to an unc share
@@ -184,15 +194,13 @@ void CLog::MemDump(char *pData, int length)
   Log(LOGDEBUG, "MEM_DUMP: Dumping from %p", pData);
   for (int i = 0; i < length; i+=16)
   {
-    CStdString strLine;
-    strLine.Format("MEM_DUMP: %04x ", i);
+    CStdString strLine = StringUtils::Format("MEM_DUMP: %04x ", i);
     char *alpha = pData;
     for (int k=0; k < 4 && i + 4*k < length; k++)
     {
       for (int j=0; j < 4 && i + 4*k + j < length; j++)
       {
-        CStdString strFormat;
-        strFormat.Format(" %02x", (unsigned char)*pData++);
+        CStdString strFormat = StringUtils::Format(" %02x", (unsigned char)*pData++);
         strLine += strFormat;
       }
       strLine += " ";
index ba4a000..9aa97be 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "md5.h"
+#include "utils/StringUtils.h"
 
 typedef unsigned char md5byte;
 
@@ -55,11 +56,12 @@ void XBMC::XBMC_MD5::getDigest(CStdString& digest)
 {
   unsigned char szBuf[16] = {'\0'};
   getDigest(szBuf);
-  digest.Format("%02X%02X%02X%02X%02X%02X%02X%02X"\
-      "%02X%02X%02X%02X%02X%02X%02X%02X", szBuf[0], szBuf[1], szBuf[2],
-      szBuf[3], szBuf[4], szBuf[5], szBuf[6], szBuf[7], szBuf[8],
-      szBuf[9], szBuf[10], szBuf[11], szBuf[12], szBuf[13], szBuf[14],
-      szBuf[15]);
+  digest = StringUtils::Format("%02X%02X%02X%02X%02X%02X%02X%02X"\
+                               "%02X%02X%02X%02X%02X%02X%02X%02X",
+                               szBuf[0], szBuf[1], szBuf[2],
+                               szBuf[3], szBuf[4], szBuf[5], szBuf[6], szBuf[7], szBuf[8],
+                               szBuf[9], szBuf[10], szBuf[11], szBuf[12], szBuf[13], szBuf[14],
+                               szBuf[15]);
 }
 
 CStdString XBMC::XBMC_MD5::GetMD5(const CStdString &text)
index c97cbfd..88580d3 100644 (file)
@@ -23,6 +23,7 @@
 #include "music/MusicDatabase.h"
 #include "dbwrappers/qry_dat.h"
 #include "utils/Variant.h"
+#include "utils/StringUtils.h"
 
 #include "gtest/gtest.h"
 
@@ -412,52 +413,52 @@ TEST(TestDatabaseUtils, GetField_MediaTypeMusicVideo)
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
   varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_RUNTIME);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_RUNTIME);
   varstr = DatabaseUtils::GetField(FieldTime, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_DIRECTOR);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_DIRECTOR);
   varstr = DatabaseUtils::GetField(FieldDirector, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_STUDIOS);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_STUDIOS);
   varstr = DatabaseUtils::GetField(FieldStudio, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
   varstr = DatabaseUtils::GetField(FieldYear, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_PLOT);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_PLOT);
   varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
   varstr = DatabaseUtils::GetField(FieldAlbum, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ARTIST);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ARTIST);
   varstr = DatabaseUtils::GetField(FieldArtist, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_GENRE);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_GENRE);
   varstr = DatabaseUtils::GetField(FieldGenre, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TRACK);
+  refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TRACK);
   varstr = DatabaseUtils::GetField(FieldTrackNumber, MediaTypeMusicVideo,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
@@ -512,99 +513,99 @@ TEST(TestDatabaseUtils, GetField_MediaTypeMovie)
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_TITLE);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TITLE);
   varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d "
+  refstr = StringUtils::Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d "
                 "ELSE movieview.c%02d END", VIDEODB_ID_SORTTITLE,
                 VIDEODB_ID_SORTTITLE, VIDEODB_ID_TITLE, VIDEODB_ID_TITLE);
   varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeMovie,
                                    DatabaseQueryPartOrderBy);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_PLOT);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOT);
   varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
   varstr = DatabaseUtils::GetField(FieldPlotOutline, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
   varstr = DatabaseUtils::GetField(FieldTagline, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_VOTES);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_VOTES);
   varstr = DatabaseUtils::GetField(FieldVotes, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_RATING);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RATING);
   varstr = DatabaseUtils::GetField(FieldRating, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
+  refstr = StringUtils::Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
   varstr = DatabaseUtils::GetField(FieldRating, MediaTypeMovie,
                                    DatabaseQueryPartOrderBy);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_CREDITS);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_CREDITS);
   varstr = DatabaseUtils::GetField(FieldWriter, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_YEAR);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_YEAR);
   varstr = DatabaseUtils::GetField(FieldYear, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
   varstr = DatabaseUtils::GetField(FieldSortTitle, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
   varstr = DatabaseUtils::GetField(FieldTime, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_MPAA);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_MPAA);
   varstr = DatabaseUtils::GetField(FieldMPAA, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_TOP250);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TOP250);
   varstr = DatabaseUtils::GetField(FieldTop250, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_GENRE);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_GENRE);
   varstr = DatabaseUtils::GetField(FieldGenre, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
   varstr = DatabaseUtils::GetField(FieldDirector, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
   varstr = DatabaseUtils::GetField(FieldStudio, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_TRAILER);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TRAILER);
   varstr = DatabaseUtils::GetField(FieldTrailer, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
+  refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
   varstr = DatabaseUtils::GetField(FieldCountry, MediaTypeMovie,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
@@ -649,59 +650,59 @@ TEST(TestDatabaseUtils, GetField_MediaTypeTvShow)
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d "
+  refstr = StringUtils::Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d "
                 "ELSE tvshowview.c%02d END", VIDEODB_ID_TV_SORTTITLE,
                 VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_TITLE);
   varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeTvShow,
                                    DatabaseQueryPartOrderBy);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
   varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
   varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
   varstr = DatabaseUtils::GetField(FieldTvShowStatus, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
   varstr = DatabaseUtils::GetField(FieldVotes, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
   varstr = DatabaseUtils::GetField(FieldRating, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
   varstr = DatabaseUtils::GetField(FieldYear, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
   varstr = DatabaseUtils::GetField(FieldGenre, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
   varstr = DatabaseUtils::GetField(FieldMPAA, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
   varstr = DatabaseUtils::GetField(FieldStudio, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
+  refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
   varstr = DatabaseUtils::GetField(FieldSortTitle, MediaTypeTvShow,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
@@ -746,52 +747,52 @@ TEST(TestDatabaseUtils, GetField_MediaTypeEpisode)
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
   varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
   varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
   varstr = DatabaseUtils::GetField(FieldVotes, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
   varstr = DatabaseUtils::GetField(FieldRating, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
   varstr = DatabaseUtils::GetField(FieldWriter, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
   varstr = DatabaseUtils::GetField(FieldAirDate, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
   varstr = DatabaseUtils::GetField(FieldTime, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
   varstr = DatabaseUtils::GetField(FieldDirector, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
   varstr = DatabaseUtils::GetField(FieldSeason, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
 
-  refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
+  refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
   varstr = DatabaseUtils::GetField(FieldEpisodeNumber, MediaTypeEpisode,
                                    DatabaseQueryPartSelect);
   EXPECT_STREQ(refstr.c_str(), varstr.c_str());
index c389a55..05b6c83 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "utils/XMLUtils.h"
+#include "utils/StringUtils.h"
 #include "XBDateTime.h"
 
 #include "gtest/gtest.h"
@@ -82,7 +83,7 @@ TEST(TestXMLUtils, GetDouble)
   EXPECT_TRUE(XMLUtils::GetDouble(a.RootElement(), "node", val));
 
   refstr = "1000.100000";
-  valstr.Format("%f", val);
+  valstr = StringUtils::Format("%f", val);
   EXPECT_STREQ(refstr.c_str(), valstr.c_str());
 }
 
index 9e2eb5e..7f8e147 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "utils/fft.h"
 #include "utils/StdString.h"
+#include "utils/StringUtils.h"
 
 #include "gtest/gtest.h"
 
@@ -263,8 +264,8 @@ TEST(Testfft, fft)
     /* To more consistently test the resulting floating point numbers, they
      * are converted to strings and the strings are tested for equality.
      */
-    refstr.Format("%.6f", reffftdata[i]);
-    varstr.Format("%.6f", vardata[i]);
+    refstr = StringUtils::Format("%.6f", reffftdata[i]);
+    varstr = StringUtils::Format("%.6f", vardata[i]);
     EXPECT_STREQ(refstr.c_str(), varstr.c_str());
   }
 }
@@ -279,8 +280,8 @@ TEST(Testfft, fft_inverse)
   fft(vardata, REFDATA_NUMELEMENTS/2, -1);
   for (i = 0; i < REFDATA_NUMELEMENTS; i++)
   {
-    refstr.Format("%.6f", reffftinversedata[i]);
-    varstr.Format("%.6f", vardata[i]);
+    refstr = StringUtils::Format("%.6f", reffftinversedata[i]);
+    varstr = StringUtils::Format("%.6f", vardata[i]);
     EXPECT_STREQ(refstr.c_str(), varstr.c_str());
   }
 }
@@ -295,8 +296,8 @@ TEST(Testfft, twochannelrfft)
   twochannelrfft(vardata, REFDATA_NUMELEMENTS/2);
   for (i = 0; i < REFDATA_NUMELEMENTS; i++)
   {
-    refstr.Format("%.6f", reftwochannelrfftdata[i]);
-    varstr.Format("%.6f", vardata[i]);
+    refstr = StringUtils::Format("%.6f", reftwochannelrfftdata[i]);
+    varstr = StringUtils::Format("%.6f", vardata[i]);
     EXPECT_STREQ(refstr.c_str(), varstr.c_str());
   }
 }
@@ -311,8 +312,8 @@ TEST(Testfft, twochanwithwindow)
   twochanwithwindow(vardata, REFDATA_NUMELEMENTS/2);
   for (i = 0; i < REFDATA_NUMELEMENTS; i++)
   {
-    refstr.Format("%.6f", reftwochanwithwindowdata[i]);
-    varstr.Format("%.6f", vardata[i]);
+    refstr = StringUtils::Format("%.6f", reftwochanwithwindowdata[i]);
+    varstr = StringUtils::Format("%.6f", vardata[i]);
     EXPECT_STREQ(refstr.c_str(), varstr.c_str());
   }
 }
index ec4f5ea..be4605f 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "utils/fstrcmp.h"
 #include "utils/StdString.h"
+#include "utils/StringUtils.h"
 
 #include "gtest/gtest.h"
 
@@ -31,16 +32,16 @@ TEST(Testfstrcmp, General)
 
   /* NOTE: Third parameter is not used at all in fstrcmp. */
   refresult = "1.000000";
-  varresult.Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
+  varresult = StringUtils::Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
   EXPECT_STREQ(refresult.c_str(), varresult.c_str());
 
   varstr = "Testfstrcmp_test_string";
   refresult = "0.913043";
-  varresult.Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
+  varresult = StringUtils::Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
   EXPECT_STREQ(refresult.c_str(), varresult.c_str());
 
   varstr = "";
   refresult = "0.000000";
-  varresult.Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
+  varresult = StringUtils::Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
   EXPECT_STREQ(refresult.c_str(), varresult.c_str());
 }
index eb05b88..4cfb3ea 100644 (file)
@@ -37,6 +37,7 @@
 #endif
 #include "Application.h"
 #include "utils/LangCodeExpander.h"
+#include "utils/StringUtils.h"
 
 CPlayerController::CPlayerController()
 {
@@ -74,7 +75,7 @@ bool CPlayerController::OnAction(const CAction &action)
           if (info.name.length() == 0)
             sub = lang;
           else
-            sub.Format("%s - %s", lang.c_str(), info.name.c_str());
+            sub = StringUtils::Format("%s - %s", lang.c_str(), info.name.c_str());
         }
         else
           sub = g_localizeStrings.Get(1223);
@@ -119,7 +120,7 @@ bool CPlayerController::OnAction(const CAction &action)
           if (info.name.length() == 0)
             sub = lang;
           else
-            sub.Format("%s - %s", lang.c_str(), info.name.c_str());
+            sub = StringUtils::Format("%s - %s", lang.c_str(), info.name.c_str());
         }
         else
           sub = g_localizeStrings.Get(1223);
@@ -216,7 +217,7 @@ bool CPlayerController::OnAction(const CAction &action)
         if (info.name.empty())
           aud = lan;
         else
-          aud.Format("%s - %s", lan.c_str(), info.name.c_str());
+          aud = StringUtils::Format("%s - %s", lan.c_str(), info.name.c_str());
         CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime);
         return true;
       }
@@ -417,8 +418,7 @@ void CPlayerController::OnSliderChange(void *data, CGUISliderControl *slider)
       m_sliderAction == ACTION_VSHIFT_UP || m_sliderAction == ACTION_VSHIFT_DOWN ||
       m_sliderAction == ACTION_SUBTITLE_VSHIFT_UP || m_sliderAction == ACTION_SUBTITLE_VSHIFT_DOWN)
   {
-    CStdString strValue;
-    strValue.Format("%1.2f",slider->GetFloatValue());
+    CStdString strValue = StringUtils::Format("%1.2f",slider->GetFloatValue());
     slider->SetTextValue(strValue);
   }
   else if (m_sliderAction == ACTION_VOLAMP_UP || m_sliderAction == ACTION_VOLAMP_DOWN)
index 08fcca0..9bb116b 100644 (file)
@@ -133,12 +133,10 @@ bool CVideoDatabase::CreateTables()
 
     CLog::Log(LOGINFO, "create movie table");
     CStdString columns = "CREATE TABLE movie ( idMovie integer primary key, idFile integer";
+
     for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
-    {
-      CStdString column;
-      column.Format(",c%02d text", i);
-      columns += column;
-    }
+      columns += StringUtils::Format(",c%02d text", i);
+
     columns += ", idSet integer)";
     m_pDS->exec(columns.c_str());
     m_pDS->exec("CREATE UNIQUE INDEX ix_movie_file_1 ON movie (idFile, idMovie)");
@@ -172,12 +170,10 @@ bool CVideoDatabase::CreateTables()
 
     CLog::Log(LOGINFO, "create tvshow table");
     columns = "CREATE TABLE tvshow ( idShow integer primary key";
+
     for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
-    {
-      CStdString column;
-      column.Format(",c%02d text", i);
-      columns += column;
-    }
+      columns += StringUtils::Format(",c%02d text", i);;
+
     columns += ")";
     m_pDS->exec(columns.c_str());
 
@@ -202,9 +198,9 @@ bool CVideoDatabase::CreateTables()
     {
       CStdString column;
       if ( i == VIDEODB_ID_EPISODE_SEASON || i == VIDEODB_ID_EPISODE_EPISODE || i == VIDEODB_ID_EPISODE_BOOKMARK)
-        column.Format(",c%02d varchar(24)", i);
+        column = StringUtils::Format(",c%02d varchar(24)", i);
       else
-        column.Format(",c%02d text", i);
+        column = StringUtils::Format(",c%02d text", i);
 
       columns += column;
     }
@@ -212,10 +208,9 @@ bool CVideoDatabase::CreateTables()
     m_pDS->exec(columns.c_str());
     m_pDS->exec("CREATE UNIQUE INDEX ix_episode_file_1 on episode (idEpisode, idFile)");
     m_pDS->exec("CREATE UNIQUE INDEX id_episode_file_2 on episode (idFile, idEpisode)");
-    CStdString createColIndex;
-    createColIndex.Format("CREATE INDEX ix_episode_season_episode on episode (c%02d, c%02d)", VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_EPISODE_EPISODE);
+    CStdString createColIndex = StringUtils::Format("CREATE INDEX ix_episode_season_episode on episode (c%02d, c%02d)", VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_EPISODE_EPISODE);
     m_pDS->exec(createColIndex.c_str());
-    createColIndex.Format("CREATE INDEX ix_episode_bookmark on episode (c%02d)", VIDEODB_ID_EPISODE_BOOKMARK);
+    createColIndex = StringUtils::Format("CREATE INDEX ix_episode_bookmark on episode (c%02d)", VIDEODB_ID_EPISODE_BOOKMARK);
     m_pDS->exec(createColIndex.c_str());
     m_pDS->exec("CREATE INDEX ix_episode_show1 on episode(idEpisode,idShow)");
     m_pDS->exec("CREATE INDEX ix_episode_show2 on episode(idShow,idEpisode)");
@@ -261,11 +256,8 @@ bool CVideoDatabase::CreateTables()
     CLog::Log(LOGINFO, "create musicvideo table");
     columns = "CREATE TABLE musicvideo ( idMVideo integer primary key, idFile integer";
     for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
-    {
-      CStdString column;
-      column.Format(",c%02d text", i);
-      columns += column;
-    }
+      columns += StringUtils::Format(",c%02d text", i);;
+
     columns += ")";
     m_pDS->exec(columns.c_str());
 
@@ -1661,11 +1653,8 @@ void CVideoDatabase::DeleteDetailsForTvShow(const CStdString& strPath, int idTvS
 
     strSQL = "update tvshow set ";
     for (int iType = VIDEODB_ID_TV_MIN + 1; iType < VIDEODB_ID_TV_MAX; iType++)
-    {
-      CStdString column;
-      column.Format("c%02d=NULL,", iType);
-      strSQL += column;
-    }
+      strSQL += StringUtils::Format("c%02d=NULL,", iType);
+
     strSQL = strSQL.Mid(0, strSQL.size() - 1) + PrepareSQL(" where idShow=%i", idTvShow);
     m_pDS->exec(strSQL.c_str());
   }
@@ -3745,8 +3734,7 @@ void CVideoDatabase::SetVideoSettings(const CStdString& strFilenameAndPath, cons
     int idFile = AddFile(strFilenameAndPath);
     if (idFile < 0)
       return;
-    CStdString strSQL;
-    strSQL.Format("select * from settings where idFile=%i", idFile);
+    CStdString strSQL = StringUtils::Format("select * from settings where idFile=%i", idFile);
     m_pDS->query( strSQL.c_str() );
     if (m_pDS->num_rows() > 0)
     {
@@ -3988,14 +3976,10 @@ void CVideoDatabase::SetStackTimes(const CStdString& filePath, vector<int> &time
     m_pDS->exec( PrepareSQL("delete from stacktimes where idFile=%i", idFile) );
 
     // add the items
-    CStdString timeString;
-    timeString.Format("%i", times[0]);
+    CStdString timeString = StringUtils::Format("%i", times[0]);
     for (unsigned int i = 1; i < times.size(); i++)
-    {
-      CStdString time;
-      time.Format(",%i", times[i]);
-      timeString += time;
-    }
+      timeString += StringUtils::Format(",%i", times[i]);
+
     m_pDS->exec( PrepareSQL("insert into stacktimes (idFile,times) values (%i,'%s')\n", idFile, timeString.c_str()) );
   }
   catch (...)
@@ -4181,11 +4165,7 @@ bool CVideoDatabase::UpdateOldVersion(int iVersion)
       // content columns
       CStdStringArray c_columns;
       for (int i = 0; i < 22; i++)
-      {
-        CStdString c;
-        c.Format("c%02d", i);
-        c_columns.push_back(c);
-      }
+        c_columns.push_back(StringUtils::Format("c%02d", i));
 
       tables.insert(pair<CStdString, CStdStringArray> ("episode", c_columns));
       tables.insert(pair<CStdString, CStdStringArray> ("movie", c_columns));
@@ -4985,7 +4965,7 @@ bool CVideoDatabase::GetNavCommon(const CStdString& strBaseDir, CFileItemList& i
       extFilter.group.clear();
       extFilter.order.clear();
     }
-    strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+    strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
 
     CVideoDbUrl videoUrl;
     if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, videoUrl))
@@ -5038,7 +5018,7 @@ bool CVideoDatabase::GetNavCommon(const CStdString& strBaseDir, CFileItemList& i
         pItem->GetVideoInfoTag()->m_type = type;
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld/", it->first);
+        CStdString path = StringUtils::Format("%ld/", it->first);
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -5061,7 +5041,7 @@ bool CVideoDatabase::GetNavCommon(const CStdString& strBaseDir, CFileItemList& i
         pItem->GetVideoInfoTag()->m_type = type;
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld/", m_pDS->fv(0).get_asInt());
+        CStdString path = StringUtils::Format("%ld/", m_pDS->fv(0).get_asInt());
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -5121,7 +5101,7 @@ bool CVideoDatabase::GetTagsNav(const CStdString& strBaseDir, CFileItemList& ite
       extFilter.group.clear();
       extFilter.order.clear();
     }
-    strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+    strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
 
     // parse the base path to get additional filters
     CVideoDbUrl videoUrl;
@@ -5152,7 +5132,7 @@ bool CVideoDatabase::GetTagsNav(const CStdString& strBaseDir, CFileItemList& ite
       pItem->GetVideoInfoTag()->m_type = "tag";
 
       CVideoDbUrl itemUrl = videoUrl;
-      CStdString path; path.Format("%ld/", idTag);
+      CStdString path = StringUtils::Format("%ld/", idTag);
       itemUrl.AppendPath(path);
       pItem->SetPath(itemUrl.ToString());
 
@@ -5249,7 +5229,7 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI
       extFilter.group.clear();
       extFilter.order.clear();
     }
-    strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+    strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
 
     CVideoDbUrl videoUrl;
     if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, videoUrl))
@@ -5296,7 +5276,7 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI
           CFileItemPtr pItem(new CFileItem(it->second.first));
 
           CVideoDbUrl itemUrl = videoUrl;
-          CStdString path; path.Format("%ld/", it->first);
+          CStdString path = StringUtils::Format("%ld/", it->first);
           itemUrl.AppendPath(path);
           pItem->SetPath(itemUrl.ToString());
 
@@ -5319,7 +5299,7 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI
           CFileItemPtr pItem(new CFileItem(m_pDS->fv(0).get_asString()));
 
           CVideoDbUrl itemUrl = videoUrl;
-          CStdString path; path.Format("%ld/", m_pDS->fv(1).get_asInt());
+          CStdString path = StringUtils::Format("%ld/", m_pDS->fv(1).get_asInt());
           itemUrl.AppendPath(path);
           pItem->SetPath(itemUrl.ToString());
 
@@ -5468,7 +5448,7 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i
       extFilter.group.clear();
       extFilter.order.clear();
     }
-    strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+    strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
 
     CVideoDbUrl videoUrl;
     if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, videoUrl))
@@ -5526,7 +5506,7 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i
         CFileItemPtr pItem(new CFileItem(it->second.name));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld/", it->first);
+        CStdString path = StringUtils::Format("%ld/", it->first);
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -5547,7 +5527,7 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i
           CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
 
           CVideoDbUrl itemUrl = videoUrl;
-          CStdString path; path.Format("%ld/", m_pDS->fv(0).get_asInt());
+          CStdString path = StringUtils::Format("%ld/", m_pDS->fv(0).get_asInt());
           itemUrl.AppendPath(path);
           pItem->SetPath(itemUrl.ToString());
 
@@ -5667,8 +5647,7 @@ bool CVideoDatabase::GetYearsNav(const CStdString& strBaseDir, CFileItemList& it
           // check path
           if (g_passwordManager.IsDatabasePathUnlocked(CStdString(m_pDS->fv("path.strPath").get_asString()),*CMediaSourceSettings::Get().GetSources("video")))
           {
-            CStdString year;
-            year.Format("%d", lYear);
+            CStdString year = StringUtils::Format("%d", lYear);
             if (idContent == VIDEODB_CONTENT_MOVIES || idContent == VIDEODB_CONTENT_MUSICVIDEOS)
               mapYears.insert(pair<int, pair<CStdString,int> >(lYear, pair<CStdString,int>(year,m_pDS->fv(2).get_asInt())));
             else
@@ -5686,7 +5665,7 @@ bool CVideoDatabase::GetYearsNav(const CStdString& strBaseDir, CFileItemList& it
         CFileItemPtr pItem(new CFileItem(it->second.first));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld/", it->first);
+        CStdString path = StringUtils::Format("%ld/", it->first);
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -5707,7 +5686,7 @@ bool CVideoDatabase::GetYearsNav(const CStdString& strBaseDir, CFileItemList& it
           CDateTime time;
           time.SetFromDateString(m_pDS->fv(0).get_asString());
           lYear = time.GetYear();
-          strLabel.Format("%i",lYear);
+          strLabel = StringUtils::Format("%i",lYear);
         }
         else if (idContent == VIDEODB_CONTENT_MOVIES || idContent == VIDEODB_CONTENT_MUSICVIDEOS)
         {
@@ -5722,7 +5701,7 @@ bool CVideoDatabase::GetYearsNav(const CStdString& strBaseDir, CFileItemList& it
         CFileItemPtr pItem(new CFileItem(strLabel));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld/", lYear);
+        CStdString path = StringUtils::Format("%ld/", lYear);
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -5878,11 +5857,11 @@ bool CVideoDatabase::GetSeasonsNav(const CStdString& strBaseDir, CFileItemList&
         if (iSeason == 0)
           strLabel = g_localizeStrings.Get(20381);
         else
-          strLabel.Format(g_localizeStrings.Get(20358),iSeason);
+          strLabel = StringUtils::Format(g_localizeStrings.Get(20358), iSeason);
         CFileItemPtr pItem(new CFileItem(strLabel));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString strDir; strDir.Format("%ld/", it->first);
+        CStdString strDir = StringUtils::Format("%ld/", it->first);
         itemUrl.AppendPath(strDir);
         pItem->SetPath(itemUrl.ToString());
 
@@ -5919,11 +5898,11 @@ bool CVideoDatabase::GetSeasonsNav(const CStdString& strBaseDir, CFileItemList&
         if (iSeason == 0)
           strLabel = g_localizeStrings.Get(20381);
         else
-          strLabel.Format(g_localizeStrings.Get(20358),iSeason);
+          strLabel = StringUtils::Format(g_localizeStrings.Get(20358), iSeason);
         CFileItemPtr pItem(new CFileItem(strLabel));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString strDir; strDir.Format("%ld/", iSeason);
+        CStdString strDir = StringUtils::Format("%ld/", iSeason);
         itemUrl.AppendPath(strDir);
         pItem->SetPath(itemUrl.ToString());
 
@@ -6097,10 +6076,7 @@ CStdString CVideoDatabase::GetItemById(const CStdString &itemType, int id)
   if (itemType.Equals("genres"))
     return GetGenreById(id);
   else if (itemType.Equals("years"))
-  {
-    CStdString tmp; tmp.Format("%d", id);
-    return tmp;
-  }
+    return StringUtils::Format("%d", id);
   else if (itemType.Equals("actors") || itemType.Equals("directors") || itemType.Equals("artists"))
     return GetPersonById(id);
   else if (itemType.Equals("studios"))
@@ -6213,7 +6189,7 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const Filter
         CFileItemPtr pItem(new CFileItem(movie));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld", movie.m_iDbId);
+        CStdString path = StringUtils::Format("%ld", movie.m_iDbId);
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -6319,7 +6295,7 @@ bool CVideoDatabase::GetTvShowsByWhere(const CStdString& strBaseDir, const Filte
         CFileItemPtr pItem(new CFileItem(movie));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld/", record->at(0).get_asInt());
+        CStdString path = StringUtils::Format("%ld/", record->at(0).get_asInt());
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -6644,9 +6620,9 @@ bool CVideoDatabase::GetEpisodesByWhere(const CStdString& strBaseDir, const Filt
         CVideoDbUrl itemUrl = videoUrl;
         CStdString path;
         if (appendFullShowPath && videoUrl.GetItemType() != "episodes")
-          path.Format("%ld/%ld/%ld", record->at(VIDEODB_DETAILS_EPISODE_TVSHOW_ID).get_asInt(), movie.m_iSeason, idEpisode);
+          path = StringUtils::Format("%ld/%ld/%ld", record->at(VIDEODB_DETAILS_EPISODE_TVSHOW_ID).get_asInt(), movie.m_iSeason, idEpisode);
         else
-          path.Format("%ld", idEpisode);
+          path = StringUtils::Format("%ld", idEpisode);
         itemUrl.AppendPath(path);
         pItem->SetPath(itemUrl.ToString());
 
@@ -6857,8 +6833,7 @@ int CVideoDatabase::GetMusicVideoCount(const CStdString& strWhere)
     if (NULL == m_pDB.get()) return 0;
     if (NULL == m_pDS.get()) return 0;
 
-    CStdString strSQL;
-    strSQL.Format("select count(1) as nummovies from musicvideoview where %s",strWhere.c_str());
+    CStdString strSQL = StringUtils::Format("select count(1) as nummovies from musicvideoview where %s",strWhere.c_str());
     m_pDS->query( strSQL.c_str() );
 
     int iResult = 0;
@@ -7083,8 +7058,7 @@ void CVideoDatabase::GetMovieGenresByName(const CStdString& strSearch, CFileItem
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("genre.strGenre").get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
       pItem->SetPath("videodb://movies/genres/"+ strDir);
       pItem->m_bIsFolder=true;
       items.Add(pItem);
@@ -7124,8 +7098,7 @@ void CVideoDatabase::GetMovieCountriesByName(const CStdString& strSearch, CFileI
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("country.strCountry").get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("country.idCountry").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("country.idCountry").get_asInt());
       pItem->SetPath("videodb://movies/genres/"+ strDir);
       pItem->m_bIsFolder=true;
       items.Add(pItem);
@@ -7164,8 +7137,7 @@ void CVideoDatabase::GetTvShowGenresByName(const CStdString& strSearch, CFileIte
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("genre.strGenre").get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
       pItem->SetPath("videodb://tvshows/genres/"+ strDir);
       pItem->m_bIsFolder=true;
       items.Add(pItem);
@@ -7204,8 +7176,7 @@ void CVideoDatabase::GetMovieActorsByName(const CStdString& strSearch, CFileItem
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
       pItem->SetPath("videodb://movies/actors/"+ strDir);
       pItem->m_bIsFolder=true;
       items.Add(pItem);
@@ -7244,8 +7215,7 @@ void CVideoDatabase::GetTvShowsActorsByName(const CStdString& strSearch, CFileIt
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
       pItem->SetPath("videodb://tvshows/actors/"+ strDir);
       pItem->m_bIsFolder=true;
       items.Add(pItem);
@@ -7287,8 +7257,7 @@ void CVideoDatabase::GetMusicVideoArtistsByName(const CStdString& strSearch, CFi
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
       pItem->SetPath("videodb://musicvideos/artists/"+ strDir);
       pItem->m_bIsFolder=true;
       items.Add(pItem);
@@ -7327,8 +7296,7 @@ void CVideoDatabase::GetMusicVideoGenresByName(const CStdString& strSearch, CFil
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("genre.strGenre").get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
       pItem->SetPath("videodb://musicvideos/genres/"+ strDir);
       pItem->m_bIsFolder=true;
       items.Add(pItem);
@@ -7354,7 +7322,7 @@ void CVideoDatabase::GetMusicVideoAlbumsByName(const CStdString& strSearch, CFil
     CStdString strLike;
     if (!strSearch.IsEmpty())
     {
-      strLike.Format("and musicvideo.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
+      strLike = StringUtils::Format("and musicvideo.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
       strLike += "like '%%s%%%'";
     }
     if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
@@ -7383,8 +7351,7 @@ void CVideoDatabase::GetMusicVideoAlbumsByName(const CStdString& strSearch, CFil
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(0).get_asString()));
-      CStdString strDir;
-      strDir.Format("%ld", m_pDS->fv(1).get_asInt());
+      CStdString strDir = StringUtils::Format("%ld", m_pDS->fv(1).get_asInt());
       pItem->SetPath("videodb://musicvideos/titles/"+ strDir);
       pItem->m_bIsFolder=false;
       items.Add(pItem);
@@ -7423,8 +7390,7 @@ void CVideoDatabase::GetMusicVideosByAlbum(const CStdString& strSearch, CFileIte
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" - "+m_pDS->fv(2).get_asString()));
-      CStdString strDir;
-      strDir.Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
+      CStdString strDir = StringUtils::Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
 
       pItem->SetPath("videodb://"+ strDir);
       pItem->m_bIsFolder=false;
@@ -7500,7 +7466,7 @@ bool CVideoDatabase::GetMusicVideosByWhere(const CStdString &baseDir, const Filt
         CFileItemPtr item(new CFileItem(musicvideo));
 
         CVideoDbUrl itemUrl = videoUrl;
-        CStdString path; path.Format("%ld", record->at(0).get_asInt());
+        CStdString path = StringUtils::Format("%ld", record->at(0).get_asInt());
         itemUrl.AppendPath(path);
         item->SetPath(itemUrl.ToString());
 
@@ -7561,8 +7527,7 @@ bool CVideoDatabase::GetRandomMusicVideo(CFileItem* item, int& idSong, const CSt
     if (NULL == m_pDS.get()) return false;
 
     // We don't use PrepareSQL here, as the WHERE clause is already formatted.
-    CStdString strSQL;
-    strSQL.Format("select * from musicvideoview where %s",strWhere.c_str());
+    CStdString strSQL = StringUtils::Format("select * from musicvideoview where %s", strWhere.c_str());
     strSQL += PrepareSQL(" order by RANDOM() limit 1");
     CLog::Log(LOGDEBUG, "%s query = %s", __FUNCTION__, strSQL.c_str());
     // run query
@@ -7575,7 +7540,7 @@ bool CVideoDatabase::GetRandomMusicVideo(CFileItem* item, int& idSong, const CSt
       return false;
     }
     *item->GetVideoInfoTag() = GetDetailsForMusicVideo(m_pDS);
-    CStdString path; path.Format("videodb://musicvideos/titles/%ld",item->GetVideoInfoTag()->m_iDbId);
+    CStdString path = StringUtils::Format("videodb://musicvideos/titles/%ld",item->GetVideoInfoTag()->m_iDbId);
     item->SetPath(path);
     idSong = m_pDS->fv("idMVideo").get_asInt();
     item->SetLabel(item->GetVideoInfoTag()->m_strTitle);
@@ -7663,9 +7628,9 @@ void CVideoDatabase::GetMoviesByName(const CStdString& strSearch, CFileItemList&
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
       CStdString path;
       if (setId <= 0 || !CSettings::Get().GetBool("videolibrary.groupmoviesets"))
-        path.Format("videodb://movies/titles/%i", movieId);
+        path = StringUtils::Format("videodb://movies/titles/%i", movieId);
       else
-        path.Format("videodb://movies/sets/%i/%i", setId, movieId);
+        path = StringUtils::Format("videodb://movies/sets/%i/%i", setId, movieId);
       pItem->SetPath(path);
       pItem->m_bIsFolder=false;
       items.Add(pItem);
@@ -7704,8 +7669,7 @@ void CVideoDatabase::GetTvShowsByName(const CStdString& strSearch, CFileItemList
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
-      CStdString strDir;
-      strDir.Format("tvshows/titles/%ld/", m_pDS->fv("tvshow.idShow").get_asInt());
+      CStdString strDir = StringUtils::Format("tvshows/titles/%ld/", m_pDS->fv("tvshow.idShow").get_asInt());
 
       pItem->SetPath("videodb://"+ strDir);
       pItem->m_bIsFolder=true;
@@ -7746,7 +7710,7 @@ void CVideoDatabase::GetEpisodesByName(const CStdString& strSearch, CFileItemLis
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" ("+m_pDS->fv(4).get_asString()+")"));
-      CStdString path; path.Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
+      CStdString path = StringUtils::Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
       pItem->SetPath(path);
       pItem->m_bIsFolder=false;
       items.Add(pItem);
@@ -7789,8 +7753,7 @@ void CVideoDatabase::GetMusicVideosByName(const CStdString& strSearch, CFileItem
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
-      CStdString strDir;
-      strDir.Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
+      CStdString strDir = StringUtils::Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
 
       pItem->SetPath("videodb://"+ strDir);
       pItem->m_bIsFolder=false;
@@ -7837,7 +7800,7 @@ void CVideoDatabase::GetEpisodesByPlot(const CStdString& strSearch, CFileItemLis
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" ("+m_pDS->fv(4).get_asString()+")"));
-      CStdString path; path.Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
+      CStdString path = StringUtils::Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
       pItem->SetPath(path);
       pItem->m_bIsFolder=false;
       items.Add(pItem);
@@ -7877,7 +7840,7 @@ void CVideoDatabase::GetMoviesByPlot(const CStdString& strSearch, CFileItemList&
         }
 
       CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
-      CStdString path; path.Format("videodb://movies/titles/%ld", m_pDS->fv(0).get_asInt());
+      CStdString path = StringUtils::Format("videodb://movies/titles/%ld", m_pDS->fv(0).get_asInt());
       pItem->SetPath(path);
       pItem->m_bIsFolder=false;
 
@@ -7918,8 +7881,7 @@ void CVideoDatabase::GetMovieDirectorsByName(const CStdString& strSearch, CFileI
           continue;
         }
 
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("directorlinkmovie.idDirector").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("directorlinkmovie.idDirector").get_asInt());
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
 
       pItem->SetPath("videodb://movies/directors/"+ strDir);
@@ -7960,8 +7922,7 @@ void CVideoDatabase::GetTvShowsDirectorsByName(const CStdString& strSearch, CFil
           continue;
         }
 
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("directorlinktvshow.idDirector").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("directorlinktvshow.idDirector").get_asInt());
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
 
       pItem->SetPath("videodb://tvshows/studios/"+ strDir);
@@ -8002,8 +7963,7 @@ void CVideoDatabase::GetMusicVideoDirectorsByName(const CStdString& strSearch, C
           continue;
         }
 
-      CStdString strDir;
-      strDir.Format("%ld/", m_pDS->fv("directorlinkmusicvideo.idDirector").get_asInt());
+      CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("directorlinkmusicvideo.idDirector").get_asInt());
       CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
 
       pItem->SetPath("videodb://musicvideos/albums/"+ strDir);
@@ -8354,7 +8314,7 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se
     }
 
     CLog::Log(LOGDEBUG, "%s: Cleaning path table", __FUNCTION__);
-    sql.Format("delete from path where strContent='' and strSettings='' and strHash='' and exclude!=1 "
+    sql = StringUtils::Format("delete from path where strContent='' and strSettings='' and strHash='' and exclude!=1 "
                                   "and idPath not in (select distinct idPath from files) "
                                   "and idPath not in (select distinct idPath from tvshowlinkpath) "
                                   "and idPath not in (select distinct c%02d from movie) "
@@ -8439,8 +8399,7 @@ void CVideoDatabase::DumpToDummyFiles(const CStdString &path)
       for (int i = 0; i < episodes.Size(); i++)
       {
         CVideoInfoTag *tag = episodes[i]->GetVideoInfoTag();
-        CStdString episode;
-        episode.Format("%s.s%02de%02d.avi", showName.c_str(), tag->m_iSeason, tag->m_iEpisode);
+        CStdString episode = StringUtils::Format("%s.s%02de%02d.avi", showName.c_str(), tag->m_iSeason, tag->m_iEpisode);
         // and make a file
         CStdString episodePath = URIUtils::AddFileToFolder(TVFolder, episode);
         CFile file;
@@ -8457,8 +8416,7 @@ void CVideoDatabase::DumpToDummyFiles(const CStdString &path)
   for (int i = 0; i < items.Size(); i++)
   {
     CVideoInfoTag *tag = items[i]->GetVideoInfoTag();
-    CStdString movie;
-    movie.Format("%s.avi", tag->m_strTitle.c_str());
+    CStdString movie = StringUtils::Format("%s.avi", tag->m_strTitle.c_str());
     CFile file;
     if (file.OpenForWrite(URIUtils::AddFileToFolder(moviePath, movie)))
       file.Close();
@@ -8930,8 +8888,7 @@ void CVideoDatabase::ExportToXML(const CStdString &path, bool singleFiles /* = f
         {
           if (!singleFiles)
           {
-            CStdString epName;
-            epName.Format("s%02ie%02i.avi", episode.m_iSeason, episode.m_iEpisode);
+            CStdString epName = StringUtils::Format("s%02ie%02i.avi", episode.m_iSeason, episode.m_iEpisode);
             item.SetPath(URIUtils::AddFileToFolder(showDir, epName));
           }
           for (map<string, string>::const_iterator i = artwork.begin(); i != artwork.end(); ++i)
@@ -9177,8 +9134,7 @@ void CVideoDatabase::ImportFromXML(const CStdString &path)
           CVideoInfoTag info;
           info.Load(episode);
           CFileItem item(info);
-          CStdString filename;
-          filename.Format("s%02ie%02i.avi", info.m_iSeason, info.m_iEpisode);
+          CStdString filename = StringUtils::Format("s%02ie%02i.avi", info.m_iSeason, info.m_iEpisode);
           CFileItem artItem(item);
           artItem.SetPath(GetSafeFile(artPath, filename));
           scanner.GetArtwork(&artItem, CONTENT_MOVIES, useFolders, true, actorsDir);
index 932b026..ebbdc05 100644 (file)
@@ -1070,7 +1070,7 @@ namespace VIDEO
 
     if (showInfo && content == CONTENT_TVSHOWS)
     {
-      strTitle.Format("%s - %ix%i - %s", showInfo->m_strTitle.c_str(), movieDetails.m_iSeason, movieDetails.m_iEpisode, strTitle.c_str());
+      strTitle = StringUtils::Format("%s - %ix%i - %s", showInfo->m_strTitle.c_str(), movieDetails.m_iSeason, movieDetails.m_iEpisode, strTitle.c_str());
     }
 
     std::string redactPath = pItem->GetPath();
@@ -1689,11 +1689,7 @@ namespace VIDEO
       if (!time)
         time = buffer.st_ctime;
       if (time)
-      {
-        CStdString hash;
-        hash.Format("fast%"PRId64, time);
-        return hash;
-      }
+        return StringUtils::Format("fast%"PRId64, time);
     }
     return "";
   }
index 831eb19..8a69088 100644 (file)
@@ -544,9 +544,9 @@ const CStdString CVideoInfoTag::GetCast(bool bIncludeRole /*= false*/) const
   {
     CStdString character;
     if (it->strRole.IsEmpty() || !bIncludeRole)
-      character.Format("%s\n", it->strName.c_str());
+      character = StringUtils::Format("%s\n", it->strName.c_str());
     else
-      character.Format("%s %s %s\n", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
+      character = StringUtils::Format("%s %s %s\n", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
     strLabel += character;
   }
   return strLabel.TrimRight("\n");
index 3222eb3..7eee86c 100644 (file)
@@ -41,6 +41,7 @@
 #include "cores/AudioEngine/Utils/AEUtil.h"
 #include "cores/IPlayer.h"
 #include "utils/LangCodeExpander.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 using namespace XFILE;
@@ -171,7 +172,7 @@ void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id)
     if (info.name.length() == 0)
       strItem = strLanguage;
     else
-      strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str());
+      strItem = StringUtils::Format("%s - %s", strLanguage.c_str(), info.name.c_str());
 
     strItem.AppendFormat(" (%i/%i)", i + 1, (int)setting.max + 1);
     setting.entry.push_back(make_pair(setting.entry.size(), strItem));
@@ -217,7 +218,7 @@ void CGUIDialogAudioSubtitleSettings::AddSubtitleStreams(unsigned int id)
     if (info.name.length() == 0)
       strItem = strLanguage;
     else
-      strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str());
+      strItem = StringUtils::Format("%s - %s", strLanguage.c_str(), info.name.c_str());
 
     strItem.AppendFormat(" (%i/%i)", i + 1, (int)setting.max + 1);
 
@@ -376,27 +377,23 @@ void CGUIDialogAudioSubtitleSettings::FrameMove()
 
 CStdString CGUIDialogAudioSubtitleSettings::PercentAsDecibel(float value, float interval)
 {
-  CStdString text;
-  text.Format("%2.1f dB", CAEUtil::PercentToGain(value));
-  return text;
+  return StringUtils::Format("%2.1f dB", CAEUtil::PercentToGain(value));;
 }
 
 CStdString CGUIDialogAudioSubtitleSettings::FormatDecibel(float value, float interval)
 {
-  CStdString text;
-  text.Format("%2.1f dB", value);
-  return text;
+  return StringUtils::Format("%2.1f dB", value);;
 }
 
 CStdString CGUIDialogAudioSubtitleSettings::FormatDelay(float value, float interval)
 {
   CStdString text;
   if (fabs(value) < 0.5f*interval)
-    text.Format(g_localizeStrings.Get(22003).c_str(), 0.0);
+    text = StringUtils::Format(g_localizeStrings.Get(22003).c_str(), 0.0);
   else if (value < 0)
-    text.Format(g_localizeStrings.Get(22004).c_str(), fabs(value));
+    text = StringUtils::Format(g_localizeStrings.Get(22004).c_str(), fabs(value));
   else
-    text.Format(g_localizeStrings.Get(22005).c_str(), value);
+    text = StringUtils::Format(g_localizeStrings.Get(22005).c_str(), value);
   return text;
 }
 
index af8a02c..dfa9e3e 100644 (file)
@@ -22,6 +22,7 @@
 #include "guilib/Key.h"
 #include "guilib/LocalizeStrings.h"
 #include "FileItem.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 
@@ -93,8 +94,7 @@ void CGUIDialogFileStacking::OnInitWindow()
     SendMessage(GUI_MSG_LABEL_RESET, GetID(), STACK_LIST);
     for (int i = 0; i < m_iNumberOfFiles; i++)
     {
-      CStdString label;
-      label.Format(g_localizeStrings.Get(23051).c_str(), i+1);
+      CStdString label = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), i+1);
       CFileItemPtr item(new CFileItem(label));
       m_stackItems->Add(item);
     }
index ed228cb..ee9de8b 100644 (file)
@@ -400,8 +400,7 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
 
   // construct subtitle path
   URIUtils::RemoveExtension(strFileName);
-  CStdString strSubName;
-  strSubName.Format("%s.%s%s", strFileName.c_str(), strSubLang.c_str(), strSubExt.c_str());
+  CStdString strSubName = StringUtils::Format("%s.%s%s", strFileName.c_str(), strSubLang.c_str(), strSubExt.c_str());
   CStdString strSubPath = URIUtils::AddFileToFolder(strDestPath, strSubName);
 
   // and copy the file across
index 5eb1555..2616f91 100644 (file)
@@ -220,7 +220,7 @@ void CGUIDialogVideoBookmarks::OnRefreshList()
     
     CStdString bookmarkTime;
     if (m_bookmarks[i].type == CBookmark::EPISODE)
-      bookmarkTime.Format("%s %i %s %i", g_localizeStrings.Get(20373), m_bookmarks[i].seasonNumber, g_localizeStrings.Get(20359).c_str(), m_bookmarks[i].episodeNumber);
+      bookmarkTime = StringUtils::Format("%s %i %s %i", g_localizeStrings.Get(20373).c_str(), m_bookmarks[i].seasonNumber, g_localizeStrings.Get(20359).c_str(), m_bookmarks[i].episodeNumber);
     else
       bookmarkTime = StringUtils::SecondsToTimeString((long)m_bookmarks[i].timeInSeconds, TIME_FORMAT_HH_MM_SS);
     
@@ -339,7 +339,7 @@ bool CGUIDialogVideoBookmarks::AddBookmark(CVideoInfoTag* tag)
       {
         Crc32 crc;
         crc.ComputeFromLowerCase(g_application.CurrentFile());
-        bookmark.thumbNailImage.Format("%08x_%i.jpg", (unsigned __int32) crc, (int)bookmark.timeInSeconds);
+        bookmark.thumbNailImage = StringUtils::Format("%08x_%i.jpg", (unsigned __int32) crc, (int)bookmark.timeInSeconds);
         bookmark.thumbNailImage = URIUtils::AddFileToFolder(CProfilesManager::Get().GetBookmarksThumbFolder(), bookmark.thumbNailImage);
         if (!CPicture::CreateThumbnailFromSurface(thumbnail->GetPixels(), width, height, thumbnail->GetWidth() * 4,
                                             bookmark.thumbNailImage))
@@ -400,8 +400,9 @@ bool CGUIDialogVideoBookmarks::AddEpisodeBookmark()
     CContextButtons choices;
     for (unsigned int i=0; i < episodes.size(); ++i)
     {
-      CStdString strButton;
-      strButton.Format("%s %i, %s %i", g_localizeStrings.Get(20373), episodes[i].m_iSeason, g_localizeStrings.Get(20359).c_str(), episodes[i].m_iEpisode);
+      CStdString strButton = StringUtils::Format("%s %i, %s %i",
+                                                 g_localizeStrings.Get(20373).c_str(), episodes[i].m_iSeason,
+                                                 g_localizeStrings.Get(20359).c_str(), episodes[i].m_iEpisode);
       choices.Add(i, strButton);
     }
 
index ed7c416..aac8e10 100644 (file)
@@ -168,8 +168,7 @@ bool CGUIDialogVideoInfo::OnMessage(CGUIMessage& message)
           if (iItem < 0 || iItem >= m_castList->Size())
             break;
           CStdString strItem = m_castList->Get(iItem)->GetLabel();
-          CStdString strFind;
-          strFind.Format(" %s ",g_localizeStrings.Get(20347));
+          CStdString strFind = StringUtils::Format(" %s ",g_localizeStrings.Get(20347).c_str());
           int iPos = strItem.Find(strFind);
           if (iPos == -1)
             iPos = strItem.size();
@@ -272,7 +271,7 @@ void CGUIDialogVideoInfo::SetMovie(const CFileItem *item)
       if (it->strRole.IsEmpty())
         character = it->strName;
       else
-        character.Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
+        character = StringUtils::Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
       CFileItemPtr item(new CFileItem(it->strName));
       if (!it->thumb.IsEmpty())
         item->SetArt("thumb", it->thumb);
@@ -574,8 +573,7 @@ void CGUIDialogVideoInfo::Play(bool resume)
 {
   if (!m_movieItem->GetVideoInfoTag()->m_strEpisodeGuide.IsEmpty())
   {
-    CStdString strPath;
-    strPath.Format("videodb://tvshows/titles/%i/",m_movieItem->GetVideoInfoTag()->m_iDbId);
+    CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/",m_movieItem->GetVideoInfoTag()->m_iDbId);
     Close();
     g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
     return;
@@ -699,8 +697,7 @@ void CGUIDialogVideoInfo::OnGetArt()
 
     for (unsigned int i = 0; i < thumbs.size(); ++i)
     {
-      CStdString strItemPath;
-      strItemPath.Format("thumb://Remote%i", i);
+      CStdString strItemPath = StringUtils::Format("thumb://Remote%i", i);
       CFileItemPtr item(new CFileItem(strItemPath, false));
       item->SetArt("thumb", thumbs[i]);
       item->SetIconImage("DefaultPicture.png");
@@ -796,8 +793,7 @@ void CGUIDialogVideoInfo::OnGetFanart()
   // Grab the thumbnails from the web
   for (unsigned int i = 0; i < m_movieItem->GetVideoInfoTag()->m_fanart.GetNumFanarts(); i++)
   {
-    CStdString strItemPath;
-    strItemPath.Format("fanart://Remote%i",i);
+    CStdString strItemPath = StringUtils::Format("fanart://Remote%i",i);
     CFileItemPtr item(new CFileItem(strItemPath, false));
     CStdString thumb = m_movieItem->GetVideoInfoTag()->m_fanart.GetPreviewURL(i);
     item->SetArt("thumb", CTextureUtils::GetWrappedThumbURL(thumb));
@@ -879,7 +875,9 @@ void CGUIDialogVideoInfo::PlayTrailer()
   item.SetPath(m_movieItem->GetVideoInfoTag()->m_strTrailer);
   *item.GetVideoInfoTag() = *m_movieItem->GetVideoInfoTag();
   item.GetVideoInfoTag()->m_streamDetails.Reset();
-  item.GetVideoInfoTag()->m_strTitle.Format("%s (%s)",m_movieItem->GetVideoInfoTag()->m_strTitle.c_str(),g_localizeStrings.Get(20410));
+  item.GetVideoInfoTag()->m_strTitle = StringUtils::Format("%s (%s)",
+                                                           m_movieItem->GetVideoInfoTag()->m_strTitle.c_str(),
+                                                           g_localizeStrings.Get(20410).c_str());
   CVideoThumbLoader::SetArt(item, m_movieItem->GetArt());
   item.GetVideoInfoTag()->m_iDbId = -1;
   item.GetVideoInfoTag()->m_iFileId = -1;
@@ -1139,9 +1137,8 @@ bool CGUIDialogVideoInfo::GetMoviesForSet(const CFileItem *setItem, CFileItemLis
   if (!videodb.Open())
     return false;
 
-  CStdString strHeading; strHeading.Format(g_localizeStrings.Get(20457));
-  CStdString baseDir;
-  baseDir.Format("videodb://movies/sets/%d", setItem->GetVideoInfoTag()->m_iDbId);
+  CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(20457));
+  CStdString baseDir = StringUtils::Format("videodb://movies/sets/%d", setItem->GetVideoInfoTag()->m_iDbId);
 
   if (!CDirectory::GetDirectory(baseDir, originalMovies) || originalMovies.Size() <= 0) // keep a copy of the original members of the set
     return false;
@@ -1209,12 +1206,12 @@ bool CGUIDialogVideoInfo::GetSetForMovie(const CFileItem *movieItem, CFileItemPt
   if (currentSetId > 0)
   {
     // add clear item
-    CStdString strClear; strClear.Format(g_localizeStrings.Get(20467), currentSetLabel);
+    CStdString strClear = StringUtils::Format(g_localizeStrings.Get(20467), currentSetLabel.c_str());
     CFileItemPtr clearItem(new CFileItem(strClear));
     clearItem->GetVideoInfoTag()->m_iDbId = -1; // -1 will be used to clear set
     listItems.AddFront(clearItem, 0);
     // add keep current set item
-    CStdString strKeep; strKeep.Format(g_localizeStrings.Get(20469), currentSetLabel);
+    CStdString strKeep = StringUtils::Format(g_localizeStrings.Get(20469), currentSetLabel.c_str());
     CFileItemPtr keepItem(new CFileItem(strKeep));
     keepItem->GetVideoInfoTag()->m_iDbId = currentSetId;
     listItems.AddFront(keepItem, 1);
@@ -1224,8 +1221,7 @@ bool CGUIDialogVideoInfo::GetSetForMovie(const CFileItem *movieItem, CFileItemPt
   if (dialog == NULL)
     return false;
 
-  CStdString strHeading; 
-  strHeading.Format(g_localizeStrings.Get(20466));
+  CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(20466));
   dialog->Reset();
   dialog->SetHeading(strHeading);
   dialog->SetItems(&listItems);
index 8f30248..5218a83 100644 (file)
@@ -23,6 +23,7 @@
 #include "guilib/GUIWindowManager.h"
 #include "GUIPassword.h"
 #include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
 #ifdef HAS_VIDEO_PLAYBACK
 #include "cores/VideoRenderers/RenderManager.h"
 #include "cores/VideoRenderers/RenderFlags.h"
@@ -269,15 +270,11 @@ void CGUIDialogVideoSettings::OnSettingChanged(SettingInfo &setting)
 
 CStdString CGUIDialogVideoSettings::FormatInteger(float value, float minimum)
 {
-  CStdString text;
-  text.Format("%i", MathUtils::round_int(value));
-  return text;
+  return StringUtils::Format("%i", MathUtils::round_int(value));
 }
 
 CStdString CGUIDialogVideoSettings::FormatFloat(float value, float minimum)
 {
-  CStdString text;
-  text.Format("%2.2f", value);
-  return text;
+  return StringUtils::Format("%2.2f", value);
 }
 
index 8948532..8a45593 100644 (file)
@@ -51,6 +51,7 @@
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "XBDateTime.h"
 #include "input/ButtonTranslator.h"
 #include "pvr/PVRManager.h"
@@ -250,8 +251,7 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
         else
         {
           int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
-          CStdString strChannel;
-          strChannel.Format("%i", action.GetID() - REMOTE_0);
+          CStdString strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0);
           if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
             iChannelNumber = atoi(strChannel.c_str());
         }
@@ -569,7 +569,7 @@ void CGUIWindowFullScreen::FrameMove()
       // We show CPU usage for the entire process, as it's arguably more useful.
       double dCPU = m_resourceCounter.GetCPUUsage();
       CStdString strCores;
-      strCores.Format("cpu:%.0f%%", dCPU);
+      strCores = StringUtils::Format("cpu:%.0f%%", dCPU);
 #else
       CStdString strCores = g_cpuInfo.GetCoresUsageString();
 #endif
@@ -579,16 +579,16 @@ void CGUIWindowFullScreen::FrameMove()
       CStdString strClock;
 
       if (g_VideoReferenceClock.GetClockInfo(missedvblanks, clockspeed, refreshrate))
-        strClock.Format("S( refresh:%i missed:%i speed:%+.3f%% %s )"
-                       , refreshrate
-                       , missedvblanks
-                       , clockspeed - 100.0
-                       , g_renderManager.GetVSyncState().c_str());
+        strClock = StringUtils::Format("S( refresh:%i missed:%i speed:%+.3f%% %s )"
+                                       , refreshrate
+                                       , missedvblanks
+                                       , clockspeed - 100.0
+                                       , g_renderManager.GetVSyncState().c_str());
 
-      strGeneralFPS.Format("%s\nW( fps:%02.2f %s ) %s"
-                         , strGeneral.c_str()
-                         , g_infoManager.GetFPS()
-                         , strCores.c_str(), strClock.c_str() );
+      strGeneralFPS = StringUtils::Format("%s\nW( fps:%02.2f %s ) %s"
+                                          , strGeneral.c_str()
+                                          , g_infoManager.GetFPS()
+                                          , strCores.c_str(), strClock.c_str() );
 
       CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW3);
       msg.SetLabel(strGeneralFPS);
@@ -610,8 +610,7 @@ void CGUIWindowFullScreen::FrameMove()
       // get the "View Mode" string
       CStdString strTitle = g_localizeStrings.Get(629);
       CStdString strMode = g_localizeStrings.Get(630 + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode);
-      CStdString strInfo;
-      strInfo.Format("%s : %s", strTitle.c_str(), strMode.c_str());
+      CStdString strInfo = StringUtils::Format("%s : %s", strTitle.c_str(), strMode.c_str());
       CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1);
       msg.SetLabel(strInfo);
       OnMessage(msg);
@@ -624,12 +623,15 @@ void CGUIWindowFullScreen::FrameMove()
       float xscale = (float)res.iScreenWidth  / (float)res.iWidth;
       float yscale = (float)res.iScreenHeight / (float)res.iHeight;
 
-      CStdString strSizing;
-      strSizing.Format(g_localizeStrings.Get(245),
-                       (int)info.SrcRect.Width(), (int)info.SrcRect.Height(),
-                       (int)(info.DestRect.Width() * xscale), (int)(info.DestRect.Height() * yscale),
-                       CDisplaySettings::Get().GetZoomAmount(), info.videoAspectRatio*CDisplaySettings::Get().GetPixelRatio(),
-                       CDisplaySettings::Get().GetPixelRatio(), CDisplaySettings::Get().GetVerticalShift());
+      CStdString strSizing = StringUtils::Format(g_localizeStrings.Get(245),
+                                                 (int)info.SrcRect.Width(),
+                                                 (int)info.SrcRect.Height(),
+                                                 (int)(info.DestRect.Width() * xscale),
+                                                 (int)(info.DestRect.Height() * yscale),
+                                                 CDisplaySettings::Get().GetZoomAmount(),
+                                                 info.videoAspectRatio*CDisplaySettings::Get().GetPixelRatio(),
+                                                 CDisplaySettings::Get().GetPixelRatio(),
+                                                 CDisplaySettings::Get().GetVerticalShift());
       CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW2);
       msg.SetLabel(strSizing);
       OnMessage(msg);
@@ -638,14 +640,18 @@ void CGUIWindowFullScreen::FrameMove()
     {
       CStdString strStatus;
       if (g_Windowing.IsFullScreen())
-        strStatus.Format("%s %ix%i@%.2fHz - %s",
-          g_localizeStrings.Get(13287), res.iScreenWidth,
-          res.iScreenHeight, res.fRefreshRate,
-          g_localizeStrings.Get(244));
+        strStatus = StringUtils::Format("%s %ix%i@%.2fHz - %s",
+                                        g_localizeStrings.Get(13287).c_str(),
+                                        res.iScreenWidth,
+                                        res.iScreenHeight,
+                                        res.fRefreshRate,
+                                        g_localizeStrings.Get(244).c_str());
       else
-        strStatus.Format("%s %ix%i - %s",
-          g_localizeStrings.Get(13287), res.iScreenWidth,
-          res.iScreenHeight, g_localizeStrings.Get(242));
+        strStatus = StringUtils::Format("%s %ix%i - %s",
+                                        g_localizeStrings.Get(13287).c_str(),
+                                        res.iScreenWidth,
+                                        res.iScreenHeight,
+                                        g_localizeStrings.Get(242).c_str());
 
       CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW3);
       msg.SetLabel(strStatus);
index 3fa9b14..9aaea19 100644 (file)
@@ -524,8 +524,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const ScraperPtr &info2)
     if (!hasDetails && (scrUrl.m_url.size() == 0 || needsRefresh))
     {
       // 4a. show dialog that we're busy querying www.imdb.com
-      CStdString strHeading;
-      strHeading.Format(g_localizeStrings.Get(197),info->Name().c_str());
+      CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(197),info->Name().c_str());
       pDlgProgress->SetHeading(strHeading);
       pDlgProgress->SetLine(0, movieName);
       pDlgProgress->SetLine(1, "");
@@ -1027,11 +1026,10 @@ CStdString CGUIWindowVideoBase::GetResumeString(const CFileItem &item)
   GetResumeItemOffset(&item, startOffset, startPart);
   if (startOffset > 0)
   {
-    resumeString.Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(startOffset/75).c_str());
+    resumeString = StringUtils::Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(startOffset/75).c_str());
     if (startPart > 0)
     {
-      CStdString partString;
-      partString.Format(g_localizeStrings.Get(23051).c_str(), startPart);
+      CStdString partString = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), startPart);
       resumeString += " (" + partString + ")";
     }
   }
@@ -1850,7 +1848,7 @@ void CGUIWindowVideoBase::AddToDatabase(int iItem)
   // everything is ok, so add to database
   m_database.Open();
   int idMovie = m_database.AddMovie(pItem->GetPath());
-  movie.m_strIMDBNumber.Format("xx%08i", idMovie);
+  movie.m_strIMDBNumber = StringUtils::Format("xx%08i", idMovie);
   m_database.SetDetailsForMovie(pItem->GetPath(), movie, pItem->GetArt());
   m_database.Close();
 
index dfe7ae2..e367ba8 100644 (file)
@@ -504,8 +504,7 @@ void CGUIWindowVideoNav::UpdateButtons()
       StringUtils::StartsWith(m_vecItems->Get(m_vecItems->Size()-1)->GetPath(), "/-1/"))
       iItems--;
   }
-  CStdString items;
-  items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
+  CStdString items = StringUtils::Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
   SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
 
   // set the filter label
@@ -679,8 +678,7 @@ void CGUIWindowVideoNav::OnDeleteItem(CFileItemPtr pItem)
   {
     CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
     pDialog->SetHeading(432);
-    CStdString strLabel;
-    strLabel.Format(g_localizeStrings.Get(433),pItem->GetLabel());
+    CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(433),pItem->GetLabel().c_str());
     pDialog->SetLine(1, strLabel);
     pDialog->SetLine(2, "");;
     pDialog->DoModal();
@@ -701,8 +699,7 @@ void CGUIWindowVideoNav::OnDeleteItem(CFileItemPtr pItem)
   {
     CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
     pDialog->SetHeading(432);
-    CStdString strLabel;
-    strLabel.Format(g_localizeStrings.Get(433), pItem->GetLabel());
+    CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(433), pItem->GetLabel().c_str());
     pDialog->SetLine(1, strLabel);
     pDialog->SetLine(2, "");
     pDialog->DoModal();
@@ -796,8 +793,7 @@ bool CGUIWindowVideoNav::DeleteItem(CFileItem* pItem, bool bUnavailable /* = fal
   }
   else
   {
-    CStdString strLine;
-    strLine.Format(g_localizeStrings.Get(433),pItem->GetLabel());
+    CStdString strLine = StringUtils::Format(g_localizeStrings.Get(433), pItem->GetLabel().c_str());
     pDialog->SetLine(0, strLine);
     pDialog->SetLine(1, "");
     pDialog->SetLine(2, "");;
@@ -976,8 +972,8 @@ void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &butt
           {
             std::string mediaType = videoUrl.GetItemType();
 
-            CStdString strLabelAdd; strLabelAdd.Format(g_localizeStrings.Get(20460), GetLocalizedType(videoUrl.GetItemType()).c_str());
-            CStdString strLabelRemove; strLabelRemove.Format(g_localizeStrings.Get(20461), GetLocalizedType(videoUrl.GetItemType()).c_str());
+            CStdString strLabelAdd = StringUtils::Format(g_localizeStrings.Get(20460), GetLocalizedType(videoUrl.GetItemType()).c_str());
+            CStdString strLabelRemove = StringUtils::Format(g_localizeStrings.Get(20461), GetLocalizedType(videoUrl.GetItemType()).c_str());
             buttons.Add(CONTEXT_BUTTON_TAGS_ADD_ITEMS, strLabelAdd);
             buttons.Add(CONTEXT_BUTTON_TAGS_REMOVE_ITEMS, strLabelRemove);
             buttons.Add(CONTEXT_BUTTON_DELETE, 646);
@@ -1131,8 +1127,7 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
 
         for (unsigned int i = 0; i < thumbs.size(); i++)
         {
-          CStdString strItemPath;
-          strItemPath.Format("thumb://Remote%i",i);
+          CStdString strItemPath = StringUtils::Format("thumb://Remote%i",i);
           CFileItemPtr item(new CFileItem(strItemPath, false));
           item->SetArt("thumb", thumbs[i]);
           item->SetIconImage("DefaultPicture.png");
@@ -1234,7 +1229,7 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
 
       CFileItemList items;
       CStdString localizedType = GetLocalizedType(mediaType);
-      CStdString strLabel; strLabel.Format(g_localizeStrings.Get(20464), localizedType.c_str());
+      CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20464), localizedType.c_str());
       if (!GetItemsForTag(strLabel, mediaType, items, item->GetVideoInfoTag()->m_iDbId))
         return true;
 
@@ -1266,7 +1261,7 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
 
       CFileItemList items;
       CStdString localizedType = GetLocalizedType(mediaType);
-      CStdString strLabel; strLabel.Format(g_localizeStrings.Get(20464), localizedType.c_str());
+      CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20464), localizedType.c_str());
       if (!GetItemsForTag(strLabel, mediaType, items, item->GetVideoInfoTag()->m_iDbId, false))
         return true;
 
@@ -1329,7 +1324,8 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
       CStdString strPath;
       CMusicDatabase database;
       database.Open();
-      strPath.Format("musicdb://artists/%ld/",database.GetArtistByName(StringUtils::Join(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator)));
+      strPath = StringUtils::Format("musicdb://artists/%ld/",
+                                    database.GetArtistByName(StringUtils::Join(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator)));
       g_windowManager.ActivateWindow(WINDOW_MUSIC_NAV,strPath);
       return true;
     }
@@ -1338,7 +1334,8 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
       CStdString strPath;
       CMusicDatabase database;
       database.Open();
-      strPath.Format("musicdb://albums/%ld/",database.GetAlbumByName(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_strAlbum));
+      strPath = StringUtils::Format("musicdb://albums/%ld/",
+                                    database.GetAlbumByName(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_strAlbum));
       g_windowManager.ActivateWindow(WINDOW_MUSIC_NAV,strPath);
       return true;
     }
@@ -1459,14 +1456,14 @@ bool CGUIWindowVideoNav::OnClick(int iItem)
 
     if (!videodb.GetSingleValue("tag", "tag.idTag", videodb.PrepareSQL("tag.strTag = '%s' AND tag.idTag IN (SELECT taglinks.idTag FROM taglinks WHERE taglinks.media_type = '%s')", strTag.c_str(), mediaType.c_str())).empty())
     {
-      CStdString strError; strError.Format(g_localizeStrings.Get(20463), strTag.c_str());
+      CStdString strError = StringUtils::Format(g_localizeStrings.Get(20463), strTag.c_str());
       CGUIDialogOK::ShowAndGetInput(20462, "", strError, "");
       return true;
     }
 
     int idTag = videodb.AddTag(strTag);
     CFileItemList items;
-    CStdString strLabel; strLabel.Format(g_localizeStrings.Get(20464), localizedType.c_str());
+    CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20464), localizedType.c_str());
     if (GetItemsForTag(strLabel, mediaType, items, idTag))
     {
       for (int index = 0; index < items.Size(); index++)
index 7ae9cae..540207d 100644 (file)
@@ -21,6 +21,7 @@
 #include "GUIViewControl.h"
 #include "guilib/GUIWindowManager.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 #include "FileItem.h"
 #include "guilib/LocalizeStrings.h"
 #include "GUIInfoManager.h"
@@ -303,8 +304,7 @@ void CGUIViewControl::UpdateViewAsControl(const CStdString &viewLabel)
   {
     IGUIContainer *view = (IGUIContainer *)m_visibleViews[i];
     CGUIMessage msg(GUI_MSG_LABEL_ADD, m_parentWindow, m_viewAsControl, i);
-    CStdString label;
-    label.Format(g_localizeStrings.Get(534).c_str(), view->GetLabel().c_str()); // View: %s
+    CStdString label = StringUtils::Format(g_localizeStrings.Get(534).c_str(), view->GetLabel().c_str()); // View: %s
     msg.SetLabel(label);
     g_windowManager.SendMessage(msg, m_parentWindow);
   }
@@ -312,8 +312,7 @@ void CGUIViewControl::UpdateViewAsControl(const CStdString &viewLabel)
   g_windowManager.SendMessage(msgSelect, m_parentWindow);
 
   // otherwise it's just a normal button
-  CStdString label;
-  label.Format(g_localizeStrings.Get(534).c_str(), viewLabel.c_str()); // View: %s
+  CStdString label = StringUtils::Format(g_localizeStrings.Get(534).c_str(), viewLabel.c_str()); // View: %s
   CGUIMessage msgSet(GUI_MSG_LABEL_SET, m_parentWindow, m_viewAsControl);
   msgSet.SetLabel(label);
   g_windowManager.SendMessage(msgSet, m_parentWindow);
index 806a7d4..947c162 100644 (file)
@@ -42,6 +42,7 @@
 #include "utils/SystemInfo.h"
 #include "utils/Environment.h"
 #include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
 
 // default Broadcom registy bits (setup when installing a CrystalHD card)
 #define BC_REG_PATH       "Software\\Broadcom\\MediaPC"
@@ -400,7 +401,7 @@ std::vector<CStdString> CWIN32Util::GetDiskUsage()
       if( DRIVE_FIXED == GetDriveType( strDrive.c_str()  ) &&
         GetDiskFreeSpaceEx( ( strDrive.c_str() ), NULL, &ULTotal, &ULTotalFree ) )
       {
-        strRet.Format("%s %d MB %s",strDrive.c_str(), int(ULTotalFree.QuadPart/(1024*1024)),g_localizeStrings.Get(160));
+        strRet = StringUtils::Format("%s %d MB %s",strDrive.c_str(), int(ULTotalFree.QuadPart/(1024*1024)),g_localizeStrings.Get(160));
         result.push_back(strRet);
       }
       iPos += (strlen( pcBuffer + iPos) + 1 );
@@ -412,13 +413,11 @@ std::vector<CStdString> CWIN32Util::GetDiskUsage()
 
 CStdString CWIN32Util::GetResInfoString()
 {
-  CStdString strRes;
   DEVMODE devmode;
   ZeroMemory(&devmode, sizeof(devmode));
   devmode.dmSize = sizeof(devmode);
   EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
-  strRes.Format("Desktop Resolution: %dx%d %dBit at %dHz",devmode.dmPelsWidth,devmode.dmPelsHeight,devmode.dmBitsPerPel,devmode.dmDisplayFrequency);
-  return strRes;
+  return StringUtils::Format("Desktop Resolution: %dx%d %dBit at %dHz",devmode.dmPelsWidth,devmode.dmPelsHeight,devmode.dmBitsPerPel,devmode.dmDisplayFrequency);
 }
 
 int CWIN32Util::GetDesktopColorDepth()
@@ -587,12 +586,10 @@ HRESULT CWIN32Util::ToggleTray(const char cDriveLetter)
     cDL = dvdDevice[0];
   }
 
-  CStdString strVolFormat;
-  strVolFormat.Format( _T("\\\\.\\%c:" ), cDL);
+  CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDL);
   HANDLE hDrive= CreateFile( strVolFormat.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
                              NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-  CStdString strRootFormat;
-  strRootFormat.Format( _T("%c:\\"), cDL);
+  CStdString strRootFormat = StringUtils::Format( _T("%c:\\"), cDL);
   if( ( hDrive != INVALID_HANDLE_VALUE || GetLastError() == NO_ERROR) &&
       ( GetDriveType( strRootFormat ) == DRIVE_CDROM ) )
   {
@@ -605,7 +602,7 @@ HRESULT CWIN32Util::ToggleTray(const char cDriveLetter)
   // unmount it here too as it won't hurt
   if(dwReq == IOCTL_STORAGE_EJECT_MEDIA && bRet == 1)
   {
-    strRootFormat.Format( _T("%c:"), cDL);
+    strRootFormat = StringUtils::Format( _T("%c:"), cDL);
     CMediaSource share;
     share.strPath = strRootFormat;
     share.strName = share.strPath;
@@ -625,8 +622,7 @@ HRESULT CWIN32Util::EjectTray(const char cDriveLetter)
     cDL = dvdDevice[0];
   }
 
-  CStdString strVolFormat;
-  strVolFormat.Format( _T("\\\\.\\%c:" ), cDL);
+  CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDL);
 
   if(GetDriveStatus(strVolFormat, true) != 1)
     return ToggleTray(cDL);
@@ -645,8 +641,7 @@ HRESULT CWIN32Util::CloseTray(const char cDriveLetter)
     cDL = dvdDevice[0];
   }
 
-  CStdString strVolFormat;
-  strVolFormat.Format( _T("\\\\.\\%c:" ), cDL);
+  CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDL);
 
   if(GetDriveStatus(strVolFormat, true) == 1)
     return ToggleTray(cDL);
@@ -739,8 +734,7 @@ bool CWIN32Util::EjectDrive(const char cDriveLetter)
   if( !cDriveLetter )
     return false;
 
-  CStdString strVolFormat;
-  strVolFormat.Format( _T("\\\\.\\%c:" ), cDriveLetter);
+  CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDriveLetter);
 
   long DiskNumber = -1;
 
@@ -915,20 +909,20 @@ void CWIN32Util::GetDrivesByType(VECSOURCES &localDrives, Drive_Types eDriveType
           switch(uDriveType)
           {
           case DRIVE_CDROM:
-            share.strName.Format( "%s (%s)", share.strPath, g_localizeStrings.Get(218));
+            share.strName = StringUtils::Format( "%s (%s)", share.strPath.c_str(), g_localizeStrings.Get(218).c_str());
             break;
           case DRIVE_REMOVABLE:
             if(share.strName.IsEmpty())
-              share.strName.Format( "%s (%s)", g_localizeStrings.Get(437), share.strPath);
+              share.strName = StringUtils::Format( "%s (%s)", g_localizeStrings.Get(437).c_str(), share.strPath.c_str());
             break;
           case DRIVE_UNKNOWN:
-            share.strName.Format( "%s (%s)", share.strPath, g_localizeStrings.Get(13205));
+            share.strName = StringUtils::Format( "%s (%s)", share.strPath.c_str(), g_localizeStrings.Get(13205).c_str());
             break;
           default:
             if(share.strName.empty())
               share.strName = share.strPath;
             else
-              share.strName.Format( "%s (%s)", share.strPath, share.strName);
+              share.strName = StringUtils::Format( "%s (%s)", share.strPath.c_str(), share.strName.c_str());
             break;
           }
         }
@@ -1431,7 +1425,7 @@ bool CWIN32Util::GetCrystalHDLibraryPath(CStdString &strPath)
   CStdString strRegKey;
 
   CLog::Log(LOGDEBUG, "CrystalHD: detecting CrystalHD installation path");
-  strRegKey.Format("%s\\%s", BC_REG_PATH, BC_REG_PRODUCT );
+  strRegKey = StringUtils::Format("%s\\%s", BC_REG_PATH, BC_REG_PRODUCT );
 
   if( CWIN32Util::UtilRegOpenKeyEx( HKEY_LOCAL_MACHINE, strRegKey.c_str(), KEY_READ, &hKey ))
   {
@@ -1597,8 +1591,7 @@ extern "C"
 
 bool CWIN32Util::IsUsbDevice(const CStdStringW &strWdrive)
 {
-  CStdStringW strWDevicePath;
-  strWDevicePath.Format(L"\\\\.\\%s",strWdrive.Left(2));
+  CStdStringW strWDevicePath = StringUtils::Format(L"\\\\.\\%s",strWdrive.Left(2).c_str());
 
   HANDLE deviceHandle = CreateFileW(
     strWDevicePath.c_str(),
index 1b8d3c9..8123a9a 100644 (file)
@@ -23,6 +23,7 @@
 #include "filesystem/SpecialProtocol.h"
 #include "Application.h"
 #include "windowing/WindowingFactory.h"
+#include "utils/StringUtils.h"
 
 FARPROC WINAPI delayHookNotifyFunc (unsigned dliNotify, PDelayLoadInfo pdli)
 {
@@ -70,8 +71,7 @@ FARPROC WINAPI delayHookFailureFunc (unsigned dliNotify, PDelayLoadInfo pdli)
   {
     case dliFailLoadLib:
       g_application.Stop(1);
-      CStdString strError;
-      strError.Format("Uh oh, can't load %s, exiting.", pdli->szDll);
+      CStdString strError = StringUtils::Format("Uh oh, can't load %s, exiting.", pdli->szDll);
       MessageBox(NULL, strError.c_str(), "XBMC: Fatal Error", MB_OK|MB_ICONERROR);
       exit(1);
       break;
index 57d6f22..def3543 100644 (file)
@@ -23,6 +23,7 @@
 #include "settings/DisplaySettings.h"
 #include "settings/lib/Setting.h"
 #include "settings/Settings.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 
@@ -68,7 +69,7 @@ void CWinSystemBase::UpdateDesktopResolution(RESOLUTION_INFO& newRes, int screen
   newRes.iHeight = height;
   newRes.iScreenWidth = width;
   newRes.iScreenHeight = height;
-  newRes.strMode.Format("%dx%d", width, height);
+  newRes.strMode = StringUtils::Format("%dx%d", width, height);
   if (refreshRate > 1)
     newRes.strMode.AppendFormat("@ %.2f", refreshRate);
   if (dwFlags & D3DPRESENTFLAG_INTERLACED)
@@ -78,7 +79,7 @@ void CWinSystemBase::UpdateDesktopResolution(RESOLUTION_INFO& newRes, int screen
   if (dwFlags & D3DPRESENTFLAG_MODE3DSBS)
     newRes.strMode += "sbs";
   if (screen > 0)
-    newRes.strMode.Format("%s #%d", newRes.strMode, screen + 1);
+    newRes.strMode = StringUtils::Format("%s #%d", newRes.strMode.c_str(), screen + 1);
   if (refreshRate > 1)
     newRes.strMode += " - Full Screen";
 }
index 6ca2d30..083d1e9 100644 (file)
@@ -37,6 +37,7 @@
 #include <X11/Xlib.h>
 #include "cores/VideoRenderers/RenderManager.h"
 #include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
 
 #if defined(HAS_XRANDR)
 #include <X11/extensions/Xrandr.h>
@@ -283,7 +284,7 @@ void CWinSystemX11::UpdateResolutions()
 
       CLog::Log(LOGINFO, "Pixel Ratio: %f", res.fPixelRatio);
 
-      res.strMode.Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
+      res.strMode      = StringUtils::Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
       res.strOutput    = out.name;
       res.strId        = mode.id;
       res.iSubtitles   = (int)(0.95*mode.h);
index 777fc0c..3d82fbf 100644 (file)
@@ -31,6 +31,7 @@
 #include "guilib/GraphicContext.h"
 #include "guilib/Texture.h"
 #include "windowing/X11/XRandR.h"
+#include "utils/StringUtils.h"
 #include <vector>
 
 using namespace std;
@@ -304,7 +305,7 @@ void CWinSystemX11GLES::UpdateResolutions()
 
       CLog::Log(LOGINFO, "Pixel Ratio: %f", res.fPixelRatio);
 
-      res.strMode.Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
+      res.strMode      = StringUtils::Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
       res.strOutput    = out.name;
       res.strId        = mode.id;
       res.iSubtitles   = (int)(0.95*mode.h);
index 6523e1b..f2289fb 100644 (file)
@@ -331,7 +331,7 @@ bool CEGLNativeTypeAmlogic::ModeToResolution(const char *mode, RESOLUTION_INFO *
   res->bFullScreen   = true;
   res->iSubtitles    = (int)(0.965 * res->iHeight);
   res->fPixelRatio   = 1.0f;
-  res->strMode.Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
+  res->strMode       = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
     res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
 
   return res->iWidth > 0 && res->iHeight> 0;
index 20875af..7825bdd 100644 (file)
@@ -29,6 +29,7 @@
     #include "utils/AMLUtils.h"
   #endif
 #endif
+#include "utils/StringUtils.h"
 
 CEGLNativeTypeAndroid::CEGLNativeTypeAndroid()
 {
@@ -132,7 +133,7 @@ bool CEGLNativeTypeAndroid::GetNativeResolution(RESOLUTION_INFO *res) const
   res->fPixelRatio   = 1.0f;
   res->iScreenWidth  = res->iWidth;
   res->iScreenHeight = res->iHeight;
-  res->strMode.Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
+  res->strMode       = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
   res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
   CLog::Log(LOGNOTICE,"Current resolution: %s\n",res->strMode.c_str());
   return true;
index fb5c1c6..df4214a 100644 (file)
@@ -24,6 +24,7 @@
 #include "utils/log.h"
 #include "guilib/gui3d.h"
 #include "linux/DllBCM.h"
+#include "utils/StringUtils.h"
 
 #ifndef __VIDEOCORE4__
 #define __VIDEOCORE4__
@@ -412,11 +413,11 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector<RESOLUTION_INFO> &r
       m_desktopRes.fPixelRatio  = get_display_aspect_ratio((SDTV_ASPECT_T)tv_state.display.sdtv.display_options.aspect) / ((float)m_desktopRes.iScreenWidth / (float)m_desktopRes.iScreenHeight);
     }
 
-    m_desktopRes.strMode.Format("%dx%d", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight);
+    m_desktopRes.strMode = StringUtils::Format("%dx%d", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight);
 
     if((int)m_desktopRes.fRefreshRate > 1)
     {
-      m_desktopRes.strMode.Format("%dx%d @ %.2f%s - Full Screen", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight, m_desktopRes.fRefreshRate,
+      m_desktopRes.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight, m_desktopRes.fRefreshRate,
         m_desktopRes.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
     }
     m_initDesktopRes = false;
@@ -541,7 +542,7 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v
       res.iWidth = gui_width;
       res.iHeight = gui_height;
 
-      res.strMode.Format("%dx%d @ %.2f%s - Full Screen", res.iScreenWidth, res.iScreenHeight, res.fRefreshRate,
+      res.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res.iScreenWidth, res.iScreenHeight, res.fRefreshRate,
         res.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
 
       CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) %s%s:%x\n", i, res.strMode.c_str(), res.fPixelRatio,
@@ -558,8 +559,7 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v
         res2.dwFlags |= D3DPRESENTFLAG_MODE3DSBS;
         res2.fPixelRatio    = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight);
         res2.fPixelRatio   *= 2.0f;
-        res2.strMode.Format("%dx%d", res2.iScreenWidth, res2.iScreenHeight);
-        res2.strMode.Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
+        res2.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
             res2.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
         CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) SBS\n", i, res2.strMode.c_str(), res2.fPixelRatio);
 
@@ -573,8 +573,7 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v
         res2.dwFlags |= D3DPRESENTFLAG_MODE3DTB;
         res2.fPixelRatio    = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight);
         res2.fPixelRatio   *= 0.5f;
-        res2.strMode.Format("%dx%d", res2.iScreenWidth, res2.iScreenHeight);
-        res2.strMode.Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
+        res2.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
             res2.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
         CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) TAB\n", i, res2.strMode.c_str(), res2.fPixelRatio);
 
index 6734ed5..ac16f9c 100644 (file)
@@ -33,6 +33,8 @@
 #include "guilib/Resolution.h"
 #include "guilib/gui3d.h"
 
+#include "utils/StringUtils.h"
+
 #include "windowing/DllWaylandClient.h"
 #include "windowing/DllXKBCommon.h"
 
@@ -694,7 +696,7 @@ void ResolutionInfoForMode(const xw::Output::ModeGeometry &mode,
   res.fPixelRatio = 1.0f;
   res.iScreenWidth = res.iWidth;
   res.iScreenHeight = res.iHeight;
-  res.strMode.Format("%dx%d @ %.2fp",
+  res.strMode = StringUtils::Format("%dx%d @ %.2fp",
                      res.iScreenWidth,
                      res.iScreenHeight,
                      res.fRefreshRate);
index a3db950..f50b68e 100644 (file)
@@ -33,6 +33,7 @@
 #include "settings/DisplaySettings.h"
 #include "guilib/GraphicContext.h"
 #include "guilib/Texture.h"
+#include "utils/StringUtils.h"
 #include <vector>
 #undef BOOL
 
@@ -267,7 +268,7 @@ void CWinSystemIOS::FillInVideoModes()
       //mode str by doing it without appending "Full Screen".
       //this is what linux does - though it feels that there shouldn't be
       //the same resolution twice... - thats why i add a FIXME here.
-      res.strMode.Format("%dx%d @ %.2f", w, h, refreshrate);
+      res.strMode = StringUtils::Format("%dx%d @ %.2f", w, h, refreshrate);
       g_graphicsContext.ResetOverscan(res);
       CDisplaySettings::Get().AddResolutionInfo(res);
     }
index a63118e..0a94e86 100644 (file)
@@ -34,6 +34,7 @@
 #include "input/KeyboardStat.h"
 #include "threads/SingleLock.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "osx/XBMCHelper.h"
 #include "utils/SystemInfo.h"
 #include "osx/CocoaInterface.h"
@@ -1307,7 +1308,7 @@ void CWinSystemOSX::FillInVideoModes()
         // mode str by doing it without appending "Full Screen".
         // this is what linux does - though it feels that there shouldn't be
         // the same resolution twice... - thats why i add a FIXME here.
-        res.strMode.Format("%dx%d @ %.2f", w, h, refreshrate);
+        res.strMode = StringUtils::Format("%dx%d @ %.2f", w, h, refreshrate);
         g_graphicsContext.ResetOverscan(res);
         CDisplaySettings::Get().AddResolutionInfo(res);
       }
index d2aa608..5933fd8 100644 (file)
@@ -51,6 +51,7 @@
 #include "network/ZeroconfBrowser.h"
 #include "GUIUserMessages.h"
 #include "utils/CharsetConverter.h"
+#include "utils/StringUtils.h"
 
 #ifdef TARGET_WINDOWS
 
@@ -765,8 +766,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
               // optical medium
               if (lpdbv -> dbcv_flags & DBTF_MEDIA)
               {
-                CStdString strdrive;
-                strdrive.Format("%c:\\", CWIN32Util::FirstDriveFromMask(lpdbv ->dbcv_unitmask));
+                CStdString strdrive = StringUtils::Format("%c:\\", CWIN32Util::FirstDriveFromMask(lpdbv ->dbcv_unitmask));
                 if(wParam == DBT_DEVICEARRIVAL)
                 {
                   CLog::Log(LOGDEBUG, __FUNCTION__": Drive %s Media has arrived.", strdrive.c_str());
index a92ec59..e278547 100644 (file)
@@ -204,8 +204,7 @@ bool CGUIMediaWindow::OnAction(const CAction &action)
 
   if (action.GetID() >= ACTION_FILTER_SMS2 && action.GetID() <= ACTION_FILTER_SMS9)
   {
-    CStdString filter;
-    filter.Format("%i", (int)(action.GetID() - ACTION_FILTER_SMS2 + 2));
+    CStdString filter = StringUtils::Format("%i", (int)(action.GetID() - ACTION_FILTER_SMS2 + 2));
     CGUIMessage message(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_FILTER_ITEMS, 1); // 1 for append
     message.SetStringParam(filter);
     OnMessage(message);
@@ -550,13 +549,12 @@ void CGUIMediaWindow::UpdateButtons()
     else
       CONTROL_ENABLE(CONTROL_BTNSORTBY);
 
-    CStdString sortLabel;
-    sortLabel.Format(g_localizeStrings.Get(550).c_str(), g_localizeStrings.Get(m_guiState->GetSortMethodLabel()).c_str());
+    CStdString sortLabel = StringUtils::Format(g_localizeStrings.Get(550).c_str(),
+                                               g_localizeStrings.Get(m_guiState->GetSortMethodLabel()).c_str());
     SET_CONTROL_LABEL(CONTROL_BTNSORTBY, sortLabel);
   }
 
-  CStdString items;
-  items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
+  CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
   SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
 
   SET_CONTROL_LABEL2(CONTROL_BTN_FILTER, GetProperty("filter").asString());
@@ -1220,7 +1218,9 @@ void CGUIMediaWindow::GetDirectoryHistoryString(const CFileItem* pItem, CStdStri
   {
     // Could be a cue item, all items of a cue share the same filename
     // so add the offsets to build the history string
-    strHistoryString.Format("%ld%ld", pItem->m_lStartOffset, pItem->m_lEndOffset);
+    strHistoryString = StringUtils::Format("%ld%ld",
+                                           pItem->m_lStartOffset,
+                                           pItem->m_lEndOffset);
     strHistoryString += pItem->GetPath();
   }
   else
@@ -1520,11 +1520,11 @@ void CGUIMediaWindow::GetContextButtons(int itemNumber, CContextButtons &buttons
   CStdString action;
   for (int i = CONTEXT_BUTTON_USER1; i <= CONTEXT_BUTTON_USER10; i++)
   {
-    label.Format("contextmenulabel(%i)", i - CONTEXT_BUTTON_USER1);
+    label = StringUtils::Format("contextmenulabel(%i)", i - CONTEXT_BUTTON_USER1);
     if (item->GetProperty(label).empty())
       break;
 
-    action.Format("contextmenuaction(%i)", i - CONTEXT_BUTTON_USER1);
+    action = StringUtils::Format("contextmenuaction(%i)", i - CONTEXT_BUTTON_USER1);
     if (item->GetProperty(action).empty())
       break;
 
@@ -1591,8 +1591,7 @@ bool CGUIMediaWindow::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
   case CONTEXT_BUTTON_USER9:
   case CONTEXT_BUTTON_USER10:
     {
-      CStdString action;
-      action.Format("contextmenuaction(%i)", button - CONTEXT_BUTTON_USER1);
+      CStdString action = StringUtils::Format("contextmenuaction(%i)", button - CONTEXT_BUTTON_USER1);
       CApplicationMessenger::Get().ExecBuiltIn(m_vecItems->Get(itemNumber)->GetProperty(action).asString());
       return true;
     }
index 18eb69f..9cdb6c7 100644 (file)
@@ -32,6 +32,7 @@
 #include "guilib/GUIControlProfiler.h"
 #include "GUIInfoManager.h"
 #include "utils/Variant.h"
+#include "utils/StringUtils.h"
 
 #include <climits>
 
@@ -103,12 +104,12 @@ void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &di
     CStdString profiling = CGUIControlProfiler::IsRunning() ? " (profiling)" : "";
     CStdString strCores = g_cpuInfo.GetCoresUsageString();
 #if !defined(TARGET_POSIX)
-    info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s%s", g_advancedSettings.m_logFolder.c_str(),
-                stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
+    info = StringUtils::Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s%s", g_advancedSettings.m_logFolder.c_str(),
+                               stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
 #else
     double dCPU = m_resourceCounter.GetCPUUsage();
-    info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_advancedSettings.m_logFolder.c_str(),
-                stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str());
+    info = StringUtils::Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_advancedSettings.m_logFolder.c_str(),
+                               stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str());
 #endif
   }
 
index f1f849f..6b995af 100644 (file)
@@ -411,9 +411,9 @@ void CGUIWindowFileManager::UpdateItemCounts()
     }
     CStdString items;
     if (selectedCount > 0)
-      items.Format("%i/%i %s (%s)", selectedCount, totalCount, g_localizeStrings.Get(127).c_str(), StringUtils::SizeToString(selectedSize).c_str());
+      items = StringUtils::Format("%i/%i %s (%s)", selectedCount, totalCount, g_localizeStrings.Get(127).c_str(), StringUtils::SizeToString(selectedSize).c_str());
     else
-      items.Format("%i %s", totalCount, g_localizeStrings.Get(127).c_str());
+      items = StringUtils::Format("%i %s", totalCount, g_localizeStrings.Get(127).c_str());
     SET_CONTROL_LABEL(CONTROL_NUMFILES_LEFT + i, items);
   }
 }
index 15631fb..fb6d119 100644 (file)
@@ -33,6 +33,7 @@
 #endif
 #include "interfaces/Builtins.h"
 #include "utils/Weather.h"
+#include "utils/StringUtils.h"
 #include "network/Network.h"
 #include "addons/Skin.h"
 #include "guilib/GUIMessage.h"
@@ -158,8 +159,7 @@ void CGUIWindowLoginScreen::FrameMove()
   if (GetFocusedControlID() == CONTROL_BIG_LIST && g_windowManager.GetTopMostModalDialogID() == WINDOW_INVALID)
     if (m_viewControl.HasControl(CONTROL_BIG_LIST))
       m_iSelectedItem = m_viewControl.GetSelectedItem();
-  CStdString strLabel;
-  strLabel.Format(g_localizeStrings.Get(20114),m_iSelectedItem+1, CProfilesManager::Get().GetNumberOfProfiles());
+  CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20114), m_iSelectedItem+1, CProfilesManager::Get().GetNumberOfProfiles());
   SET_CONTROL_LABEL(CONTROL_LABEL_SELECTED_PROFILE,strLabel);
   CGUIWindow::FrameMove();
 }
@@ -202,7 +202,7 @@ void CGUIWindowLoginScreen::Update()
     if (profile->getDate().IsEmpty())
       strLabel = g_localizeStrings.Get(20113);
     else
-      strLabel.Format(g_localizeStrings.Get(20112), profile->getDate());
+      strLabel = StringUtils::Format(g_localizeStrings.Get(20112).c_str(), profile->getDate().c_str());
     item->SetLabel2(strLabel);
     item->SetArt("thumb", profile->getThumb());
     if (profile->getThumb().IsEmpty() || profile->getThumb().Equals("-"))
index 462fc75..60aa49d 100644 (file)
@@ -28,6 +28,7 @@
 #ifdef HAS_SYSINFO
 #include "utils/SystemInfo.h"
 #endif
+#include "utils/StringUtils.h"
 #include "storage/MediaManager.h"
 
 #define CONTROL_BT_STORAGE  94
@@ -197,7 +198,6 @@ void CGUIWindowSystemInfo::ResetLabels()
 
 void CGUIWindowSystemInfo::SetControlLabel(int id, const char *format, int label, int info)
 {
-  CStdString tmpStr;
-  tmpStr.Format(format, g_localizeStrings.Get(label).c_str(), g_infoManager.GetLabel(info).c_str());
+  CStdString tmpStr = StringUtils::Format(format, g_localizeStrings.Get(label).c_str(), g_infoManager.GetLabel(info).c_str());
   SET_CONTROL_LABEL(id, tmpStr);
 }
index b41b8ab..0a1ddfa 100644 (file)
@@ -32,6 +32,7 @@
 #include "LangInfo.h"
 #include "utils/log.h"
 #include "utils/SystemInfo.h"
+#include "utils/StringUtils.h"
 #include "addons/AddonManager.h"
 
 using namespace ADDON;
@@ -175,7 +176,7 @@ void CGUIWindowWeather::UpdateLocations()
     }
     else
     {
-      strLabel.Format("AreaCode %i", i);
+      strLabel = StringUtils::Format("AreaCode %i", i);
 
       msg2.SetLabel(strLabel);
       msg2.SetParam1(i);
@@ -281,7 +282,7 @@ void CGUIWindowWeather::SetProperties()
   CStdString day;
   for (int i = 0; i < NUM_DAYS; i++)
   {
-    day.Format("Day%i.", i);
+    day = StringUtils::Format("Day%i.", i);
     SetProperty(day + "Title", g_weatherManager.GetForecast(i).m_day);
     SetProperty(day + "HighTemp", g_weatherManager.GetForecast(i).m_high);
     SetProperty(day + "LowTemp", g_weatherManager.GetForecast(i).m_low);
@@ -313,7 +314,7 @@ void CGUIWindowWeather::ClearProperties()
   CStdString day;
   for (int i = 0; i < NUM_DAYS; i++)
   {
-    day.Format("Day%i.", i);
+    day = StringUtils::Format("Day%i.", i);
     SetProperty(day + "Title", "");
     SetProperty(day + "HighTemp", "");
     SetProperty(day + "LowTemp", "");