From: <man...@us...> - 2013-11-09 10:34:21
|
Revision: 3140 http://sourceforge.net/p/modplug/code/3140 Author: manxorist Date: 2013-11-09 10:34:10 +0000 (Sat, 09 Nov 2013) Log Message: ----------- [Ref] Convert tuning code to mpt::PathString. [Ref] Reduce CString usage in Sndfile.cpp. [Ref] Small cleanup in Vstplug.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/tuningCollection.cpp trunk/OpenMPT/soundlib/tuningbase.cpp trunk/OpenMPT/soundlib/tuningbase.h trunk/OpenMPT/soundlib/tuningcollection.h Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2013-11-08 22:56:21 UTC (rev 3139) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2013-11-09 10:34:10 UTC (rev 3140) @@ -249,7 +249,7 @@ m_EditTuningCollectionVersion.SetWindowText(m_pActiveTuningCollection->GetVersionString().c_str()); m_EditTuningCollectionEditMask.SetWindowText(m_pActiveTuningCollection->GetEditMaskString().c_str()); m_EditTuningCollectionItemNum.SetWindowText(Stringify(m_pActiveTuningCollection->GetNumTunings()).c_str()); - m_EditTuningCollectionPath.SetWindowText(m_pActiveTuningCollection->GetSaveFilePath().c_str()); + m_EditTuningCollectionPath.SetWindowText(m_pActiveTuningCollection->GetSaveFilePath().ToCString()); } //<-- Updating tuning collection part @@ -770,7 +770,7 @@ // a separate collection - no possibility to // directly replace some collection. CTuningCollection* pNewTCol = new CTuningCollection; - pNewTCol->SetSavefilePath(files[counter].ToLocale()); + pNewTCol->SetSavefilePath(files[counter]); if (pNewTCol->Deserialize()) { delete pNewTCol; pNewTCol = 0; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-11-08 22:56:21 UTC (rev 3139) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-11-09 10:34:10 UTC (rev 3140) @@ -1606,7 +1606,7 @@ mpt::String::SetNullTerminator(rawname); FileDialog dlg = SaveFileDialog() - .DefaultExtension(mpt::PathString::FromUTF8("fxb")) + .DefaultExtension("fxb") .DefaultFilename(rawname) .ExtensionFilter("VST Plugin Programs (*.fxp)|*.fxp|" "VST Plugin Banks (*.fxb)|*.fxb||") Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-11-08 22:56:21 UTC (rev 3139) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-11-09 10:34:10 UTC (rev 3140) @@ -886,12 +886,14 @@ } if (Reporting::Confirm(notFoundText.c_str(), "OpenMPT - Plugins missing", false, true) == cnfYes) { - CString sUrl = "http://resources.openmpt.org/plugins/search.php?p="; + std::string sUrl = "http://resources.openmpt.org/plugins/search.php?p="; for(std::vector<PLUGINDEX>::iterator i = notFoundIDs.begin(); i != notFoundIDs.end(); ++i) { - sUrl.AppendFormat("%08X%s%%0a", LittleEndian(m_MixPlugins[*i].Info.dwPluginId2), m_MixPlugins[*i].GetLibraryName()); + sUrl += mpt::String::Format("%08X", LittleEndian(m_MixPlugins[*i].Info.dwPluginId2)); + sUrl += mpt::String::Convert(m_MixPlugins[*i].GetLibraryName(), mpt::CharsetLocale, mpt::CharsetUTF8); + sUrl += "%0a"; } - CTrackApp::OpenURL(mpt::PathString::FromCString(sUrl)); + CTrackApp::OpenURL(mpt::PathString::FromUTF8(sUrl)); } } #endif // NO_VST @@ -1721,11 +1723,11 @@ } // Load local tunings. - s_pTuningsSharedLocal->SetSavefilePath(( + s_pTuningsSharedLocal->SetSavefilePath( TrackerDirectories::Instance().GetDefaultDirectory(DIR_TUNING) + mpt::PathString::FromUTF8("local_tunings") - + mpt::PathString::FromLocale(CTuningCollection::s_FileExtension) - ).ToLocale()); + + mpt::PathString::FromUTF8(CTuningCollection::s_FileExtension) + ); s_pTuningsSharedLocal->Deserialize(); // Enabling adding/removing of tunings for standard collection Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-11-08 22:56:21 UTC (rev 3139) +++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-11-09 10:34:10 UTC (rev 3140) @@ -27,7 +27,7 @@ -Handle const-status better(e.g. status check in unserialization) */ -const CHAR CTuningCollection::s_FileExtension[4] = ".tc"; +const char CTuningCollection::s_FileExtension[4] = ".tc"; namespace CTuningS11n { @@ -122,9 +122,9 @@ CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::Serialize() const //------------------------------------------------------------------------------- { - if(m_SavefilePath.length() < 1) + if(m_SavefilePath.empty()) return SERIALIZATION_FAILURE; - mpt::ofstream fout(m_SavefilePath.c_str(), std::ios::binary); + mpt::ofstream fout(m_SavefilePath.AsNative().c_str(), std::ios::binary); if(!fout.good()) return SERIALIZATION_FAILURE; @@ -137,9 +137,9 @@ CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::Deserialize() //--------------------------------------------------------------------------- { - if(m_SavefilePath.length() < 1) + if(m_SavefilePath.empty() < 1) return SERIALIZATION_FAILURE; - mpt::ifstream fin(m_SavefilePath.c_str(), std::ios::binary); + mpt::ifstream fin(m_SavefilePath.AsNative().c_str(), std::ios::binary); if(!fin.good()) return SERIALIZATION_FAILURE; Modified: trunk/OpenMPT/soundlib/tuningbase.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningbase.cpp 2013-11-08 22:56:21 UTC (rev 3139) +++ trunk/OpenMPT/soundlib/tuningbase.cpp 2013-11-09 10:34:10 UTC (rev 3140) @@ -48,7 +48,7 @@ const CTuningBase::SERIALIZATION_RETURN_TYPE CTuningBase::SERIALIZATION_FAILURE = true; -const CHAR CTuningBase::s_FileExtension[5] = ".tun"; +const char CTuningBase::s_FileExtension[5] = ".tun"; const CTuningBase::EDITMASK CTuningBase::EM_RATIOS = 1; //1b Modified: trunk/OpenMPT/soundlib/tuningbase.h =================================================================== --- trunk/OpenMPT/soundlib/tuningbase.h 2013-11-08 22:56:21 UTC (rev 3139) +++ trunk/OpenMPT/soundlib/tuningbase.h 2013-11-09 10:34:10 UTC (rev 3140) @@ -69,7 +69,7 @@ static const SERIALIZATION_RETURN_TYPE SERIALIZATION_SUCCESS; static const SERIALIZATION_RETURN_TYPE SERIALIZATION_FAILURE; - static const CHAR s_FileExtension[5]; + static const char s_FileExtension[5]; static const EDITMASK EM_RATIOS; static const EDITMASK EM_NOTENAME; Modified: trunk/OpenMPT/soundlib/tuningcollection.h =================================================================== --- trunk/OpenMPT/soundlib/tuningcollection.h 2013-11-08 22:56:21 UTC (rev 3139) +++ trunk/OpenMPT/soundlib/tuningcollection.h 2013-11-09 10:34:10 UTC (rev 3140) @@ -59,7 +59,7 @@ SERIALIZATION_FAILURE = true }; - static const CHAR s_FileExtension[4]; + static const char s_FileExtension[4]; static const size_t s_nMaxTuningCount = 255; //END PUBLIC STATIC CONSTS @@ -94,8 +94,8 @@ const std::string& GetName() const {return m_Name;} - void SetSavefilePath(const std::string &psz) {m_SavefilePath = psz;} - const std::string& GetSaveFilePath() const {return m_SavefilePath;} + void SetSavefilePath(const mpt::PathString &psz) {m_SavefilePath = psz;} + const mpt::PathString& GetSaveFilePath() const {return m_SavefilePath;} std::string GetVersionString() const {return Stringify(static_cast<int>(s_SerializationVersion));} @@ -124,7 +124,7 @@ //BEGIN: NONSERIALIZABLE DATA MEMBERS TUNINGVECTOR m_DeletedTunings; //See Remove()-method for explanation of this. - std::string m_SavefilePath; + mpt::PathString m_SavefilePath; //END: NONSERIALIZABLE DATA MEMBERS //END: DATA MEMBERS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |