From: <man...@us...> - 2014-09-28 09:11:31
|
Revision: 4318 http://sourceforge.net/p/modplug/code/4318 Author: manxorist Date: 2014-09-28 09:11:17 +0000 (Sun, 28 Sep 2014) Log Message: ----------- [Ref] Convert the last 5 usage sites of mpt::String::Format to typesafe mpt::String::Print. Modified Paths: -------------- trunk/OpenMPT/mptrack/MIDIMapping.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Modified: trunk/OpenMPT/mptrack/MIDIMapping.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMapping.cpp 2014-09-28 08:55:05 UTC (rev 4317) +++ trunk/OpenMPT/mptrack/MIDIMapping.cpp 2014-09-28 09:11:17 UTC (rev 4318) @@ -25,7 +25,7 @@ if(m_Active) flags[0] = '1'; if(m_CaptureMIDI) flags[1] = '1'; if(m_AllowPatternEdit) flags[2] = '1'; - return mpt::String::Format("%s:%d:%x:%d:%d:%d", flags, (int)GetChannel(), (int)GetEvent(), (int)GetController(), (int)m_PluginIndex, m_Parameter); + return mpt::String::Print("%1:%2:%3:%4:%5:%6", flags, (int)GetChannel(), mpt::fmt::hex((int)GetEvent()), (int)GetController(), (int)m_PluginIndex, m_Parameter); } Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-09-28 08:55:05 UTC (rev 4317) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-09-28 09:11:17 UTC (rev 4318) @@ -257,7 +257,7 @@ GetDefaultColourScheme(rgbCustomColors); for(int ncol = 0; ncol < MAX_MODCOLORS; ncol++) { - const std::string colorName = mpt::String::Format("Color%02d", ncol); + const std::string colorName = mpt::String::Print("Color%1", mpt::fmt::dec0<2>(ncol)); rgbCustomColors[ncol] = conf.Read<uint32>("Display", colorName, rgbCustomColors[ncol]); } // AutoSave @@ -343,11 +343,11 @@ theApp.GetDefaultMidiMacro(macros); for(int isfx = 0; isfx < 16; isfx++) { - mpt::String::Copy(macros.szMidiSFXExt[isfx], conf.Read<std::string>("Zxx Macros", mpt::String::Format("SF%X", isfx), macros.szMidiSFXExt[isfx])); + mpt::String::Copy(macros.szMidiSFXExt[isfx], conf.Read<std::string>("Zxx Macros", mpt::String::Print("SF%1", mpt::fmt::HEX(isfx)), macros.szMidiSFXExt[isfx])); } for(int izxx = 0; izxx < 128; izxx++) { - mpt::String::Copy(macros.szMidiZXXExt[izxx], conf.Read<std::string>("Zxx Macros", mpt::String::Format("Z%02X", izxx | 0x80), macros.szMidiZXXExt[izxx])); + mpt::String::Copy(macros.szMidiZXXExt[izxx], conf.Read<std::string>("Zxx Macros", mpt::String::Print("Z%1", mpt::fmt::HEX0<2>(izxx | 0x80)), macros.szMidiZXXExt[izxx])); } @@ -847,7 +847,7 @@ // Display (Colors) for(int ncol = 0; ncol < MAX_MODCOLORS; ncol++) { - conf.Write<uint32>("Display", mpt::String::Format("Color%02d", ncol), rgbCustomColors[ncol]); + conf.Write<uint32>("Display", mpt::String::Print("Color%1", mpt::fmt::dec0<2>(ncol)), rgbCustomColors[ncol]); } // AutoSave @@ -889,11 +889,11 @@ theApp.GetDefaultMidiMacro(macros); for(int isfx = 0; isfx < 16; isfx++) { - conf.Write<std::string>("Zxx Macros", mpt::String::Format("SF%X", isfx), macros.szMidiSFXExt[isfx]); + conf.Write<std::string>("Zxx Macros", mpt::String::Print("SF%1", mpt::fmt::HEX(isfx)), macros.szMidiSFXExt[isfx]); } for(int izxx = 0; izxx < 128; izxx++) { - conf.Write<std::string>("Zxx Macros", mpt::String::Format("Z%02X", izxx | 0x80), macros.szMidiZXXExt[izxx]); + conf.Write<std::string>("Zxx Macros", mpt::String::Print("Z%1", mpt::fmt::HEX0<2>(izxx | 0x80)), macros.szMidiZXXExt[izxx]); } // MRU list Modified: trunk/OpenMPT/soundlib/plugins/PluginManager.cpp =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2014-09-28 08:55:05 UTC (rev 4317) +++ trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2014-09-28 09:11:17 UTC (rev 4318) @@ -69,7 +69,7 @@ const std::string libName = libraryName.ToUTF8(); const uint32 crc = crc32(0, reinterpret_cast<const Bytef *>(&libName[0]), libName.length()); - const std::string IDs = mpt::String::Format("%08X%08X%08X", SwapBytesReturnLE(pluginId1), SwapBytesReturnLE(pluginId2), SwapBytesReturnLE(crc)); + const std::string IDs = mpt::fmt::HEX0<8>(SwapBytesReturnLE(pluginId1)) + mpt::fmt::HEX0<8>(SwapBytesReturnLE(pluginId2)) + mpt::fmt::HEX0<8>(SwapBytesReturnLE(crc)); const std::string flagsKey = IDs + ".Flags"; mpt::PathString writePath = dllPath; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |