summaryrefslogtreecommitdiff
path: root/src/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities.cpp')
-rwxr-xr-xsrc/utilities.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/utilities.cpp b/src/utilities.cpp
index 8a7e0b3..f27b07a 100755
--- a/src/utilities.cpp
+++ b/src/utilities.cpp
@@ -1,4 +1,4 @@
-// Copyright © 2010-2012 sss
+// Copyright © 2010-2012 sss
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -1184,7 +1184,7 @@ bool isGPGValid()
mir_free(tmp);
TCHAR *path = (TCHAR*)mir_alloc(sizeof(TCHAR)*MAX_PATH);
char *mir_path = (char*)mir_alloc(MAX_PATH);
- CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)"\\", (LPARAM)mir_path);
+ PathToAbsolute("\\", mir_path);
SetCurrentDirectoryA(mir_path);
tmp = mir_a2t(mir_path);
mir_free(mir_path);
@@ -1862,7 +1862,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
mir_utf8decode(tmp2, 0);
DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", tmp2);
mir_free(tmp2);
- s = output.find("“", s2);
+ s = output.find("“", s2);
if(s == string::npos)
{
s = output.find("\"", s2);
@@ -1974,28 +1974,38 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
void fix_line_term(std::string &s)
{
+ if(s.empty())
+ return;
boost::algorithm::erase_all(s, "\r\r");
}
void fix_line_term(std::wstring &s)
{
+ if(s.empty())
+ return;
boost::algorithm::erase_all(s, _T("\r\r"));
}
void strip_line_term(std::wstring &s)
{
+ if(s.empty())
+ return;
boost::algorithm::erase_all(s, _T("\r"));
boost::algorithm::erase_all(s, _T("\n"));
}
void strip_line_term(std::string &s)
{
+ if(s.empty())
+ return;
boost::algorithm::erase_all(s, "\r");
boost::algorithm::erase_all(s, "\n");
}
void strip_tags(std::wstring &str)
{
+ if(str.empty())
+ return;
boost::algorithm::erase_all(str, inopentag);
boost::algorithm::erase_all(str, inclosetag);
boost::algorithm::erase_all(str, outopentag);
@@ -2256,7 +2266,7 @@ void clean_temp_dir()
{
using namespace boost::filesystem;
char *mir_path = new char [MAX_PATH];
- CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)"\\", (LPARAM)mir_path);
+ PathToAbsolute("\\", mir_path);
wstring path = toUTF16(mir_path);
SetCurrentDirectoryA(mir_path);
delete [] mir_path;