summaryrefslogtreecommitdiff
path: root/plugins/NewXstatusNotify/src/utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-03-20 22:41:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-03-20 22:41:23 +0000
commitf01cda3ae486a4046e86ec3c26c2c130dffa349a (patch)
treeee758743a02bbecd59ea4345da54f527c8f73444 /plugins/NewXstatusNotify/src/utils.cpp
parentc16625bfdc49c39ea6c159a70a87b95bbdc7a6c9 (diff)
another bunch of shit removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@12459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewXstatusNotify/src/utils.cpp')
-rw-r--r--plugins/NewXstatusNotify/src/utils.cpp42
1 files changed, 8 insertions, 34 deletions
diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp
index c41da2cd63..951a2dd551 100644
--- a/plugins/NewXstatusNotify/src/utils.cpp
+++ b/plugins/NewXstatusNotify/src/utils.cpp
@@ -96,39 +96,13 @@ void LogToFile(TCHAR *stzText)
}
}
-WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage)
+void AddCR(CMString &str, const TCHAR *stzText)
{
- if (ptr == NULL)
- return NULL;
-
- size_t size = strlen(ptr) + 1;
- WCHAR *tmp = (WCHAR *)mir_alloc(size * sizeof(WCHAR));
-
- MultiByteToWideChar(CodePage, 0, ptr, -1, tmp, (int)size * sizeof(WCHAR));
- return tmp;
-}
-
-TCHAR *AddCR(const TCHAR *stzText)
-{
- const TCHAR *found;
- size_t i = 0, len = mir_tstrlen(stzText), j;
- TCHAR *tmp = (TCHAR *)mir_alloc(1024 * sizeof(TCHAR));
- *tmp = _T('\0');
- while ((found = _tcsstr((stzText + i), _T("\n"))) != NULL && _tcslen(tmp) + 1 < 1024) {
- j = (int)(found - stzText);
- if (mir_tstrlen(tmp) + j - i + 2 < 1024)
- tmp = mir_tstrcat(tmp, stzText + i);
- else
- break;
-
- if (j == 0 || *(stzText + j - 1) != _T('\r'))
- tmp = mir_tstrcat(tmp, _T("\r"));
-
- tmp = mir_tstrcat(tmp, _T("\n"));
- i = j + 1;
- }
- if (mir_tstrlen(tmp) + len - i + 1 < 1024)
- tmp = mir_tstrcat(tmp, stzText + i);
-
- return tmp;
+ if (stzText == NULL)
+ return;
+
+ CMString res(stzText);
+ res.Replace(_T("\n"), _T("\r\n"));
+ res.Replace(_T("\r\r\n"), _T("\r\n"));
+ str.Append(res);
}