diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-06-05 18:24:10 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-06-05 18:50:14 -0400 |
| commit | 3843848ed4f506aa9dcd1784942edb5f677f2c5f (patch) | |
| tree | c3ac1c2f98659839d9b93cff05744c3906bb366e /Source/Core/Common/LogManager.cpp | |
| parent | 3a06907653ba037e1ca1a7ca6d0342bf2b18476b (diff) | |
Use std::string in LogContainer's constructor.
This allows for removal of the strcpy calls, also it's technically way more safe, though I doubt we'll ever have a log name larger than 128 characters or a short description larger than 32 characters.
Also moved these assignments into the constructor's initializer list.
Diffstat (limited to 'Source/Core/Common/LogManager.cpp')
| -rw-r--r-- | Source/Core/Common/LogManager.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/Common/LogManager.cpp b/Source/Core/Common/LogManager.cpp index bc4f9300c6..89bfe254bb 100644 --- a/Source/Core/Common/LogManager.cpp +++ b/Source/Core/Common/LogManager.cpp @@ -82,7 +82,7 @@ LogManager::LogManager() m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager"); m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay"); - m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); + m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX)); m_consoleLog = new ConsoleListener(); m_debuggerLog = new DebuggerLogListener(); @@ -130,7 +130,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, Common::Timer::GetTimeFormatted().c_str(), file, line, LogTypes::LOG_LEVEL_TO_CHAR[(int)level], - log->GetShortName(), temp); + log->GetShortName().c_str(), temp); #ifdef ANDROID Host_SysMessage(msg.c_str()); #endif @@ -148,12 +148,12 @@ void LogManager::Shutdown() m_logManager = nullptr; } -LogContainer::LogContainer(const char* shortName, const char* fullName, bool enable) - : m_enable(enable) +LogContainer::LogContainer(const std::string& shortName, const std::string& fullName, bool enable) + : m_fullName(fullName), + m_shortName(shortName), + m_enable(enable), + m_level(LogTypes::LWARNING) { - strncpy(m_fullName, fullName, 128); - strncpy(m_shortName, shortName, 32); - m_level = LogTypes::LWARNING; } // LogContainer @@ -179,7 +179,7 @@ void LogContainer::Trigger(LogTypes::LOG_LEVELS level, const char *msg) } } -FileLogListener::FileLogListener(const char *filename) +FileLogListener::FileLogListener(const std::string& filename) { OpenFStream(m_logfile, filename, std::ios::app); SetEnable(true); |
