diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-29 12:45:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-29 12:45:39 +0000 |
commit | a72aabf4e8e795760b8508da645e9587affffec0 (patch) | |
tree | a7226d0721f2a6da84fe6a7b28ce8416a4bd16ab /plugins/Quotes/src | |
parent | 0a3b4b791a99164d96841e4c771f7cb78236dc9c (diff) |
Quotes untied from ATL
git-svn-id: http://svn.miranda-ng.org/main/trunk@15089 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes/src')
-rw-r--r-- | plugins/Quotes/src/HTMLParserMS.cpp | 50 | ||||
-rw-r--r-- | plugins/Quotes/src/ImportExport.cpp | 4 | ||||
-rw-r--r-- | plugins/Quotes/src/stdafx.h | 4 | ||||
-rw-r--r-- | plugins/Quotes/src/version.h | 8 |
4 files changed, 21 insertions, 45 deletions
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<IHTMLElement> pElement;
if (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement, reinterpret_cast<void**>(&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<IMarkupContainer> 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<LPTSTR>(rsHTML.c_str()));
- CComPtr<IMarkupContainer> pMC;
- _com_util::CheckError(m_pMS->ParseString(p, 0, &pMC, m_pMkStart, m_pMkFinish));
-
- if (pMC)
+ CComPtr<IHTMLDocument2> pNewDoc;
+ hr = pMC->QueryInterface(IID_IHTMLDocument, (LPVOID*)&pNewDoc);
+ if (SUCCEEDED(hr) && pNewDoc)
{
- CComPtr<IHTMLDocument2> pNewDoc;
-
- _com_util::CheckError(pMC->QueryInterface(IID_IHTMLDocument,
- (LPVOID*)&pNewDoc));
-
- if (pNewDoc)
- {
- CComPtr<IHTMLElementCollection> pColl;
- _com_util::CheckError(pNewDoc->get_all(&pColl));
+ CComPtr<IHTMLElementCollection> 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 <windows.h>
#include <mshtml.h>
-#include <atlenc.h>
#include <comdef.h>
#include <commctrl.h>
#include <ShellAPI.h>
#include <sys\stat.h>
#include <CommDlg.h>
#include <fstream>
+#include <msapi/comptr.h>
#include <newpluginapi.h>
#include <m_database.h>
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 <stdver.h>
|