diff options
author | George Hazan <george.hazan@gmail.com> | 2014-11-06 17:08:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-11-06 17:08:48 +0000 |
commit | 069389941b173066e3026713602232e4fba1d45c (patch) | |
tree | 7f301e3bc56d458ebed3e45a03b937b8099f954f /plugins/NewsAggregator/Src/Utils.cpp | |
parent | f0899cc7909c130426af35ba1ef0689d35a708f7 (diff) |
- common message archiving code extracted to a separate function;
- manual memory allocation code removed;
git-svn-id: http://svn.miranda-ng.org/main/trunk@10916 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/Utils.cpp')
-rw-r--r-- | plugins/NewsAggregator/Src/Utils.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 9883812253..1db0e19e4a 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -189,7 +189,7 @@ void DeleteAllItems(HWND hwndList) ListView_DeleteAllItems(hwndList);
}
-time_t __stdcall DateToUnixTime(TCHAR *stamp, BOOL FeedType)
+time_t __stdcall DateToUnixTime(const TCHAR *stamp, BOOL FeedType)
{
struct tm timestamp;
TCHAR date[9];
@@ -199,7 +199,7 @@ time_t __stdcall DateToUnixTime(TCHAR *stamp, BOOL FeedType) if (stamp == NULL)
return 0;
- TCHAR *p = stamp;
+ TCHAR *p = NEWTSTR_ALLOCA(stamp);
if (FeedType) {
// skip '-' chars
@@ -322,7 +322,7 @@ TCHAR * _tcsistr(const TCHAR *str, const TCHAR *substr) return (TCHAR *)str;
}
-int StrReplace(TCHAR *lpszOld, TCHAR *lpszNew, TCHAR *&lpszStr)
+int StrReplace(TCHAR *lpszOld, const TCHAR *lpszNew, TCHAR *&lpszStr)
{
if (!lpszStr || !lpszOld || !lpszNew)
return 0;
@@ -561,17 +561,18 @@ HRESULT TestDocumentText(IHTMLDocument3 *pHtmlDoc, BSTR &message) return hr;
}
-VOID ClearText(TCHAR *&message)
+LPCTSTR ClearText(CMString &result, const TCHAR *message)
{
- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
BSTR bstrHtml = SysAllocString(message), bstrRes = SysAllocString(L"");
HRESULT hr = TestMarkupServices(bstrHtml, &TestDocumentText, bstrRes);
- if ( SUCCEEDED(hr)) {
- replaceStrT(message, bstrRes);
+ if (SUCCEEDED(hr)) {
+ result = bstrRes;
SysFreeString(bstrRes);
}
+ else result = message;
SysFreeString(bstrHtml);
- CoUninitialize();
+
+ return result;
}
MCONTACT GetContactByNick(const TCHAR *nick)
@@ -596,4 +597,4 @@ MCONTACT GetContactByURL(const TCHAR *url) break;
}
return hContact;
-}
\ No newline at end of file +}
|