From 069389941b173066e3026713602232e4fba1d45c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Nov 2014 17:08:48 +0000 Subject: - 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 --- plugins/NewsAggregator/Src/Utils.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'plugins/NewsAggregator/Src/Utils.cpp') 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 +} -- cgit v1.2.3