summaryrefslogtreecommitdiffstats
path: root/lib/Utils/DebugDump.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-05 17:45:16 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-05 17:45:16 +0100
commit1b6f4595b116e60f267e416459b9102f0d1387b9 (patch)
tree81750f11832c4f6768fd0256139a0daa5ef17439 /lib/Utils/DebugDump.cpp
parent64c5d35aebc38f93ce5c086c15c15de5acb21b2f (diff)
downloadabrt-1b6f4595b116e60f267e416459b9102f0d1387b9.tar.gz
abrt-1b6f4595b116e60f267e416459b9102f0d1387b9.tar.xz
abrt-1b6f4595b116e60f267e416459b9102f0d1387b9.zip
const string& -> const char* conversion
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/DebugDump.cpp')
-rw-r--r--lib/Utils/DebugDump.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index ec9e4703..b908acc6 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -39,7 +39,14 @@ static bool isdigit_str(const char *str)
return true;
}
-static std::string RemoveBackSlashes(const std::string& pDir);
+static std::string RemoveBackSlashes(const char *pDir)
+{
+ unsigned len = strlen(pDir);
+ while (len != 0 && pDir[len-1] == '/')
+ len--;
+ return std::string(pDir, len);
+}
+
static bool ExistFileDir(const char* pPath);
static void LoadTextFile(const std::string& pPath, std::string& pData);
@@ -56,10 +63,10 @@ void CDebugDump::Open(const std::string& pDir)
{
throw CABRTException(EXCEP_ERROR, "CDebugDump::CDebugDump(): DebugDump is already opened.");
}
- m_sDebugDumpDir = RemoveBackSlashes(pDir);
+ m_sDebugDumpDir = RemoveBackSlashes(pDir.c_str());
if (!ExistFileDir(m_sDebugDumpDir.c_str()))
{
- throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+m_sDebugDumpDir+" does not exist.");
+ throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): " + m_sDebugDumpDir + " does not exist.");
}
Lock();
m_bOpened = true;
@@ -215,7 +222,7 @@ void CDebugDump::Create(const std::string& pDir, int64_t uid)
throw CABRTException(EXCEP_ERROR, "CDebugDump::CDebugDump(): DebugDump is already opened.");
}
- m_sDebugDumpDir = RemoveBackSlashes(pDir);
+ m_sDebugDumpDir = RemoveBackSlashes(pDir.c_str());
if (ExistFileDir(m_sDebugDumpDir.c_str()))
{
throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+m_sDebugDumpDir+" already exists.");
@@ -331,16 +338,6 @@ static bool IsTextFile(const char *name)
return true;
}
-static std::string RemoveBackSlashes(const std::string& pDir)
-{
- std::string ret = pDir;
- while (ret[ret.length() - 1] == '/')
- {
- ret = ret.substr(0, ret.length() - 2);
- }
- return ret;
-}
-
void CDebugDump::Delete()
{
if (!ExistFileDir(m_sDebugDumpDir.c_str()))