diff options
| author | Matthew Parlane <parlane@gmail.com> | 2013-02-23 17:02:58 +1300 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2013-02-23 17:02:58 +1300 |
| commit | c30b8c9eae8a72747bf7da77f40f20b35c3d712a (patch) | |
| tree | 5fbb01b93f8dff848936132b6e2fac964bbac7e4 /Source/Core/Common | |
| parent | 3d480c088fa27c6dcadef40042a0e8deb3093985 (diff) | |
| parent | ba979582e2d0b4961f1087b76eef659856eb23bb (diff) | |
Merge branch 'master' into wii-network
Conflicts:
Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Src/CPUDetect.cpp | 9 | ||||
| -rw-r--r-- | Source/Core/Common/Src/FileUtil.cpp | 24 | ||||
| -rw-r--r-- | Source/Core/Common/Src/FileUtil.h | 8 |
3 files changed, 30 insertions, 11 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 65cd6dbd0b..282929e7b2 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -205,14 +205,7 @@ void CPUInfo::Detect() // Turn the cpu info into a string we can show std::string CPUInfo::Summarize() { - std::string sum; - if (num_cores == 1) - sum = StringFromFormat("%s, %i core", cpu_string, num_cores); - else - { - sum = StringFromFormat("%s, %i cores", cpu_string, num_cores); - if (HTT) sum += StringFromFormat(" (%i logical threads per physical core)", logical_cpu_count); - } + std::string sum(cpu_string); if (bSSE) sum += ", SSE"; if (bSSE2) sum += ", SSE2"; if (bSSE3) sum += ", SSE3"; diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index edb2d9d484..b46b2498fe 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -42,6 +42,7 @@ #endif #include <fstream> +#include <algorithm> #include <sys/stat.h> #ifndef S_ISDIR @@ -196,8 +197,9 @@ bool CreateFullPath(const std::string &fullPath) // we're done, yay! if (position == fullPath.npos) return true; - - std::string subPath = fullPath.substr(0, position); + + // Include the '/' so the first call is CreateDir("/") rather than CreateDir("") + std::string const subPath(fullPath.substr(0, position + 1)); if (!File::IsDirectory(subPath)) File::CreateDir(subPath); @@ -775,6 +777,24 @@ IOFile::~IOFile() Close(); } +IOFile::IOFile(IOFile&& other) + : m_file(NULL), m_good(true) +{ + Swap(other); +} + +IOFile& IOFile::operator=(IOFile&& other) +{ + IOFile((IOFile&&)other).Swap(*this); + return *this; +} + +void IOFile::Swap(IOFile& other) +{ + std::swap(m_file, other.m_file); + std::swap(m_good, other.m_good); +} + bool IOFile::Open(const std::string& filename, const char openmode[]) { Close(); diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h index 7465c9ee99..2bc55285ed 100644 --- a/Source/Core/Common/Src/FileUtil.h +++ b/Source/Core/Common/Src/FileUtil.h @@ -151,7 +151,7 @@ bool ReadFileToString(bool text_file, const char *filename, std::string &str); // simple wrapper for cstdlib file functions to // hopefully will make error checking easier // and make forgetting an fclose() harder -class IOFile : NonCopyable +class IOFile { public: IOFile(); @@ -159,6 +159,11 @@ public: IOFile(const std::string& filename, const char openmode[]); ~IOFile(); + + IOFile(IOFile&& other); + IOFile& operator=(IOFile&& other); + + void Swap(IOFile& other); bool Open(const std::string& filename, const char openmode[]); bool Close(); @@ -213,6 +218,7 @@ public: void Clear() { m_good = true; std::clearerr(m_file); } private: + IOFile(const IOFile&) /*= delete*/; IOFile& operator=(const IOFile&) /*= delete*/; std::FILE* m_file; |
