From: <man...@us...> - 2015-02-08 14:06:48
|
Revision: 4744 http://sourceforge.net/p/modplug/code/4744 Author: manxorist Date: 2015-02-08 14:06:34 +0000 (Sun, 08 Feb 2015) Log Message: ----------- [Ref] Replace all usage of <iterator> and std::back_inserter with simpler constructs. Modified Paths: -------------- trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/mptrack/Settings.cpp trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDeviceThread.cpp trunk/OpenMPT/soundlib/Load_ams.cpp Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2015-02-02 13:40:54 UTC (rev 4743) +++ trunk/OpenMPT/common/mptString.cpp 2015-02-08 14:06:34 UTC (rev 4744) @@ -17,7 +17,6 @@ #include <cstdlib> #endif #include <iomanip> -#include <iterator> #include <locale> #include <sstream> #include <string> @@ -770,9 +769,7 @@ std::string out; if(charset == CharsetCP437AMS ) out = String::To8bit(src, CharsetTableCP437AMS ); if(charset == CharsetCP437AMS2) out = String::To8bit(src, CharsetTableCP437AMS2); - Tdststring result; - std::copy(out.begin(), out.end(), std::back_inserter(result)); - return result; + return Tdststring(out.begin(), out.end()); } #if defined(MPT_WITH_CHARSET_LOCALE) #if defined(MPT_LOCALE_ASSUME_CHARSET) @@ -845,9 +842,7 @@ case CharsetCP437AMS2: out = String::To8bit(src, CharsetTableCP437AMS2); break; case CharsetWindows1252: out = String::To8bit(src, CharsetTableWindows1252); break; } - Tdststring result; - std::copy(out.begin(), out.end(), std::back_inserter(result)); - return result; + return Tdststring(out.begin(), out.end()); #endif } @@ -859,8 +854,7 @@ STATIC_ASSERT(sizeof(typename Tsrcstring::value_type) == sizeof(char)); if(charset == CharsetCP437AMS || charset == CharsetCP437AMS2) { - std::string in; - std::copy(src.begin(), src.end(), std::back_inserter(in)); + std::string in(src.begin(), src.end()); std::wstring out; if(charset == CharsetCP437AMS ) out = String::From8bit(in, CharsetTableCP437AMS ); if(charset == CharsetCP437AMS2) out = String::From8bit(in, CharsetTableCP437AMS2); @@ -926,8 +920,7 @@ conv = iconv_t(); return &wide_string[0]; #else - std::string in; - std::copy(src.begin(), src.end(), std::back_inserter(in)); + std::string in(src.begin(), src.end()); std::wstring out; switch(charset) { Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2015-02-02 13:40:54 UTC (rev 4743) +++ trunk/OpenMPT/common/serialization_utils.cpp 2015-02-08 14:06:34 UTC (rev 4744) @@ -13,7 +13,6 @@ #include "serialization_utils.h" #include <istream> -#include <iterator> // for back_inserter #include <ostream> #include <sstream> Modified: trunk/OpenMPT/mptrack/Settings.cpp =================================================================== --- trunk/OpenMPT/mptrack/Settings.cpp 2015-02-02 13:40:54 UTC (rev 4743) +++ trunk/OpenMPT/mptrack/Settings.cpp 2015-02-08 14:06:34 UTC (rev 4744) @@ -20,7 +20,6 @@ #include <algorithm> #include "../common/mptFileIO.h" -#include <iterator> OPENMPT_NAMESPACE_BEGIN @@ -402,7 +401,7 @@ char buf[4096]; s.read(buf, 4096); std::streamsize count = s.gcount(); - std::copy(buf, buf + count, std::back_inserter(result)); + result.insert(result.end(), buf, buf + count); } return result; } Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2015-02-02 13:40:54 UTC (rev 4743) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2015-02-08 14:06:34 UTC (rev 4744) @@ -22,7 +22,6 @@ #include "SoundDeviceWaveout.h" #include <algorithm> -#include <iterator> #include <mmreg.h> @@ -484,25 +483,25 @@ if(enabledTypes[SoundDevice::TypeWAVEOUT]) { const std::vector<SoundDevice::Info> infos = CWaveDevice::EnumerateDevices(); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } #ifndef NO_ASIO if(enabledTypes[SoundDevice::TypeASIO]) { const std::vector<SoundDevice::Info> infos = CASIODevice::EnumerateDevices(); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } #endif // NO_ASIO #ifndef NO_PORTAUDIO if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_WASAPI]) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_WASAPI); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_WDMKS]) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_WDMKS); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } #endif // NO_PORTAUDIO @@ -511,7 +510,7 @@ if(enabledTypes[SoundDevice::TypeDSOUND]) { const std::vector<SoundDevice::Info> infos = CDSoundDevice::EnumerateDevices(); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } #endif // NO_DSOUND @@ -520,17 +519,17 @@ if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_WMME]) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_WMME); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_ASIO]) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_ASIO); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_DS]) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_DS); - std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); + m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } #endif // NO_PORTAUDIO Modified: trunk/OpenMPT/sounddev/SoundDeviceThread.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceThread.cpp 2015-02-02 13:40:54 UTC (rev 4743) +++ trunk/OpenMPT/sounddev/SoundDeviceThread.cpp 2015-02-08 14:06:34 UTC (rev 4744) @@ -17,7 +17,6 @@ #include "../common/misc_util.h" #include <algorithm> -#include <iterator> #include <mmsystem.h> Modified: trunk/OpenMPT/soundlib/Load_ams.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ams.cpp 2015-02-02 13:40:54 UTC (rev 4743) +++ trunk/OpenMPT/soundlib/Load_ams.cpp 2015-02-08 14:06:34 UTC (rev 4744) @@ -18,9 +18,7 @@ #include "stdafx.h" #include "Loaders.h" -#include <iterator> - OPENMPT_NAMESPACE_BEGIN @@ -467,8 +465,7 @@ } } - std::string str; - std::copy(textOut.begin(), textOut.end(), std::back_inserter(str)); + std::string str(textOut.begin(), textOut.end()); str = mpt::ToCharset(mpt::CharsetCP437, mpt::CharsetCP437AMS, str); // Packed text doesn't include any line breaks! @@ -936,8 +933,7 @@ textOut[writeLen++] = c; } } - std::string str; - std::copy(textOut.begin(), textOut.begin() + descriptionHeader.unpackedLen, std::back_inserter(str)); + std::string str(textOut.begin(), textOut.begin() + descriptionHeader.unpackedLen); str = mpt::ToCharset(mpt::CharsetCP437, mpt::CharsetCP437AMS2, str); // Packed text doesn't include any line breaks! songMessage.ReadFixedLineLength(str.c_str(), str.length(), 74, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |