From 4759510f70c0b9b66ff4846790f1f78a80301caa Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 9 Aug 2014 22:44:27 -0400 Subject: [PATCH] Get rid of instances of "using namespace std;" in the project --- Source/Core/AudioCommon/aldlist.cpp | 2 +- Source/Core/AudioCommon/aldlist.h | 16 +++++++-------- Source/Core/Common/ExtendedTrace.cpp | 1 - Source/Core/Core/FifoPlayer/FifoDataFile.cpp | 1 - .../Core/FifoPlayer/FifoPlaybackAnalyzer.cpp | 5 ++--- Source/Core/Core/FifoPlayer/FifoRecorder.cpp | 2 -- .../Core/Core/PowerPC/JitCommon/JitCache.cpp | 20 ++++++++++--------- Source/Core/Core/PowerPC/PPCAnalyst.cpp | 8 +++----- Source/Core/DolphinWX/FifoPlayerDlg.cpp | 4 +--- 9 files changed, 25 insertions(+), 34 deletions(-) diff --git a/Source/Core/AudioCommon/aldlist.cpp b/Source/Core/AudioCommon/aldlist.cpp index 6e506d57c2..a849aeba68 100644 --- a/Source/Core/AudioCommon/aldlist.cpp +++ b/Source/Core/AudioCommon/aldlist.cpp @@ -86,7 +86,7 @@ ALDeviceList::ALDeviceList() alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(s32), &ALDeviceInfo.iMajorVersion); alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(s32), &ALDeviceInfo.iMinorVersion); - ALDeviceInfo.pvstrExtensions = new vector; + ALDeviceInfo.pvstrExtensions = new std::vector; // Check for ALC Extensions if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) diff --git a/Source/Core/AudioCommon/aldlist.h b/Source/Core/AudioCommon/aldlist.h index fabe435233..c24ce92651 100644 --- a/Source/Core/AudioCommon/aldlist.h +++ b/Source/Core/AudioCommon/aldlist.h @@ -10,22 +10,20 @@ //'255' characters in the browser information" #endif -using namespace std; - typedef struct { - string strDeviceName; - s32 iMajorVersion; - s32 iMinorVersion; - u32 uiSourceCount; - vector* pvstrExtensions; - bool bSelected; + std::string strDeviceName; + s32 iMajorVersion; + s32 iMinorVersion; + u32 uiSourceCount; + std::vector* pvstrExtensions; + bool bSelected; } ALDEVICEINFO, *LPALDEVICEINFO; class ALDeviceList { private: - vector vDeviceInfo; + std::vector vDeviceInfo; s32 defaultDeviceIndex; s32 filterIndex; diff --git a/Source/Core/Common/ExtendedTrace.cpp b/Source/Core/Common/ExtendedTrace.cpp index 8998a70b4b..dfc96e3c59 100644 --- a/Source/Core/Common/ExtendedTrace.cpp +++ b/Source/Core/Common/ExtendedTrace.cpp @@ -19,7 +19,6 @@ #include "Common/ExtendedTrace.h" #include "Common/StringUtil.h" -using namespace std; #include #include diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp index 9ddfe04472..4c39d68639 100644 --- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp +++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp @@ -11,7 +11,6 @@ #include "Core/FifoPlayer/FifoFileStruct.h" using namespace FifoFileStruct; -using namespace std; FifoDataFile::FifoDataFile() : m_Flags(0) diff --git a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp index 3dbd84777b..2090ad34d9 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp @@ -12,7 +12,6 @@ #include "VideoCommon/TextureDecoder.h" #include "VideoCommon/VertexLoader.h" -using namespace std; using namespace FifoAnalyzer; // For debugging @@ -291,10 +290,10 @@ void FifoPlaybackAnalyzer::StoreEfbCopyRegion() void FifoPlaybackAnalyzer::StoreWrittenRegion(u32 address, u32 size) { u32 end = address + size; - vector::iterator newRangeIter = m_WrittenMemory.end(); + auto newRangeIter = m_WrittenMemory.end(); // Search for overlapping memory regions and expand them to include the new region - for (vector::iterator iter = m_WrittenMemory.begin(); iter != m_WrittenMemory.end();) + for (auto iter = m_WrittenMemory.begin(); iter != m_WrittenMemory.end();) { MemoryRange &range = *iter; diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index 140ad218c5..3e52916dd2 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -13,8 +13,6 @@ static FifoRecorder instance; static std::recursive_mutex sMutex; -using namespace std; - FifoRecorder::FifoRecorder() : m_IsRecording(false), m_WasRecording(false), diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index a3723253b5..dbf7b69ff6 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -264,19 +264,19 @@ using namespace Gen; } } - using namespace std; - void JitBaseBlockCache::LinkBlock(int i) { LinkBlockExits(i); JitBlock &b = blocks[i]; - pair::iterator, multimap::iterator> ppp; // equal_range(b) returns pair representing the range // of element with key b - ppp = links_to.equal_range(b.originalAddress); + auto ppp = links_to.equal_range(b.originalAddress); + if (ppp.first == ppp.second) return; - for (multimap::iterator iter = ppp.first; iter != ppp.second; ++iter) { + + for (auto iter = ppp.first; iter != ppp.second; ++iter) + { // PanicAlert("Linking block %i to block %i", iter->second, i); LinkBlockExits(iter->second); } @@ -285,11 +285,13 @@ using namespace Gen; void JitBaseBlockCache::UnlinkBlock(int i) { JitBlock &b = blocks[i]; - pair::iterator, multimap::iterator> ppp; - ppp = links_to.equal_range(b.originalAddress); + auto ppp = links_to.equal_range(b.originalAddress); + if (ppp.first == ppp.second) return; - for (multimap::iterator iter = ppp.first; iter != ppp.second; ++iter) { + + for (auto iter = ppp.first; iter != ppp.second; ++iter) + { JitBlock &sourceBlock = blocks[iter->second]; for (auto& e : sourceBlock.linkData) { @@ -344,7 +346,7 @@ using namespace Gen; // !! this works correctly under assumption that any two overlapping blocks end at the same address if (destroy_block) { - std::map, u32>::iterator it1 = block_map.lower_bound(std::make_pair(pAddr, 0)), it2 = it1; + std::map, u32>::iterator it1 = block_map.lower_bound(std::make_pair(pAddr, 0)), it2 = it1; while (it2 != block_map.end() && it2->first.second < pAddr + length) { JitBlock &b = blocks[it2->second]; diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index a8d6b65927..20efecc362 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -28,10 +28,8 @@ // It is also useful for finding function boundaries so that we can find, fingerprint and detect library functions. // We don't do this much currently. Only for the special case Super Monkey Ball. -namespace PPCAnalyst { - -using namespace std; - +namespace PPCAnalyst +{ static const int CODEBUFFER_SIZE = 32000; // 0 does not perform block merging static const u32 FUNCTION_FOLLOWING_THRESHOLD = 16; @@ -306,7 +304,7 @@ static void FindFunctionsFromBranches(u32 startAddr, u32 endAddr, SymbolDB *func static void FindFunctionsAfterBLR(PPCSymbolDB *func_db) { - vector funcAddrs; + std::vector funcAddrs; for (const auto& func : func_db->Symbols()) funcAddrs.push_back(func.second.address + func.second.size); diff --git a/Source/Core/DolphinWX/FifoPlayerDlg.cpp b/Source/Core/DolphinWX/FifoPlayerDlg.cpp index f8cac00873..b98b3a0b8b 100644 --- a/Source/Core/DolphinWX/FifoPlayerDlg.cpp +++ b/Source/Core/DolphinWX/FifoPlayerDlg.cpp @@ -51,8 +51,6 @@ DEFINE_EVENT_TYPE(RECORDING_FINISHED_EVENT) DECLARE_EVENT_TYPE(FRAME_WRITTEN_EVENT, -1) DEFINE_EVENT_TYPE(FRAME_WRITTEN_EVENT) -using namespace std; - static std::recursive_mutex sMutex; wxEvtHandler *volatile FifoPlayerDlg::m_EvtHandler = nullptr; @@ -955,7 +953,7 @@ wxString FifoPlayerDlg::CreateRecordingMemSizeLabel() const size_t memBytes = 0; for (size_t frameNum = 0; frameNum < file->GetFrameCount(); ++frameNum) { - const vector& memUpdates = file->GetFrame(frameNum).memoryUpdates; + const std::vector& memUpdates = file->GetFrame(frameNum).memoryUpdates; for (auto& memUpdate : memUpdates) memBytes += memUpdate.size; }