diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-07 21:50:44 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-07 21:50:44 +0000 |
commit | 2236e9a252983edcce561223534041629935d750 (patch) | |
tree | 8425c78b92568a3a8931f5bab07ed3eea86ae067 /plugins/CryptoPP/src/cpp_cntx.cpp | |
parent | acfdcaaea2a735e2bf2dcf2c3144f429081078c0 (diff) |
various code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@6820 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/src/cpp_cntx.cpp')
-rw-r--r-- | plugins/CryptoPP/src/cpp_cntx.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/plugins/CryptoPP/src/cpp_cntx.cpp b/plugins/CryptoPP/src/cpp_cntx.cpp index 54a4d88bed..62ee204079 100644 --- a/plugins/CryptoPP/src/cpp_cntx.cpp +++ b/plugins/CryptoPP/src/cpp_cntx.cpp @@ -1,7 +1,8 @@ #include "commonheaders.h"
// get context data on context id
-pCNTX get_context_on_id(HANDLE context) {
+pCNTX get_context_on_id(HANDLE context)
+{
if ( context ) {
pCNTX cntx = (pCNTX) context;
if ( cntx->header == HEADER && cntx->footer == FOOTER )
@@ -15,7 +16,8 @@ pCNTX get_context_on_id(HANDLE context) { }
// create context, return context id
-HANDLE __cdecl cpp_create_context(int mode) {
+HANDLE __cdecl cpp_create_context(int mode)
+{
pCNTX cntx = (pCNTX) malloc(sizeof(CNTX));
memset(cntx,0,sizeof(CNTX)); // очищаем выделенный блок
cntx->header = HEADER;
@@ -26,7 +28,8 @@ HANDLE __cdecl cpp_create_context(int mode) { // delete context
-void __cdecl cpp_delete_context(HANDLE context) {
+void __cdecl cpp_delete_context(HANDLE context)
+{
pCNTX tmp = get_context_on_id(context);
if (tmp) { // помечаем на удаление
cpp_free_keys(tmp);
@@ -36,40 +39,40 @@ void __cdecl cpp_delete_context(HANDLE context) { // reset context
-void __cdecl cpp_reset_context(HANDLE context) {
+void __cdecl cpp_reset_context(HANDLE context)
+{
pCNTX tmp = get_context_on_id(context);
if (tmp) cpp_free_keys(tmp);
}
// allocate pdata
-PBYTE cpp_alloc_pdata(pCNTX ptr) {
+PBYTE cpp_alloc_pdata(pCNTX ptr)
+{
if ( !ptr->pdata ) {
- if ( ptr->mode & MODE_PGP ) {
+ if ( ptr->mode & MODE_PGP ) {
ptr->pdata = (PBYTE) malloc(sizeof(PGPDATA));
memset(ptr->pdata,0,sizeof(PGPDATA));
- }
- else
- if ( ptr->mode & MODE_GPG ) {
+ }
+ else if ( ptr->mode & MODE_GPG ) {
ptr->pdata = (PBYTE) malloc(sizeof(GPGDATA));
memset(ptr->pdata,0,sizeof(GPGDATA));
- }
- else
- if ( ptr->mode & MODE_RSA ) {
+ }
+ else if ( ptr->mode & MODE_RSA ) {
rsa_alloc(ptr);
- }
- else {
+ }
+ else {
ptr->pdata = (PBYTE) malloc(sizeof(SIMDATA));
memset(ptr->pdata,0,sizeof(SIMDATA));
- }
+ }
}
return ptr->pdata;
}
// free memory from keys
-void cpp_free_keys(pCNTX ptr) {
-
+void cpp_free_keys(pCNTX ptr)
+{
replaceStr(ptr->tmp, 0);
cpp_alloc_pdata(ptr);
if ( ptr->mode & MODE_PGP ) {
|