summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/CryptoPP/src/cpp_cntx.cpp37
-rw-r--r--plugins/CryptoPP/src/cpp_rsam.cpp27
-rw-r--r--src/modules/button/button.cpp10
3 files changed, 38 insertions, 36 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 ) {
diff --git a/plugins/CryptoPP/src/cpp_rsam.cpp b/plugins/CryptoPP/src/cpp_rsam.cpp
index 2b2afe5154..202dffbc94 100644
--- a/plugins/CryptoPP/src/cpp_rsam.cpp
+++ b/plugins/CryptoPP/src/cpp_rsam.cpp
@@ -717,23 +717,23 @@ int __cdecl rsa_recv_thread(HANDLE context, string& msg) {
int features; string sha1,sha2;
un_tlv(un_tlv(un_tlv(data,t[0],features),t[1],sha1),t[2],sha2);
BOOL lr = (p->pub_s==sha1); BOOL ll = (r->pub_s==sha2);
- switch( (lr<<4)|ll ) {
- case 0x11: { // оба паблика совпали
+ switch((lr << 4) | ll) {
+ case 0x11: // оба паблика совпали
inject_msg(context,0x21,gen_aes_key_iv(ptr->mode,p,r));
- p->state=5;
- } break;
- case 0x10: { // совпал удаленный паблик, нужен локальный
+ p->state = 5;
+ break;
+ case 0x10: // совпал удаленный паблик, нужен локальный
inject_msg(context,0x22,tlv(0,features)+tlv(1,r->pub_k)+tlv(2,r->pub_s));
- p->state=3;
- } break;
- case 0x01: { // совпал локальный паблик, нужен удаленный
+ p->state = 3;
+ break;
+ case 0x01: // совпал локальный паблик, нужен удаленный
inject_msg(context,0x23,tlv(0,features));
- p->state=3;
- } break;
- case 0x00: { // не совпали оба паблика
+ p->state = 3;
+ break;
+ case 0x00: // не совпали оба паблика
inject_msg(context,0x24,tlv(0,features)+tlv(1,r->pub_k)+tlv(2,r->pub_s));
- p->state=3;
- } break;
+ p->state = 3;
+ break;
}
} break;
@@ -1079,5 +1079,4 @@ int __cdecl rsa_import_pubkey(HANDLE context, LPSTR pubKey) {
return 0;
}
-
// EOF
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp
index c99048f3db..2f6c2f4a01 100644
--- a/src/modules/button/button.cpp
+++ b/src/modules/button/button.cpp
@@ -283,12 +283,12 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
SendMessage(bct->hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
if (SendMessage(bct->hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) {
- int idx;
TTooltips tt;
tt.ThreadId = GetCurrentThreadId();
mir_cslock lck(csTips);
- if ((idx = lToolTips.getIndex(&tt)) != -1) {
+ int idx = lToolTips.getIndex(&tt);
+ if (idx != -1) {
mir_free(lToolTips[idx]);
lToolTips.remove(idx);
DestroyWindow(bct->hwndToolTips);
@@ -462,14 +462,13 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case BUTTONADDTOOLTIP:
if (wParam) {
- TOOLINFO ti = {0};
if ( !bct->hwndToolTips) {
- int idx;
TTooltips tt;
tt.ThreadId = GetCurrentThreadId();
mir_cslock lck(csTips);
- if ((idx = lToolTips.getIndex(&tt)) != -1)
+ int idx = lToolTips.getIndex(&tt);
+ if (idx != -1)
bct->hwndToolTips = lToolTips[idx]->hwnd;
else {
TTooltips *ptt = (TTooltips*)mir_alloc(sizeof(TTooltips));
@@ -479,6 +478,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
bct->hwndToolTips = ptt->hwnd;
}
}
+ TOOLINFO ti = {0};
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND;
ti.hwnd = bct->hwnd;