summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-14 17:12:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-14 17:12:59 +0000
commit3761434e0c1f631a78398226e53ca4a25431c2cd (patch)
treeaef21be2deda0708df7a9078fe9cff1cdb57dc84 /plugins
parentb52e0fc9d3e21b7f4d649ace51beca9e61692818 (diff)
built-in base64 removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@5687 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Quotes/Forex_10.vcxproj2
-rw-r--r--plugins/Quotes/Forex_10.vcxproj.filters6
-rw-r--r--plugins/Quotes/Forex_11.vcxproj2
-rw-r--r--plugins/Quotes/Forex_11.vcxproj.filters6
-rw-r--r--plugins/Quotes/src/Base64.cpp42
-rw-r--r--plugins/Quotes/src/Base64.h12
-rw-r--r--plugins/Quotes/src/ImportExport.cpp37
-rw-r--r--plugins/Quotes/src/stdafx.h1
8 files changed, 10 insertions, 98 deletions
diff --git a/plugins/Quotes/Forex_10.vcxproj b/plugins/Quotes/Forex_10.vcxproj
index 9ed238f383..76af179362 100644
--- a/plugins/Quotes/Forex_10.vcxproj
+++ b/plugins/Quotes/Forex_10.vcxproj
@@ -169,7 +169,6 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="src\Base64.cpp" />
<ClCompile Include="src\ComHelper.cpp" />
<ClCompile Include="src\CommonOptionDlg.cpp" />
<ClCompile Include="src\CreateFilePath.cpp" />
@@ -208,7 +207,6 @@
<ClCompile Include="src\XMLEngineMI.cpp" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="src\Base64.h" />
<ClInclude Include="src\Chart.h" />
<ClInclude Include="src\ComHelper.h" />
<ClInclude Include="src\CommonOptionDlg.h" />
diff --git a/plugins/Quotes/Forex_10.vcxproj.filters b/plugins/Quotes/Forex_10.vcxproj.filters
index 869ce3fc50..53168a3a39 100644
--- a/plugins/Quotes/Forex_10.vcxproj.filters
+++ b/plugins/Quotes/Forex_10.vcxproj.filters
@@ -15,9 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\Base64.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\ComHelper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -122,9 +119,6 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="src\Base64.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\ComHelper.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Quotes/Forex_11.vcxproj b/plugins/Quotes/Forex_11.vcxproj
index 256cde449f..57225acfc7 100644
--- a/plugins/Quotes/Forex_11.vcxproj
+++ b/plugins/Quotes/Forex_11.vcxproj
@@ -172,7 +172,6 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="src\Base64.cpp" />
<ClCompile Include="src\ComHelper.cpp" />
<ClCompile Include="src\CommonOptionDlg.cpp" />
<ClCompile Include="src\CreateFilePath.cpp" />
@@ -211,7 +210,6 @@
<ClCompile Include="src\XMLEngineMI.cpp" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="src\Base64.h" />
<ClInclude Include="src\Chart.h" />
<ClInclude Include="src\ComHelper.h" />
<ClInclude Include="src\CommonOptionDlg.h" />
diff --git a/plugins/Quotes/Forex_11.vcxproj.filters b/plugins/Quotes/Forex_11.vcxproj.filters
index 869ce3fc50..53168a3a39 100644
--- a/plugins/Quotes/Forex_11.vcxproj.filters
+++ b/plugins/Quotes/Forex_11.vcxproj.filters
@@ -15,9 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\Base64.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\ComHelper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -122,9 +119,6 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="src\Base64.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\ComHelper.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Quotes/src/Base64.cpp b/plugins/Quotes/src/Base64.cpp
deleted file mode 100644
index ac8c56ed14..0000000000
--- a/plugins/Quotes/src/Base64.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "StdAfx.h"
-
-bool base64::encode(const BYTE* in, size_t inlen,std::vector<char>& out)
-{
- int nOutLength = Base64EncodeGetRequiredLength((int)inlen);
- out.resize(nOutLength);
- char* p = &*out.begin();
- bool bResult = (TRUE == Base64Encode(in,(int)inlen,p,&nOutLength));
- if(false == bResult)
- {
- out.resize(nOutLength);
- p = &*out.begin();
- bResult = (TRUE == Base64Encode(in,(int)inlen,p,&nOutLength));
- }
- if(bResult)
- {
- out.resize(nOutLength);
- }
-
- return bResult;
-}
-
-
-bool base64::decode(const char* in, size_t inlen,std::vector<BYTE>& out)
-{
- int nOutLength = (int)inlen;
- out.resize(nOutLength);
- BYTE* p = &*out.begin();
- bool bResult = TRUE == Base64Decode(in,(int)inlen,p,&nOutLength);
- if(false == bResult)
- {
- out.resize(nOutLength);
- p = &*out.begin();
- bResult = TRUE == Base64Decode(in,(int)inlen,p,&nOutLength);
- }
- if(bResult)
- {
- out.resize(nOutLength);
- }
-
- return true;
-}
diff --git a/plugins/Quotes/src/Base64.h b/plugins/Quotes/src/Base64.h
deleted file mode 100644
index 3f911bfeb8..0000000000
--- a/plugins/Quotes/src/Base64.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __FBB8ABCA_315E_4ace_B2EB_51E03AD6F8D1_Base64_h__
-#define __FBB8ABCA_315E_4ace_B2EB_51E03AD6F8D1_Base64_h__
-
-#pragma once
-
-namespace base64
-{
- bool encode(const BYTE* in, size_t inlen,std::vector<char>& out);
- bool decode(const char* in, size_t inlen,std::vector<BYTE>& out);
-}
-
-#endif //__FBB8ABCA_315E_4ace_B2EB_51E03AD6F8D1_Base64_h__
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp
index 6c7d7fc1fa..15d72b84fb 100644
--- a/plugins/Quotes/src/ImportExport.cpp
+++ b/plugins/Quotes/src/ImportExport.cpp
@@ -94,11 +94,9 @@ namespace
sType = g_pszXmlTypeBlob;
if(dbv.pbVal)
{
- std::vector<char> buf;
- if(true == base64::encode(dbv.pbVal,dbv.cpbVal,buf))
- {
- buf.push_back('\0');
- sValue << &*buf.begin();
+ ptrA buf = mir_base64_encode(dbv.pbVal, dbv.cpbVal);
+ if (buf) {
+ sValue << buf;
}
}
break;
@@ -368,9 +366,7 @@ namespace
{
dbs.value.type = DBVT_BYTE;
if(set_contact_settings(hContact,dbs))
- {
++cCreatedRecords;
- }
}
}
else if(0 == quotes_stricmp(g_pszXmlTypeWord,sType.c_str()))
@@ -382,9 +378,7 @@ namespace
{
dbs.value.type = DBVT_WORD;
if(set_contact_settings(hContact,dbs))
- {
++cCreatedRecords;
- }
}
}
else if(0 == quotes_stricmp(g_pszXmlTypeDword,sType.c_str()))
@@ -396,9 +390,7 @@ namespace
{
dbs.value.type = DBVT_DWORD;
if(set_contact_settings(hContact,dbs))
- {
++cCreatedRecords;
- }
}
}
else if(0 == quotes_stricmp(g_pszXmlTypeAsciiz,sType.c_str()))
@@ -407,18 +399,15 @@ namespace
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()))
{
dbs.value.pszVal = mir_utf8encodeT(sValue.c_str());
dbs.value.type = DBVT_UTF8;
if(set_contact_settings(hContact,dbs))
- {
++cCreatedRecords;
- }
+
mir_free(dbs.value.pszVal);
}
else if(0 == quotes_stricmp(g_pszXmlTypeWchar,sType.c_str()))
@@ -427,32 +416,26 @@ namespace
dbs.value.pwszVal = val;
dbs.value.type = DBVT_WCHAR;
if(set_contact_settings(hContact,dbs))
- {
++cCreatedRecords;
- }
+
mir_free(dbs.value.pwszVal);
}
else if(0 == quotes_stricmp(g_pszXmlTypeBlob,sType.c_str()))
{
- std::vector<BYTE> blob_buf;
- std::string p = quotes_t2a(sValue.c_str());//T2A(sValue.c_str());
- if(true == base64::decode(p.c_str(),lstrlenA(p.c_str()),blob_buf))
- {
- dbs.value.pbVal = &*blob_buf.begin();
- dbs.value.cpbVal = (WORD)blob_buf.size();
+ unsigned bufLen;
+ mir_ptr<BYTE> buf((PBYTE)mir_base64_decode(_T2A(sValue.c_str()), &bufLen));
+ if(buf) {
+ dbs.value.pbVal = buf;
+ dbs.value.cpbVal = (WORD)bufLen;
dbs.value.type = DBVT_BLOB;
if(set_contact_settings(hContact,dbs))
- {
++cCreatedRecords;
- }
}
}
if ((true == bCListModule) && (0 == quotes_stricmp(sName.c_str(),_T("Group"))))
- {
CallService(MS_CLIST_GROUPCREATE,NULL,reinterpret_cast<LPARAM>(sValue.c_str()));
- }
}
}
}
diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h
index aa9fe75d34..57ef426d99 100644
--- a/plugins/Quotes/src/stdafx.h
+++ b/plugins/Quotes/src/stdafx.h
@@ -93,7 +93,6 @@ inline int quotes_stricmp(LPCTSTR p1,LPCTSTR p2)
#include "CurrencyConverter.h"
#include "WinCtrlHelper.h"
#include "ImportExport.h"
-#include "Base64.h"
#include "ComHelper.h"
#include "Log.h"
#include "CommonOptionDlg.h"