From: <man...@us...> - 2013-05-21 23:01:06
|
Revision: 2168 http://sourceforge.net/p/modplug/code/2168 Author: manxorist Date: 2013-05-21 23:01:00 +0000 (Tue, 21 May 2013) Log Message: ----------- [Ref] Remove all usages of win32 specific wsprintf in soundlib/ and common/. For non-plugin builds, libopenmpt does not need to link against user32.dll anymore. Modified Paths: -------------- trunk/OpenMPT/common/Profiler.cpp trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/load_j2b.cpp Modified: trunk/OpenMPT/common/Profiler.cpp =================================================================== --- trunk/OpenMPT/common/Profiler.cpp 2013-05-21 22:56:04 UTC (rev 2167) +++ trunk/OpenMPT/common/Profiler.cpp 2013-05-21 23:01:00 UTC (rev 2168) @@ -110,9 +110,7 @@ case Profiler::Audio: cat = "Audio"; break; case Profiler::Notify: cat = "Notify"; break; } - char dummy[128]; - sprintf(dummy, "%6.3f", (stats.usage * 100.0)); - ret += cat + " " + std::string(stats.profile.Name) + ": " + std::string(dummy) + "%\r\n"; + ret += cat + " " + std::string(stats.profile.Name) + ": " + mpt::String::Format("%6.3f", (stats.usage * 100.0)) + "%\r\n"; } } ret += "\r\n"; Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2013-05-21 22:56:04 UTC (rev 2167) +++ trunk/OpenMPT/common/serialization_utils.cpp 2013-05-21 23:01:00 UTC (rev 2168) @@ -296,15 +296,13 @@ if ((m_Readlogmask & SNT_PROGRESS) != 0 && m_fpLogFunc) { - TCHAR buffer[256]; - wsprintf(buffer, + m_fpLogFunc( tstrReadProgress, nNum, (pRe && pRe->nIdLength < 30 && m_Idarray.size() > 0) ? IdToString(&m_Idarray[pRe->nIdpos], pRe->nIdLength).c_str() : "", (pRe) ? pRe->rposStart : 0, (pRe && pRe->nSize != invalidDatasize) ? Stringify(pRe->nSize).c_str() : "", ""); - m_fpLogFunc(buffer); } } @@ -318,9 +316,7 @@ { if (nIdSize < 30) { - TCHAR buffer[256]; - wsprintf(buffer, tstrWriteProgress, nEntryNum, IdToString(pId, nIdSize).c_str(), rposStart, nBytecount); - m_fpLogFunc(buffer); + m_fpLogFunc(tstrWriteProgress, nEntryNum, IdToString(pId, nIdSize).c_str(), rposStart, nBytecount); } } } Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-05-21 22:56:04 UTC (rev 2167) +++ trunk/OpenMPT/common/typedefs.h 2013-05-21 23:01:00 UTC (rev 2168) @@ -269,9 +269,6 @@ #define MPT_TEXT(x) x -// wsprintf is just sprintf, but defined in the WINDOWS API -#define wsprintf sprintf - #endif // _WIN32 Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-05-21 22:56:04 UTC (rev 2167) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-05-21 23:01:00 UTC (rev 2168) @@ -1722,7 +1722,7 @@ if ((key >= 24) && (key <= 84)) lstrcpy(s, szMidiPercussionNames[key-24]); if (pDlsIns->szName[0]) { - wsprintf(&s[strlen(s)], " (%s", pDlsIns->szName); + sprintf(&s[strlen(s)], " (%s", pDlsIns->szName); int n = strlen(s); while ((n) && (s[n-1] == ' ')) { Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2013-05-21 22:56:04 UTC (rev 2167) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2013-05-21 23:01:00 UTC (rev 2168) @@ -582,7 +582,6 @@ if(GetNumSequences() <= 1) return false; - char s[256]; SetSequence(0); resize(GetLengthTailTrimmed()); SEQUENCEINDEX removedSequences = 0; // sequence count @@ -602,8 +601,7 @@ const ORDERINDEX nFirstOrder = GetLengthTailTrimmed() + 1; // +1 for separator item if(nFirstOrder + GetSequence(1).GetLengthTailTrimmed() > m_sndFile.GetModSpecifications().ordersMax) { - wsprintf(s, "WARNING: Cannot merge Sequence %d (too long!)", removedSequences); - m_sndFile.AddToLog(s); + m_sndFile.AddToLog(mpt::String::Format("WARNING: Cannot merge Sequence %d (too long!)", removedSequences)); RemoveSequence(1); continue; } @@ -638,8 +636,7 @@ } else { // cannot create new pattern: notify the user - wsprintf(s, "CONFLICT: Pattern break commands in Pattern %d might be broken since it has been used in several sequences!", nPat); - m_sndFile.AddToLog(s); + m_sndFile.AddToLog(mpt::String::Format("CONFLICT: Pattern break commands in Pattern %d might be broken since it has been used in several sequences!", nPat)); } } m->param = static_cast<BYTE>(m->param + nFirstOrder); Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2013-05-21 22:56:04 UTC (rev 2167) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2013-05-21 23:01:00 UTC (rev 2168) @@ -647,9 +647,7 @@ } else { #ifdef DEBUG - CHAR s[64]; - wsprintf(s, "J2B: Unknown command: 0x%X, param 0x%X", m.command, m.param); - Log(s); + Log("J2B: Unknown command: 0x%X, param 0x%X", m.command, m.param); #endif // DEBUG m.command = CMD_NONE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |