From a72aabf4e8e795760b8508da645e9587affffec0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 29 Aug 2015 12:45:39 +0000 Subject: Quotes untied from ATL git-svn-id: http://svn.miranda-ng.org/main/trunk@15089 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Quotes/src/HTMLParserMS.cpp | 50 +++++++++++-------------------------- plugins/Quotes/src/ImportExport.cpp | 4 +-- plugins/Quotes/src/stdafx.h | 4 +-- plugins/Quotes/src/version.h | 8 +++--- 4 files changed, 21 insertions(+), 45 deletions(-) (limited to 'plugins') diff --git a/plugins/Quotes/src/HTMLParserMS.cpp b/plugins/Quotes/src/HTMLParserMS.cpp index 2b6b27f67f..92c394f332 100644 --- a/plugins/Quotes/src/HTMLParserMS.cpp +++ b/plugins/Quotes/src/HTMLParserMS.cpp @@ -96,14 +96,12 @@ namespace virtual tstring GetAttribute(const tstring& rsAttrName)const { - USES_CONVERSION; - tstring sAttr; CComPtr pElement; if (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement, reinterpret_cast(&pElement))) && pElement) { _variant_t vAttribute; - BSTR pbstrAttrName = T2BSTR(rsAttrName.c_str()); + BSTR pbstrAttrName = ::SysAllocString(rsAttrName.c_str()); if (SUCCEEDED(pElement->getAttribute(pbstrAttrName, 1, &vAttribute)) && VT_NULL != vAttribute.vt && VT_EMPTY != vAttribute.vt) { @@ -219,48 +217,30 @@ CHTMLParserMS::CHTMLParserMS() : m_bCallUninit(false) CHTMLParserMS::~CHTMLParserMS() { - if (true == m_bCallUninit) - { + if (m_bCallUninit) ::CoUninitialize(); - } } CHTMLParserMS::THTMLNodePtr CHTMLParserMS::ParseString(const tstring& rsHTML) { - USES_CONVERSION; + mir_cslock lck(m_cs); - try + CComPtr pMC; + HRESULT hr = m_pMS->ParseString((OLECHAR*)rsHTML.c_str(), 0, &pMC, m_pMkStart, m_pMkFinish); + if (SUCCEEDED(hr) && pMC) { - mir_cslock lck(m_cs); - - OLECHAR* p = T2OLE(const_cast(rsHTML.c_str())); - CComPtr pMC; - _com_util::CheckError(m_pMS->ParseString(p, 0, &pMC, m_pMkStart, m_pMkFinish)); - - if (pMC) + CComPtr pNewDoc; + hr = pMC->QueryInterface(IID_IHTMLDocument, (LPVOID*)&pNewDoc); + if (SUCCEEDED(hr) && pNewDoc) { - CComPtr pNewDoc; - - _com_util::CheckError(pMC->QueryInterface(IID_IHTMLDocument, - (LPVOID*)&pNewDoc)); - - if (pNewDoc) - { - CComPtr pColl; - _com_util::CheckError(pNewDoc->get_all(&pColl)); + CComPtr pColl; + pNewDoc->get_all(&pColl); - CHTMLNode::TDocumentPtr pDoc; - pMC->QueryInterface(IID_IHTMLDocument3, (LPVOID*)&pDoc); - - - return THTMLNodePtr(new CHTMLNode(CHTMLNode::TComPtr(pColl), pDoc)); - } + CHTMLNode::TDocumentPtr pDoc; + pMC->QueryInterface(IID_IHTMLDocument3, (LPVOID*)&pDoc); + return THTMLNodePtr(new CHTMLNode(CHTMLNode::TComPtr(pColl), pDoc)); } } - catch (_com_error&/* e*/) - { - // show_com_error_msg(e); - } return THTMLNodePtr(); } @@ -290,9 +270,7 @@ bool CHTMLParserMS::IsInstalled() } if (bCallUninit) - { ::CoUninitialize(); - } return bResult; } diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index aea84a8573..06d9942d43 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -393,7 +393,7 @@ namespace } else if (0 == quotes_stricmp(g_pszXmlTypeAsciiz, sType.c_str())) { - CT2A v(sValue.c_str()); + ptrA v(mir_t2a(sValue.c_str())); dbs.value.pszVal = v; dbs.value.type = DBVT_ASCIIZ; if (set_contact_settings(hContact, dbs)) @@ -409,7 +409,7 @@ namespace } else if (0 == quotes_stricmp(g_pszXmlTypeWchar, sType.c_str())) { - CT2W val(sValue.c_str()); + ptrW val(mir_t2u(sValue.c_str())); dbs.value.pwszVal = val; dbs.value.type = DBVT_WCHAR; if (set_contact_settings(hContact, dbs)) diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h index 86b63a2dd2..7787056d13 100644 --- a/plugins/Quotes/src/stdafx.h +++ b/plugins/Quotes/src/stdafx.h @@ -5,17 +5,15 @@ #pragma once -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - #include #include -#include #include #include #include #include #include #include +#include #include #include diff --git a/plugins/Quotes/src/version.h b/plugins/Quotes/src/version.h index d09f6a56e2..c191acd19e 100644 --- a/plugins/Quotes/src/version.h +++ b/plugins/Quotes/src/version.h @@ -1,7 +1,7 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 0 -#define __RELEASE_NUM 26 -#define __BUILD_NUM 0 +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 1 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 1 #include -- cgit v1.2.3