From: <man...@us...> - 2015-03-11 12:28:48
|
Revision: 4859 http://sourceforge.net/p/modplug/code/4859 Author: manxorist Date: 2015-03-11 12:28:42 +0000 (Wed, 11 Mar 2015) Log Message: ----------- [Ref] Replace a couple of Stringify with mpt::ToString. [Ref] Do not provide Stringify macro for libopenmpt anymore. It's only still used in tracker code now. Modified Paths: -------------- trunk/OpenMPT/common/mptString.h trunk/OpenMPT/mptrack/Settings.cpp trunk/OpenMPT/soundlib/tuning.cpp trunk/OpenMPT/soundlib/tuningbase.cpp trunk/OpenMPT/soundlib/tuningcollection.h trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/common/mptString.h =================================================================== --- trunk/OpenMPT/common/mptString.h 2015-03-11 12:26:01 UTC (rev 4858) +++ trunk/OpenMPT/common/mptString.h 2015-03-11 12:28:42 UTC (rev 4859) @@ -929,10 +929,12 @@ } // namespace mpt +#ifdef MODPLUG_TRACKER #define Stringify(x) mpt::ToString(x) #if MPT_WSTRING_FORMAT #define StringifyW(x) mpt::ToWString(x) #endif +#endif namespace mpt { namespace String { Modified: trunk/OpenMPT/mptrack/Settings.cpp =================================================================== --- trunk/OpenMPT/mptrack/Settings.cpp 2015-03-11 12:26:01 UTC (rev 4858) +++ trunk/OpenMPT/mptrack/Settings.cpp 2015-03-11 12:28:42 UTC (rev 4859) @@ -315,7 +315,7 @@ double IniFileSettingsBackend::ReadSettingRaw(const SettingPath &path, double def) const { std::vector<WCHAR> buf(128); - while(::GetPrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), StringifyW(def).c_str(), &buf[0], static_cast<DWORD>(buf.size()), filename.AsNative().c_str()) == buf.size() - 1) + while(::GetPrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), mpt::ToWString(def).c_str(), &buf[0], static_cast<DWORD>(buf.size()), filename.AsNative().c_str()) == buf.size() - 1) { if(buf.size() == std::numeric_limits<DWORD>::max()) { @@ -363,17 +363,17 @@ void IniFileSettingsBackend::WriteSettingRaw(const SettingPath &path, double val) { - ::WritePrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), StringifyW(val).c_str(), filename.AsNative().c_str()); + ::WritePrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), mpt::ToWString(val).c_str(), filename.AsNative().c_str()); } void IniFileSettingsBackend::WriteSettingRaw(const SettingPath &path, int32 val) { - ::WritePrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), StringifyW(val).c_str(), filename.AsNative().c_str()); + ::WritePrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), mpt::ToWString(val).c_str(), filename.AsNative().c_str()); } void IniFileSettingsBackend::WriteSettingRaw(const SettingPath &path, bool val) { - ::WritePrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), StringifyW(val).c_str(), filename.AsNative().c_str()); + ::WritePrivateProfileStringW(GetSection(path).c_str(), GetKey(path).c_str(), mpt::ToWString(val).c_str(), filename.AsNative().c_str()); } void IniFileSettingsBackend::RemoveSettingRaw(const SettingPath &path) Modified: trunk/OpenMPT/soundlib/tuning.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuning.cpp 2015-03-11 12:26:01 UTC (rev 4858) +++ trunk/OpenMPT/soundlib/tuning.cpp 2015-03-11 12:28:42 UTC (rev 4859) @@ -165,7 +165,7 @@ if(nmi != m_NoteNameMap.end()) { rValue = nmi->second; - (x >= 0) ? rValue += Stringify(middlePeriodNumber + x/m_GroupSize) : rValue += Stringify(middlePeriodNumber + (x+1)/m_GroupSize - 1); + (x >= 0) ? rValue += mpt::ToString(middlePeriodNumber + x/m_GroupSize) : rValue += mpt::ToString(middlePeriodNumber + (x+1)/m_GroupSize - 1); } else { @@ -176,7 +176,7 @@ rValue += ":"; - (x >= 0) ? rValue += Stringify(middlePeriodNumber + x/m_GroupSize) : rValue += Stringify(middlePeriodNumber + (x+1)/m_GroupSize - 1); + (x >= 0) ? rValue += mpt::ToString(middlePeriodNumber + x/m_GroupSize) : rValue += mpt::ToString(middlePeriodNumber + (x+1)/m_GroupSize - 1); } return rValue; } Modified: trunk/OpenMPT/soundlib/tuningbase.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningbase.cpp 2015-03-11 12:26:01 UTC (rev 4858) +++ trunk/OpenMPT/soundlib/tuningbase.cpp 2015-03-11 12:28:42 UTC (rev 4859) @@ -198,7 +198,7 @@ if(i != m_NoteNameMap.end()) return i->second; else - return Stringify(x); + return mpt::ToString(x); } Modified: trunk/OpenMPT/soundlib/tuningcollection.h =================================================================== --- trunk/OpenMPT/soundlib/tuningcollection.h 2015-03-11 12:26:01 UTC (rev 4858) +++ trunk/OpenMPT/soundlib/tuningcollection.h 2015-03-11 12:28:42 UTC (rev 4859) @@ -104,7 +104,7 @@ mpt::PathString GetSaveFilePath() const {return m_SavefilePath;} #endif // MODPLUG_NO_FILESAVE - std::string GetVersionString() const {return Stringify(static_cast<int>(s_SerializationVersion));} + std::string GetVersionString() const {return mpt::ToString(static_cast<int>(s_SerializationVersion));} size_t GetNameLengthMax() const {return 256;} Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2015-03-11 12:26:01 UTC (rev 4858) +++ trunk/OpenMPT/test/test.cpp 2015-03-11 12:28:42 UTC (rev 4859) @@ -396,15 +396,15 @@ //----------------------------------------- { - VERIFY_EQUAL(Stringify(1.5f), "1.5"); - VERIFY_EQUAL(Stringify(true), "1"); - VERIFY_EQUAL(Stringify(false), "0"); - //VERIFY_EQUAL(Stringify('A'), "A"); // deprecated - //VERIFY_EQUAL(Stringify(L'A'), "A"); // deprecated + VERIFY_EQUAL(mpt::ToString(1.5f), "1.5"); + VERIFY_EQUAL(mpt::ToString(true), "1"); + VERIFY_EQUAL(mpt::ToString(false), "0"); + //VERIFY_EQUAL(mpt::ToString('A'), "A"); // deprecated + //VERIFY_EQUAL(mpt::ToString(L'A'), "A"); // deprecated - VERIFY_EQUAL(Stringify(0), "0"); - VERIFY_EQUAL(Stringify(-23), "-23"); - VERIFY_EQUAL(Stringify(42), "42"); + VERIFY_EQUAL(mpt::ToString(0), "0"); + VERIFY_EQUAL(mpt::ToString(-23), "-23"); + VERIFY_EQUAL(mpt::ToString(42), "42"); VERIFY_EQUAL(mpt::fmt::hex<3>((int32)-1), "ffffffff"); VERIFY_EQUAL(mpt::fmt::hex(0x123e), "123e"); @@ -418,15 +418,15 @@ VERIFY_EQUAL(mpt::wfmt::hex0<2>(0x123e), L"123e"); #endif - VERIFY_EQUAL(Stringify(-87.0f), "-87"); - if(Stringify(-0.5e-6) != "-5e-007" - && Stringify(-0.5e-6) != "-5e-07" - && Stringify(-0.5e-6) != "-5e-7" + VERIFY_EQUAL(mpt::ToString(-87.0f), "-87"); + if(mpt::ToString(-0.5e-6) != "-5e-007" + && mpt::ToString(-0.5e-6) != "-5e-07" + && mpt::ToString(-0.5e-6) != "-5e-7" ) { VERIFY_EQUAL(true, false); } - VERIFY_EQUAL(Stringify(58.65403492763), "58.654"); + VERIFY_EQUAL(mpt::ToString(58.65403492763), "58.654"); VERIFY_EQUAL(mpt::Format("%3.1f").ToString(23.42), "23.4"); VERIFY_EQUAL(ConvertStrTo<uint32>("586"), 586u); @@ -445,8 +445,8 @@ VERIFY_EQUAL(ConvertStrTo<double>("-0.5e-6"), -0.5e-6); VERIFY_EQUAL(ConvertStrTo<double>("58.65403492763"), 58.65403492763); - VERIFY_EQUAL(ConvertStrTo<float>(Stringify(-87.0)), -87.0); - VERIFY_EQUAL(ConvertStrTo<double>(Stringify(-0.5e-6)), -0.5e-6); + VERIFY_EQUAL(ConvertStrTo<float>(mpt::ToString(-87.0)), -87.0); + VERIFY_EQUAL(ConvertStrTo<double>(mpt::ToString(-0.5e-6)), -0.5e-6); TestFloatFormats(0.0f); TestFloatFormats(1.0f); @@ -922,7 +922,7 @@ template <> inline SettingValue ToSettingValue(const Test::CustomSettingsTestType &val) { - return SettingValue(Stringify(val.x) + "|" + Stringify(val.y), "myType"); + return SettingValue(mpt::ToString(val.x) + "|" + mpt::ToString(val.y), "myType"); } namespace Test { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |