summaryrefslogtreecommitdiff
path: root/plugins/Quotes
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Quotes')
-rw-r--r--plugins/Quotes/src/ComHelper.cpp2
-rw-r--r--plugins/Quotes/src/CreateFilePath.cpp2
-rw-r--r--plugins/Quotes/src/CurrencyConverter.cpp5
-rw-r--r--plugins/Quotes/src/DBUtils.cpp1
-rw-r--r--plugins/Quotes/src/ImportExport.cpp56
-rw-r--r--plugins/Quotes/src/QuotesProviderBase.cpp31
-rw-r--r--plugins/Quotes/src/QuotesProviderDukasCopy.cpp4
-rw-r--r--plugins/Quotes/src/QuotesProviderFinance.cpp10
-rw-r--r--plugins/Quotes/src/QuotesProviderGoogle.cpp14
-rw-r--r--plugins/Quotes/src/QuotesProviderGoogleFinance.cpp2
-rw-r--r--plugins/Quotes/src/QuotesProviders.cpp2
-rw-r--r--plugins/Quotes/src/XMLEngineMI.cpp14
-rw-r--r--plugins/Quotes/src/stdafx.h50
13 files changed, 72 insertions, 121 deletions
diff --git a/plugins/Quotes/src/ComHelper.cpp b/plugins/Quotes/src/ComHelper.cpp
index 83a07c58e8..57cf21b15a 100644
--- a/plugins/Quotes/src/ComHelper.cpp
+++ b/plugins/Quotes/src/ComHelper.cpp
@@ -26,5 +26,3 @@ void ShowComError(_com_error& e, const tstring& rsAdditionalInfo)
LogIt(sErrorMsg);
Quotes_MessageBox(NULL, sErrorMsg.c_str(), MB_OK | MB_ICONERROR);
}
-
-
diff --git a/plugins/Quotes/src/CreateFilePath.cpp b/plugins/Quotes/src/CreateFilePath.cpp
index e02cb91cd3..ef728791d3 100644
--- a/plugins/Quotes/src/CreateFilePath.cpp
+++ b/plugins/Quotes/src/CreateFilePath.cpp
@@ -2,7 +2,7 @@
static TCHAR InvalidSymbols[] = { _T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('"'), _T('<'), _T('>'), _T('|') };
-TCHAR replace_invalid_symbol(TCHAR chr)
+static TCHAR replace_invalid_symbol(TCHAR chr)
{
for (int i = 0; i < _countof(InvalidSymbols); ++i)
if (chr == InvalidSymbols[i])
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp
index 8c46d37fc3..874eaa626b 100644
--- a/plugins/Quotes/src/CurrencyConverter.cpp
+++ b/plugins/Quotes/src/CurrencyConverter.cpp
@@ -21,7 +21,6 @@ static CQuotesProviderGoogle* get_google_provider()
return NULL;
}
-
CQuotesProviderGoogle::CQuoteSection get_quotes(const CQuotesProviderGoogle* pProvider = NULL)
{
if (NULL == pProvider)
@@ -109,11 +108,11 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM
LRESULT nFrom = ::SendMessage(hcbxFrom, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
LRESULT nTo = ::SendMessage(hcbxTo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
- if (0 == quotes_stricmp(rQuote.GetID().c_str(), sFromQuoteID.c_str())) {
+ if (0 == mir_tstrcmpi(rQuote.GetID().c_str(), sFromQuoteID.c_str())) {
::SendMessage(hcbxFrom, CB_SETCURSEL, nFrom, 0);
}
- if (0 == quotes_stricmp(rQuote.GetID().c_str(), sToQuoteID.c_str())) {
+ if (0 == mir_tstrcmpi(rQuote.GetID().c_str(), sToQuoteID.c_str())) {
::SendMessage(hcbxTo, CB_SETCURSEL, nTo, 0);
}
}
diff --git a/plugins/Quotes/src/DBUtils.cpp b/plugins/Quotes/src/DBUtils.cpp
index 57fac8aa53..dffcb18c5d 100644
--- a/plugins/Quotes/src/DBUtils.cpp
+++ b/plugins/Quotes/src/DBUtils.cpp
@@ -45,4 +45,3 @@ bool Quotes_DBReadDouble(MCONTACT hContact, const char* szModule, const char* sz
db_free(&dbv);
return bResult;
}
-
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp
index 34f65b35d9..f32b4fcb61 100644
--- a/plugins/Quotes/src/ImportExport.cpp
+++ b/plugins/Quotes/src/ImportExport.cpp
@@ -255,13 +255,13 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
std::string s = quotes_t2a(sModuleName.c_str());
dbs.szModule = s.c_str();//T2CA(sModuleName.c_str());
- bool bCListModule = 0 == quotes_stricmp(sModuleName.c_str(), _T("CList"));
+ bool bCListModule = 0 == mir_tstrcmpi(sModuleName.c_str(), _T("CList"));
size_t cChild = pXmlModule->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pSetting = pXmlModule->GetChildNode(i);
tstring sSetting = pSetting->GetName();
- if (0 == quotes_stricmp(g_pszXmlSetting, sSetting.c_str())) {
+ if (0 == mir_tstrcmpi(g_pszXmlSetting, sSetting.c_str())) {
size_t cSetChild = pSetting->GetChildCount();
if (cSetChild >= 2) {
tstring sName;
@@ -270,10 +270,10 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
for (size_t j = 0; j < cSetChild; ++j) {
IXMLNode::TXMLNodePtr pNode = pSetting->GetChildNode(j);
tstring sNode = pNode->GetName();
- if (0 == quotes_stricmp(g_pszXmlName, sNode.c_str())) {
+ if (0 == mir_tstrcmpi(g_pszXmlName, sNode.c_str())) {
sName = pNode->GetText();
}
- else if (0 == quotes_stricmp(g_pszXmlValue, sNode.c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlValue, sNode.c_str())) {
sValue = pNode->GetText();
sType = pNode->GetAttributeValue(g_pszXmlType);
}
@@ -282,7 +282,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
if ((false == sName.empty()) && (false == sType.empty())) {
std::string s1 = quotes_t2a(sName.c_str());
dbs.szSetting = s1.c_str();
- if (0 == quotes_stricmp(g_pszXmlTypeByte, sType.c_str())) {
+ if (0 == mir_tstrcmpi(g_pszXmlTypeByte, sType.c_str())) {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
dbs.value.cVal = in.get();
@@ -292,7 +292,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
++cCreatedRecords;
}
}
- else if (0 == quotes_stricmp(g_pszXmlTypeWord, sType.c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlTypeWord, sType.c_str())) {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
in >> dbs.value.wVal;
@@ -302,7 +302,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
++cCreatedRecords;
}
}
- else if (0 == quotes_stricmp(g_pszXmlTypeDword, sType.c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlTypeDword, sType.c_str())) {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
in >> dbs.value.dVal;
@@ -312,21 +312,21 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
++cCreatedRecords;
}
}
- else if (0 == quotes_stricmp(g_pszXmlTypeAsciiz, sType.c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlTypeAsciiz, sType.c_str())) {
ptrA v(mir_t2a(sValue.c_str()));
dbs.value.pszVal = v;
dbs.value.type = DBVT_ASCIIZ;
if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
- else if (0 == quotes_stricmp(g_pszXmlTypeUtf8, sType.c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlTypeUtf8, sType.c_str())) {
T2Utf szValue(sValue.c_str());
dbs.value.pszVal = szValue;
dbs.value.type = DBVT_UTF8;
if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
- else if (0 == quotes_stricmp(g_pszXmlTypeWchar, sType.c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlTypeWchar, sType.c_str())) {
ptrW val(mir_t2u(sValue.c_str()));
dbs.value.pwszVal = val;
dbs.value.type = DBVT_WCHAR;
@@ -335,7 +335,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
mir_free(dbs.value.pwszVal);
}
- else if (0 == quotes_stricmp(g_pszXmlTypeBlob, sType.c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlTypeBlob, sType.c_str())) {
unsigned bufLen;
mir_ptr<BYTE> buf((PBYTE)mir_base64_decode(_T2A(sValue.c_str()), &bufLen));
if (buf) {
@@ -348,7 +348,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
}
}
- if ((true == bCListModule) && (0 == quotes_stricmp(sName.c_str(), _T("Group"))))
+ if ((true == bCListModule) && (0 == mir_tstrcmpi(sName.c_str(), _T("Group"))))
CallService(MS_CLIST_GROUPCREATE, NULL, reinterpret_cast<LPARAM>(sValue.c_str()));
}
}
@@ -367,13 +367,13 @@ size_t count_contacts(const IXMLNode::TXMLNodePtr& pXmlRoot, bool bInContactsGro
IXMLNode::TXMLNodePtr pNode = pXmlRoot->GetChildNode(i);
tstring sName = pNode->GetName();
if (false == bInContactsGroup) {
- if (0 == quotes_stricmp(g_pszXmlContacts, sName.c_str()))
+ if (0 == mir_tstrcmpi(g_pszXmlContacts, sName.c_str()))
cContacts += count_contacts(pNode, true);
else
cContacts += count_contacts(pNode, false);
}
else {
- if (0 == quotes_stricmp(g_pszXmlContact, sName.c_str()))
+ if (0 == mir_tstrcmpi(g_pszXmlContact, sName.c_str()))
++cContacts;
}
}
@@ -405,8 +405,8 @@ IXMLNode::TXMLNodePtr find_quotes_module(const IXMLNode::TXMLNodePtr& pXmlContac
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlContact->GetChildNode(i);
tstring sName = pNode->GetName();
- if ((0 == quotes_stricmp(g_pszXmlModule, sName.c_str()))
- && (0 == quotes_stricmp(g_sQuotes.c_str(), pNode->GetText().c_str()))) {
+ if ((0 == mir_tstrcmpi(g_pszXmlModule, sName.c_str()))
+ && (0 == mir_tstrcmpi(g_sQuotes.c_str(), pNode->GetText().c_str()))) {
return pNode;
}
}
@@ -424,10 +424,10 @@ TNameValue parse_setting_node(const IXMLNode::TXMLNodePtr& pXmlSetting)
for (size_t j = 0; j < cSettingChildItems; ++j) {
IXMLNode::TXMLNodePtr pXMLSetChild = pXmlSetting->GetChildNode(j);
if (pXMLSetChild) {
- if (0 == quotes_stricmp(g_pszXmlName, pXMLSetChild->GetName().c_str())) {
+ if (0 == mir_tstrcmpi(g_pszXmlName, pXMLSetChild->GetName().c_str())) {
sName = pXMLSetChild->GetText();
}
- else if (0 == quotes_stricmp(g_pszXmlValue, pXMLSetChild->GetName().c_str())) {
+ else if (0 == mir_tstrcmpi(g_pszXmlValue, pXMLSetChild->GetName().c_str())) {
sValue = pXMLSetChild->GetText();
}
}
@@ -443,9 +443,9 @@ CQuotesProviders::TQuotesProviderPtr find_provider(const IXMLNode::TXMLNodePtr&
size_t cChild = pXmlQuotesModule->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pXMLSetting = pXmlQuotesModule->GetChildNode(i);
- if (pXMLSetting && (0 == quotes_stricmp(g_pszXmlSetting, pXMLSetting->GetName().c_str()))) {
+ if (pXMLSetting && (0 == mir_tstrcmpi(g_pszXmlSetting, pXMLSetting->GetName().c_str()))) {
TNameValue Item = parse_setting_node(pXMLSetting);
- if ((0 == quotes_stricmp(g_sQuotesProvider.c_str(), Item.first.c_str())) && (false == Item.second.empty())) {
+ if ((0 == mir_tstrcmpi(g_sQuotesProvider.c_str(), Item.first.c_str())) && (false == Item.second.empty())) {
return CModuleInfo::GetInstance().GetQuoteProvidersPtr()->FindProvider(Item.second);
}
}
@@ -486,12 +486,12 @@ bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState&
size_t cChild = m_pXmlQuotes->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i);
- if (pNode && (0 == quotes_stricmp(g_pszXmlSetting, pNode->GetName().c_str()))) {
+ if (pNode && (0 == mir_tstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) {
TNameValue Item = parse_setting_node(pNode);
- if (0 == quotes_stricmp(g_sFromID.c_str(), Item.first.c_str())) {
+ if (0 == mir_tstrcmpi(g_sFromID.c_str(), Item.first.c_str())) {
sFromID = Item.second;
}
- else if (0 == quotes_stricmp(g_sToID.c_str(), Item.first.c_str())) {
+ else if (0 == mir_tstrcmpi(g_sToID.c_str(), Item.first.c_str())) {
sToID = Item.second;
}
}
@@ -518,9 +518,9 @@ bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState&
size_t cChild = m_pXmlQuotes->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i);
- if (pNode && (0 == quotes_stricmp(g_pszXmlSetting, pNode->GetName().c_str()))) {
+ if (pNode && (0 == mir_tstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) {
TNameValue Item = parse_setting_node(pNode);
- if (0 == quotes_stricmp(Item.first.c_str(), sXMLNodeName.c_str())) {
+ if (0 == mir_tstrcmpi(Item.first.c_str(), sXMLNodeName.c_str())) {
sValue = Item.second;
break;
}
@@ -568,7 +568,7 @@ bool import_contact(const IXMLNode::TXMLNodePtr& pXmlContact, CImportContext& im
for (size_t i = 0; i < cChild && bResult; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlContact->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == quotes_stricmp(g_pszXmlModule, sName.c_str()))
+ if (0 == mir_tstrcmpi(g_pszXmlModule, sName.c_str()))
bResult &= handle_module(cst.m_hContact, pNode);
}
@@ -590,7 +590,7 @@ size_t import_contacts(const IXMLNode::TXMLNodePtr& pXmlContacts, CImportContext
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlContacts->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == quotes_stricmp(g_pszXmlContact, sName.c_str()))
+ if (0 == mir_tstrcmpi(g_pszXmlContact, sName.c_str()))
if (true == import_contact(pNode, impctx))
++cContacts;
}
@@ -606,7 +606,7 @@ size_t handle_contacts_node(const IXMLNode::TXMLNodePtr& pXmlRoot, CImportContex
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlRoot->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == quotes_stricmp(g_pszXmlContacts, sName.c_str()))
+ if (0 == mir_tstrcmpi(g_pszXmlContacts, sName.c_str()))
cContacts += import_contacts(pNode, impctx);
else
cContacts += handle_contacts_node(pNode, impctx);
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp
index c97126e9fe..204e4a7d4a 100644
--- a/plugins/Quotes/src/QuotesProviderBase.cpp
+++ b/plugins/Quotes/src/QuotesProviderBase.cpp
@@ -26,15 +26,15 @@ bool parse_quote(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuote&
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pTop->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == quotes_stricmp(_T("symbol"), sName.c_str())) {
+ if (0 == mir_tstrcmpi(_T("symbol"), sName.c_str())) {
sSymbol = pNode->GetText();
if (true == sSymbol.empty())
return false;
}
- else if (0 == quotes_stricmp(_T("description"), sName.c_str())) {
+ else if (0 == mir_tstrcmpi(_T("description"), sName.c_str())) {
sDescription = pNode->GetText();
}
- else if (0 == quotes_stricmp(_T("id"), sName.c_str())) {
+ else if (0 == mir_tstrcmpi(_T("id"), sName.c_str())) {
sID = pNode->GetText();
if (true == sID.empty())
return false;
@@ -55,17 +55,17 @@ bool parse_section(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuot
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pTop->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == quotes_stricmp(_T("section"), sName.c_str())) {
+ if (0 == mir_tstrcmpi(_T("section"), sName.c_str())) {
CQuotesProviderBase::CQuoteSection qs1;
if (true == parse_section(pNode, qs1))
aSections.push_back(qs1);
}
- else if (0 == quotes_stricmp(_T("quote"), sName.c_str())) {
+ else if (0 == mir_tstrcmpi(_T("quote"), sName.c_str())) {
CQuotesProviderBase::CQuote q;
if (true == parse_quote(pNode, q))
aQuotes.push_back(q);
}
- else if (0 == quotes_stricmp(_T("name"), sName.c_str())) {
+ else if (0 == mir_tstrcmpi(_T("name"), sName.c_str())) {
sSectionName = pNode->GetText();
if (true == sSectionName.empty())
return false;
@@ -83,7 +83,7 @@ IXMLNode::TXMLNodePtr find_provider(const IXMLNode::TXMLNodePtr& pRoot)
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pRoot->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == quotes_stricmp(_T("Provider"), sName.c_str())) {
+ if (0 == mir_tstrcmpi(_T("Provider"), sName.c_str())) {
pProvider = pNode;
break;
}
@@ -111,16 +111,16 @@ CQuotesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile, bool&
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pProvider->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == quotes_stricmp(_T("section"), sName.c_str())) {
+ if (0 == mir_tstrcmpi(_T("section"), sName.c_str())) {
CQuotesProviderBase::CQuoteSection qs;
if (true == parse_section(pNode, qs))
aSections.push_back(qs);
}
- else if (0 == quotes_stricmp(_T("Name"), sName.c_str()))
+ else if (0 == mir_tstrcmpi(_T("Name"), sName.c_str()))
res.m_pi.m_sName = pNode->GetText();
- else if (0 == quotes_stricmp(_T("ref"), sName.c_str()))
+ else if (0 == mir_tstrcmpi(_T("ref"), sName.c_str()))
res.m_pi.m_sURL = pNode->GetText();
- else if (0 == quotes_stricmp(_T("url"), sName.c_str()))
+ else if (0 == mir_tstrcmpi(_T("url"), sName.c_str()))
res.m_sURL = pNode->GetText();
}
}
@@ -509,10 +509,11 @@ bool show_popup(const IQuotesProvider* pProvider,
pProvider->Accept(visitor);
const tstring& sTitle = visitor.GetResult();
mir_tstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME);
-
- mir_safe_string<TCHAR> ss(variables_parsedup((TCHAR*)rsFormat.c_str(), 0, hContact));
- tstring sText = format_rate(pProvider, hContact, ss.m_p);
- mir_tstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE);
+ {
+ ptrT ss(variables_parsedup((TCHAR*)rsFormat.c_str(), 0, hContact));
+ tstring sText = format_rate(pProvider, hContact, tstring(ss));
+ mir_tstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE);
+ }
if (CPopupSettings::colourDefault == ps.GetColourMode()) {
ppd.colorText = CPopupSettings::GetDefColourText();
diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp
index 08b13fdd68..3fafe3423d 100644
--- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp
+++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp
@@ -114,13 +114,13 @@ void parse_row(const THTMLNodePtr& pRow, TEconomicRates& raRates)
if (pCol) {
tstring sColID = pCol->GetAttribute(_T("id"));
if (false == sColID.empty()) {
- if (0 == quotes_stricmp(sColID.c_str(), _T("stock"))) {
+ if (0 == mir_tstrcmpi(sColID.c_str(), _T("stock"))) {
ri.m_sName = pCol->GetText();
if (false == ri.m_sName.empty()) {
++cColsHandled;
}
}
- else if (0 == quotes_stricmp(sSidID.str().c_str(), sColID.c_str())) {
+ else if (0 == mir_tstrcmpi(sSidID.str().c_str(), sColID.c_str())) {
tstring sRate = pCol->GetText();
if ((false == sRate.empty()) && (true == string2double(sRate.c_str(), ri.m_dCurRate))) {
ri.m_dPrevRate = ri.m_dCurRate;
diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp
index 48502e6c95..4dd036fe3e 100644
--- a/plugins/Quotes/src/QuotesProviderFinance.cpp
+++ b/plugins/Quotes/src/QuotesProviderFinance.cpp
@@ -106,9 +106,9 @@ namespace
for (int i = 0; i < cItems; ++i) {
const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndList, i);
if ((nullptr != pQuote)
- && ((0 == quotes_stricmp(rsQuoteID.c_str(), pQuote->GetID().c_str()))
- || (0 == quotes_stricmp(rsQuoteID.c_str(), pQuote->GetName().c_str()))
- || (0 == quotes_stricmp(rsQuoteID.c_str(), pQuote->GetSymbol().c_str())))) {
+ && ((0 == mir_tstrcmpi(rsQuoteID.c_str(), pQuote->GetID().c_str()))
+ || (0 == mir_tstrcmpi(rsQuoteID.c_str(), pQuote->GetName().c_str()))
+ || (0 == mir_tstrcmpi(rsQuoteID.c_str(), pQuote->GetSymbol().c_str())))) {
return i;
}
}
@@ -218,7 +218,7 @@ namespace
[&apCurrent, pProvider](const CQuotesProviderBase::CQuote& quote)
{
if (apCurrent.end() == std::find_if(apCurrent.begin(), apCurrent.end(),
- [&quote](const CQuotesProviderBase::CQuote* pQuote) { return 0 == quotes_stricmp(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
+ [&quote](const CQuotesProviderBase::CQuote* pQuote) { return 0 == mir_tstrcmpi(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
pProvider->WatchForQuote(quote, false);
}
});
@@ -228,7 +228,7 @@ namespace
{
if (aTemp.end() ==
std::find_if(aTemp.begin(), aTemp.end(),
- [pQuote](const CQuotesProviderBase::CQuote& quote) { return 0 == quotes_stricmp(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
+ [pQuote](const CQuotesProviderBase::CQuote& quote) { return 0 == mir_tstrcmpi(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
pProvider->WatchForQuote(*pQuote, true);
}
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp
index 87e05f09c7..a91f71fc27 100644
--- a/plugins/Quotes/src/QuotesProviderGoogle.cpp
+++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp
@@ -21,8 +21,8 @@ inline bool is_rate_watched(MCONTACT hContact,
{
tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
- return ((0 == quotes_stricmp(from.GetID().c_str(), sFrom.c_str()))
- && (0 == quotes_stricmp(to.GetID().c_str(), sTo.c_str())));
+ return ((0 == mir_tstrcmpi(from.GetID().c_str(), sFrom.c_str()))
+ && (0 == mir_tstrcmpi(to.GetID().c_str(), sTo.c_str())));
}
bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri,
@@ -102,7 +102,7 @@ typedef IHTMLNode::THTMLNodePtr THTMLNodePtr;
bool parse_html_node(const THTMLNodePtr& pNode, double& rdRate)
{
tstring sID = pNode->GetAttribute(_T("id"));
- if ((false == sID.empty()) && (0 == quotes_stricmp(sID.c_str(), _T("currency_converter_result")))) {
+ if ((false == sID.empty()) && (0 == mir_tstrcmpi(sID.c_str(), _T("currency_converter_result")))) {
size_t cChild = pNode->GetChildCount();
// assert(1 == cChild);
if (cChild > 0) {
@@ -218,8 +218,8 @@ TWatchedRates g_aWatchedRates;
bool is_equal_rate(const CQuotesProviderGoogle::CRateInfo& riL, const CQuotesProviderGoogle::CRateInfo& riR)
{
- return ((0 == quotes_stricmp(riL.m_from.GetID().c_str(), riR.m_from.GetID().c_str()))
- && ((0 == quotes_stricmp(riL.m_to.GetID().c_str(), riR.m_to.GetID().c_str()))));
+ return ((0 == mir_tstrcmpi(riL.m_from.GetID().c_str(), riR.m_from.GetID().c_str()))
+ && ((0 == mir_tstrcmpi(riL.m_to.GetID().c_str(), riR.m_to.GetID().c_str()))));
}
INT_PTR CALLBACK GoogleOptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -419,8 +419,8 @@ namespace
{
tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
- return ((0 == quotes_stricmp(rsFromID.c_str(), sFrom.c_str()))
- && (0 == quotes_stricmp(rsToID.c_str(), sTo.c_str())));
+ return ((0 == mir_tstrcmpi(rsFromID.c_str(), sFrom.c_str()))
+ && (0 == mir_tstrcmpi(rsToID.c_str(), sTo.c_str())));
}
}
diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp
index f9a561ad7b..25efbdfc55 100644
--- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp
+++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp
@@ -151,7 +151,7 @@ bool get_inline_data(const IHTMLNode::THTMLNodePtr& pNode, CGoogleInfo& rInfo)
IHTMLNode::THTMLNodePtr pName = pChild->GetChildPtr(0);
tstring sName = pName->GetText();
- if (0 == quotes_stricmp(sName.c_str(), _T("Open"))) {
+ if (0 == mir_tstrcmpi(sName.c_str(), _T("Open"))) {
IHTMLNode::THTMLNodePtr pValue = pChild->GetChildPtr(1);
tstring sValue = pValue->GetText();
if (true == get_double_value(sValue, rInfo.m_dOpenValue)) {
diff --git a/plugins/Quotes/src/QuotesProviders.cpp b/plugins/Quotes/src/QuotesProviders.cpp
index 1edbfc7825..0a3e220d7f 100644
--- a/plugins/Quotes/src/QuotesProviders.cpp
+++ b/plugins/Quotes/src/QuotesProviders.cpp
@@ -82,7 +82,7 @@ CQuotesProviders::TQuotesProviderPtr CQuotesProviders::FindProvider(const tstrin
for (TQuotesProviders::const_iterator i = m_apProviders.begin(); i != m_apProviders.end(); ++i) {
const TQuotesProviderPtr& pProvider = *i;
const IQuotesProvider::CProviderInfo& rInfo = pProvider->GetInfo();
- if (0 == ::quotes_stricmp(rsName.c_str(), rInfo.m_sName.c_str())) {
+ if (0 == ::mir_tstrcmpi(rsName.c_str(), rInfo.m_sName.c_str())) {
pResult = pProvider;
break;
}
diff --git a/plugins/Quotes/src/XMLEngineMI.cpp b/plugins/Quotes/src/XMLEngineMI.cpp
index 93d87ce87c..59c76ed58f 100644
--- a/plugins/Quotes/src/XMLEngineMI.cpp
+++ b/plugins/Quotes/src/XMLEngineMI.cpp
@@ -77,9 +77,9 @@ public:
virtual void Write(tostream& o)const
{
- safe_string<TCHAR> ss(xmlToString(m_hXML, NULL));
- if (ss.m_p)
- o << (char*)T2Utf(ss.m_p);
+ ptrT ss(xmlToString(m_hXML, NULL));
+ if (ss != NULL)
+ o << (char*)T2Utf(ss);
}
private:
@@ -98,7 +98,7 @@ CXMLEngineMI::~CXMLEngineMI()
IXMLNode::TXMLNodePtr CXMLEngineMI::LoadFile(const tstring& rsFileName)const
{
IXMLNode::TXMLNodePtr pResult;
- FILE* stream;
+ FILE *stream;
if (0 == ::_tfopen_s(&stream, rsFileName.c_str(), _T("r"))) {
struct _stat st;
if (-1 != ::_fstat(::_fileno(stream), &st)) {
@@ -109,9 +109,9 @@ IXMLNode::TXMLNodePtr CXMLEngineMI::LoadFile(const tstring& rsFileName)const
pBuffer[cBytes] = '\0';
int nLen = (int)cBytes;
- mir_safe_string<TCHAR> ss(mir_utf8decodeT(pBuffer));
- if (ss.m_p) {
- HXML h = xmlParseString(ss.m_p, &nLen, NULL);
+ ptrT ss(mir_utf8decodeT(pBuffer));
+ if (ss) {
+ HXML h = xmlParseString(ss, &nLen, NULL);
if (h)
pResult = IXMLNode::TXMLNodePtr(new CXMLNodeMI(h, true));
}
diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h
index bd1842fbd6..48d99a70b3 100644
--- a/plugins/Quotes/src/stdafx.h
+++ b/plugins/Quotes/src/stdafx.h
@@ -54,8 +54,7 @@ inline std::string quotes_t2a(const TCHAR* t)
{
std::string s;
char* p = mir_t2a(t);
- if (p)
- {
+ if (p) {
s = p;
mir_free(p);
}
@@ -66,19 +65,13 @@ inline tstring quotes_a2t(const char* s)
{
tstring t;
TCHAR* p = mir_a2t(s);
- if (p)
- {
+ if (p) {
t = p;
mir_free(p);
}
return t;
}
-inline int quotes_stricmp(LPCTSTR p1, LPCTSTR p2)
-{
- return mir_tstrcmpi(p1, p2);
-}
-
#include "resource.h"
#include "version.h"
#include "IconLib.h"
@@ -122,43 +115,4 @@ inline int quotes_stricmp(LPCTSTR p1, LPCTSTR p2)
#include "IXMLEngine.h"
#include "XMLEngineMI.h"
-namespace detail
-{
- template<typename T, typename TD> struct safe_string_impl
- {
- typedef T* PTR;
-
- safe_string_impl(PTR p) : m_p(p){}
- ~safe_string_impl(){ TD::dealloc(m_p); }
-
- PTR m_p;
- };
-
- template<typename T> struct MirandaFree
- {
- static void dealloc(T* p){ mir_free(p); }
- };
-
- template<typename T> struct OwnerFree
- {
- static void dealloc(T* p){ ::free(p); }
- };
-}
-
-template<typename T> struct mir_safe_string : public detail::safe_string_impl < T, detail::MirandaFree<T> >
-{
- mir_safe_string(PTR p) : detail::safe_string_impl<T, detail::MirandaFree<T>>(p){}
-};
-
-template<typename T> struct safe_string : public detail::safe_string_impl < T, detail::OwnerFree<T> >
-{
- safe_string(PTR p) : detail::safe_string_impl<T, detail::OwnerFree<T>>(p){}
-};
-
extern HINSTANCE g_hInstance;
-
-// #ifdef MIRANDA_VER
-// #undef MIRANDA_VER
-// #endif
-
-// TODO: reference additional headers your program requires here