From 371c87af33810c934034161947c143ccbf6aa01b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 23 Jul 2015 08:28:34 +0000 Subject: various warning & compilation fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@14648 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirOTR/Libgcrypt/cipher/cipher.c | 8 +- plugins/MirOTR/Libgcrypt/cipher/mac.c | 2 +- plugins/MirOTR/Libgcrypt/cipher/md.c | 8 +- plugins/MirOTR/Libgcrypt/cipher/pubkey-util.c | 4 +- plugins/MirOTR/Libgcrypt/cipher/pubkey.c | 4 +- plugins/MirOTR/Libgcrypt/custom/config.h | 3 - plugins/MirOTR/Libgcrypt/mpi/mpi-mpow.c | 2 +- plugins/MirOTR/Libgcrypt/src/visibility.c | 5 +- plugins/MirOTR/ekhtml/include/ekhtml_config.h | 3 - plugins/MirOTR/ekhtml/src/ekhtml.c | 5 +- plugins/MirOTR/ekhtml/src/ekhtml_mktables.c | 2 +- plugins/MirOTR/ekhtml/src/ekhtml_starttag.c | 10 +- plugins/MirOTR/src/entities.cpp | 4 +- plugins/MirOTR/src/stdafx.h | 2 +- plugins/Quotes/src/QuoteInfoDlg.cpp | 174 +++++++++++--------------- 15 files changed, 99 insertions(+), 137 deletions(-) diff --git a/plugins/MirOTR/Libgcrypt/cipher/cipher.c b/plugins/MirOTR/Libgcrypt/cipher/cipher.c index 8c5a0b4ed8..6a42bfaa30 100644 --- a/plugins/MirOTR/Libgcrypt/cipher/cipher.c +++ b/plugins/MirOTR/Libgcrypt/cipher/cipher.c @@ -124,12 +124,12 @@ spec_from_name (const char *name) for (idx=0; (spec = cipher_list[idx]); idx++) { - if (!stricmp (name, spec->name)) + if (!_stricmp (name, spec->name)) return spec; if (spec->aliases) { for (aliases = spec->aliases; *aliases; aliases++) - if (!stricmp (name, *aliases)) + if (!_stricmp (name, *aliases)) return spec; } } @@ -152,7 +152,7 @@ spec_from_oid (const char *oid) if (oid_specs) { for (j = 0; oid_specs[j].oid; j++) - if (!stricmp (oid, oid_specs[j].oid)) + if (!_stricmp (oid, oid_specs[j].oid)) return spec; } } @@ -180,7 +180,7 @@ search_oid (const char *oid, gcry_cipher_oid_spec_t *oid_spec) if (spec && spec->oids) { for (i = 0; spec->oids[i].oid; i++) - if (!stricmp (oid, spec->oids[i].oid)) + if (!_stricmp (oid, spec->oids[i].oid)) { if (oid_spec) *oid_spec = spec->oids[i]; diff --git a/plugins/MirOTR/Libgcrypt/cipher/mac.c b/plugins/MirOTR/Libgcrypt/cipher/mac.c index d87ac13761..5514ddc3a8 100644 --- a/plugins/MirOTR/Libgcrypt/cipher/mac.c +++ b/plugins/MirOTR/Libgcrypt/cipher/mac.c @@ -129,7 +129,7 @@ spec_from_name (const char *name) int idx; for (idx = 0; (spec = mac_list[idx]); idx++) - if (!stricmp (name, spec->name)) + if (!_stricmp (name, spec->name)) return spec; return NULL; diff --git a/plugins/MirOTR/Libgcrypt/cipher/md.c b/plugins/MirOTR/Libgcrypt/cipher/md.c index 008ef5b230..20b652e03b 100644 --- a/plugins/MirOTR/Libgcrypt/cipher/md.c +++ b/plugins/MirOTR/Libgcrypt/cipher/md.c @@ -153,7 +153,7 @@ spec_from_name (const char *name) for (idx=0; (spec = digest_list[idx]); idx++) { - if (!stricmp (name, spec->name)) + if (!_stricmp (name, spec->name)) return spec; } @@ -175,7 +175,7 @@ spec_from_oid (const char *oid) if (oid_specs) { for (j = 0; oid_specs[j].oidstring; j++) - if (!stricmp (oid, oid_specs[j].oidstring)) + if (!_stricmp (oid, oid_specs[j].oidstring)) return spec; } } @@ -198,7 +198,7 @@ search_oid (const char *oid, gcry_md_oid_spec_t *oid_spec) if (spec && spec->oids) { for (i = 0; spec->oids[i].oidstring; i++) - if (!stricmp (oid, spec->oids[i].oidstring)) + if (!_stricmp (oid, spec->oids[i].oidstring)) { if (oid_spec) *oid_spec = spec->oids[i]; @@ -1141,7 +1141,7 @@ md_stop_debug( gcry_md_hd_t md ) #ifdef HAVE_U64_TYPEDEF { /* a kludge to pull in the __muldi3 for Solaris */ - volatile u32 a = (u32)(ulong)md; + volatile u32 a = (u32)md; volatile u64 b = 42; volatile u64 c; c = a * b; diff --git a/plugins/MirOTR/Libgcrypt/cipher/pubkey-util.c b/plugins/MirOTR/Libgcrypt/cipher/pubkey-util.c index 616b4990fe..71312828bf 100644 --- a/plugins/MirOTR/Libgcrypt/cipher/pubkey-util.c +++ b/plugins/MirOTR/Libgcrypt/cipher/pubkey-util.c @@ -391,7 +391,7 @@ _gcry_pk_util_preparse_sigval (gcry_sexp_t s_sig, const char **algo_names, } for (i=0; algo_names[i]; i++) - if (!stricmp (name, algo_names[i])) + if (!_stricmp (name, algo_names[i])) break; if (!algo_names[i]) { @@ -562,7 +562,7 @@ _gcry_pk_util_preparse_encval (gcry_sexp_t sexp, const char **algo_names, parsed_flags |= PUBKEY_FLAG_LEGACYRESULT; for (i=0; algo_names[i]; i++) - if (!stricmp (name, algo_names[i])) + if (!_stricmp (name, algo_names[i])) break; if (!algo_names[i]) { diff --git a/plugins/MirOTR/Libgcrypt/cipher/pubkey.c b/plugins/MirOTR/Libgcrypt/cipher/pubkey.c index b31e9df2f9..d8f5f5d0ea 100644 --- a/plugins/MirOTR/Libgcrypt/cipher/pubkey.c +++ b/plugins/MirOTR/Libgcrypt/cipher/pubkey.c @@ -96,10 +96,10 @@ spec_from_name (const char *name) for (idx=0; (spec = pubkey_list[idx]); idx++) { - if (!stricmp (name, spec->name)) + if (!_stricmp (name, spec->name)) return spec; for (aliases = spec->aliases; *aliases; aliases++) - if (!stricmp (name, *aliases)) + if (!_stricmp (name, *aliases)) return spec; } diff --git a/plugins/MirOTR/Libgcrypt/custom/config.h b/plugins/MirOTR/Libgcrypt/custom/config.h index bee3c5761e..5263060745 100644 --- a/plugins/MirOTR/Libgcrypt/custom/config.h +++ b/plugins/MirOTR/Libgcrypt/custom/config.h @@ -618,9 +618,6 @@ /* Miranda NG modifications */ #define GPGRT_ENABLE_ES_MACROS 1 #include -#define strdup _strdup -#define stricmp _stricmp -#define snprintf _snprintf #ifdef _WIN64 # define __x86_64__ 1 #else diff --git a/plugins/MirOTR/Libgcrypt/mpi/mpi-mpow.c b/plugins/MirOTR/Libgcrypt/mpi/mpi-mpow.c index 43bd641fb5..0e84e99861 100644 --- a/plugins/MirOTR/Libgcrypt/mpi/mpi-mpow.c +++ b/plugins/MirOTR/Libgcrypt/mpi/mpi-mpow.c @@ -89,7 +89,7 @@ _gcry_mpi_mulpowm( gcry_mpi_t res, gcry_mpi_t *basearray, gcry_mpi_t *exparray, gcry_assert (t); gcry_assert (k < 10); - G = xcalloc( (1< -#define strdup _strdup -#define stricmp _stricmp -#define snprintf _snprintf #ifdef _WIN64 # define __x86_64__ 1 #else diff --git a/plugins/MirOTR/ekhtml/src/ekhtml.c b/plugins/MirOTR/ekhtml/src/ekhtml.c index 012a543b91..5a6a3f5db2 100644 --- a/plugins/MirOTR/ekhtml/src/ekhtml.c +++ b/plugins/MirOTR/ekhtml/src/ekhtml.c @@ -90,8 +90,7 @@ static void ekhtml_buffer_grow(ekhtml_parser_t *parser){ newsize = parser->nalloced + EKHTML_BLOCKSIZE; if((newbuf = realloc(parser->buf, newsize)) == NULL){ - fprintf(stderr, "BAD! Can't allocate %d bytes in ekhtml_buffer_grow\n", - newsize); + fprintf(stderr, "BAD! Can't allocate %d bytes in ekhtml_buffer_grow\n", (int)newsize); fflush(stderr); /* Just in case someone changes the buffering scheme */ } @@ -279,7 +278,7 @@ ekhtml_parser_startendcb_add(ekhtml_parser_t *parser, const char *tag, } - newtag = strdup(tag); + newtag = _strdup(tag); for(cp=newtag; *cp; cp++) *cp = toupper(*cp); diff --git a/plugins/MirOTR/ekhtml/src/ekhtml_mktables.c b/plugins/MirOTR/ekhtml/src/ekhtml_mktables.c index 412b313467..e9d2102325 100644 --- a/plugins/MirOTR/ekhtml/src/ekhtml_mktables.c +++ b/plugins/MirOTR/ekhtml/src/ekhtml_mktables.c @@ -111,7 +111,7 @@ static void print_charmap(char *name, EKHTML_CHARMAP_TYPE (*cmap_func)(char)){ int ch; char sbuf[256]; - sprintf(sbuf, "0x%%0%dx ", EKHTML_CHARMAP_LEN * 2); + sprintf(sbuf, "0x%%0%dx ", (int)EKHTML_CHARMAP_LEN * 2); printf("#ifdef EKHTML_USE_TABLES\n"); printf("const %s %s[256] = {\n", EKHTML_CHARMAP_TYPE_S, name); for(ch=0; ch < 256; ch++){ diff --git a/plugins/MirOTR/ekhtml/src/ekhtml_starttag.c b/plugins/MirOTR/ekhtml/src/ekhtml_starttag.c index d0770851cf..ff2c6c79d7 100644 --- a/plugins/MirOTR/ekhtml/src/ekhtml_starttag.c +++ b/plugins/MirOTR/ekhtml/src/ekhtml_starttag.c @@ -147,9 +147,9 @@ static void handle_starttag(ekhtml_parser_t *parser, char *curp, /* Formulate real attribute callback data from the 'offset' pointer values */ for(attr=sstate->attrs;attr;attr=attr->next){ - attr->name.str = curp + (int)attr->name.str; + attr->name.str = curp + (size_t)attr->name.str; if(!attr->isBoolean) - attr->val.str = curp + (int)attr->val.str; + attr->val.str = curp + (size_t)attr->val.str; } cback(parser->cbdata, &str, sstate->attrs); @@ -254,7 +254,7 @@ char *ekhtml_parse_starttag(ekhtml_parser_t *parser, void **state_data, /* There be dragons here -- watch out -- see comment @ top of file */ startstate->curattr->name.len = - workp - (curp + (int)startstate->curattr->name.str); + workp - (curp + (size_t)startstate->curattr->name.str); if(*workp == '='){ startstate->mode = EKHTML_STMODE_BEGVALUE; workp++; /* Skip the equals sign */ @@ -331,7 +331,7 @@ char *ekhtml_parse_starttag(ekhtml_parser_t *parser, void **state_data, for(;workp != endp && *workp != '>' && *workp != '<'; workp++){ if(*workp == startstate->quote){ startstate->curattr->val.len = - workp - (curp + (int)startstate->curattr->val.str); + workp - (curp + (size_t)startstate->curattr->val.str); scroll_attribute(startstate); startstate->mode = EKHTML_STMODE_BEGNAME; workp++; /* Skip the quote */ @@ -350,7 +350,7 @@ char *ekhtml_parse_starttag(ekhtml_parser_t *parser, void **state_data, break; startstate->curattr->val.len = - workp - (curp + (int)startstate->curattr->val.str); + workp - (curp + (size_t)startstate->curattr->val.str); scroll_attribute(startstate); if(*workp == '>' || *workp == '<') { diff --git a/plugins/MirOTR/src/entities.cpp b/plugins/MirOTR/src/entities.cpp index 916bebd608..f049ad0b88 100644 --- a/plugins/MirOTR/src/entities.cpp +++ b/plugins/MirOTR/src/entities.cpp @@ -317,7 +317,7 @@ static size_t putc_utf8(unsigned long cp, char *buffer) return 0; } -static _Bool parse_entity(const char *current, char **to, +static bool parse_entity(const char *current, char **to, const char **from, size_t maxlen) { const char *end = (const char *)memchr(current, ';', maxlen); @@ -328,7 +328,7 @@ static _Bool parse_entity(const char *current, char **to, char *tail = NULL; errno = 0; - _Bool hex = current[2] == 'x' || current[2] == 'X'; + bool hex = current[2] == 'x' || current[2] == 'X'; unsigned long cp = strtoul( current + (hex ? 3 : 2), &tail, hex ? 16 : 10); diff --git a/plugins/MirOTR/src/stdafx.h b/plugins/MirOTR/src/stdafx.h index b675f3314c..4d1be59d91 100644 --- a/plugins/MirOTR/src/stdafx.h +++ b/plugins/MirOTR/src/stdafx.h @@ -7,7 +7,7 @@ #define _CRT_NON_CONFORMING_SWPRINTFS #define _CRT_SECURE_NO_WARNINGS -#define WIN32_LEAN_AND_MEAN // Selten verwendete Teile der Windows-Header nicht einbinden. +#define WIN32_LEAN_AND_MEAN #include #include diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index 01149affe1..8a6c551310 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -11,43 +11,33 @@ extern HGENMENU g_hMenuRefresh; #define WINDOW_PREFIX_INFO "Quote Info" +MCONTACT g_hContact; -namespace +inline bool IsMyContact(MCONTACT hContact) { - MCONTACT g_hContact; - - inline bool IsMyContact(MCONTACT hContact) - { - CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); - return (NULL != pProvider); - } - - inline MCONTACT get_contact(HWND hWnd) - { - return MCONTACT(GetWindowLongPtr(hWnd, GWLP_USERDATA)); - } + CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); + return (NULL != pProvider); +} +inline MCONTACT get_contact(HWND hWnd) +{ + return MCONTACT(GetWindowLongPtr(hWnd, GWLP_USERDATA)); +} - bool get_fetch_time(time_t& rTime, MCONTACT hContact) - { - DBVARIANT dbv; - if (db_get(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FETCH_TIME, &dbv) || (DBVT_DWORD != dbv.type)) - return false; +bool get_fetch_time(time_t& rTime, MCONTACT hContact) +{ + rTime = db_get_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FETCH_TIME, -1); + return (rTime != -1); +} - rTime = dbv.dVal; - return true; - } +INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + assert(hContact); - INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) + TranslateDialogDefault(hdlg); { - case WM_INITDIALOG: - { - assert(hContact); - - TranslateDialogDefault(hdlg); - tstring sDescription = GetContactName(hContact); ::SetDlgItemText(hdlg, IDC_STATIC_QUOTE_NAME, sDescription.c_str()); @@ -91,29 +81,25 @@ namespace ::SetDlgItemText(hdlg, IDC_SYSLINK_PROVIDER, o.str().c_str()); } return TRUE; - case WM_NOTIFY: - { - LPNMHDR pNMHDR = reinterpret_cast(lParam); - switch (pNMHDR->code) - { - case NM_CLICK: - if (IDC_SYSLINK_PROVIDER == wParam) - { - PNMLINK pNMLink = reinterpret_cast(pNMHDR); - ::ShellExecute(hdlg, _T("open"), pNMLink->item.szUrl, NULL, NULL, SW_SHOWNORMAL); - } - break; + + case WM_NOTIFY: + LPNMHDR pNMHDR = reinterpret_cast(lParam); + switch (pNMHDR->code) { + case NM_CLICK: + if (IDC_SYSLINK_PROVIDER == wParam) { + PNMLINK pNMLink = reinterpret_cast(pNMHDR); + ::ShellExecute(hdlg, _T("open"), pNMLink->item.szUrl, NULL, NULL, SW_SHOWNORMAL); } + break; } break; - } - return FALSE; } + return FALSE; +} - INT_PTR CALLBACK QuoteInfoDlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) - { - return QuoteInfoDlgProcImpl(g_hContact, hdlg, msg, wParam, lParam); - } +INT_PTR CALLBACK QuoteInfoDlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + return QuoteInfoDlgProcImpl(g_hContact, hdlg, msg, wParam, lParam); } int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp) @@ -142,13 +128,8 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp) INT_PTR QuotesMenu_EditSettings(WPARAM wp, LPARAM) { MCONTACT hContact = MCONTACT(wp); - if (NULL == hContact) - { - return 0; - } - - ShowSettingsDlg(hContact); - + if (NULL != hContact) + ShowSettingsDlg(hContact); return 0; } @@ -165,15 +146,11 @@ INT_PTR QuotesMenu_OpenLogFile(WPARAM wp, LPARAM) { MCONTACT hContact = MCONTACT(wp); if (NULL == hContact) - { return 0; - } tstring sLogFileName; if ((true == get_log_file(hContact, sLogFileName)) && (false == sLogFileName.empty())) - { ::ShellExecute(NULL, _T("open"), sLogFileName.c_str(), NULL, NULL, SW_SHOWNORMAL); - } return 0; } @@ -182,70 +159,61 @@ INT_PTR QuotesMenu_RefreshContact(WPARAM wp, LPARAM) { MCONTACT hContact = MCONTACT(wp); if (NULL == hContact) - { return 0; - } CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); if (!pProvider) - { return 0; - } pProvider->RefreshContact(hContact); - return 0; } -namespace +static INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) { - INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) - { - MCONTACT hContact = NULL; - switch (msg) { - case WM_INITDIALOG: - { - hContact = MCONTACT(lParam); - MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, false); - assert(hWL); - WindowList_Add(hWL, hdlg, hContact); + MCONTACT hContact = NULL; + MWindowList hWL; - ::SetWindowLongPtr(hdlg, GWLP_USERDATA, hContact); - Utils_RestoreWindowPositionNoSize(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO); - ::ShowWindow(hdlg, SW_SHOW); - } + switch (msg) { + case WM_INITDIALOG: + hContact = MCONTACT(lParam); + hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, false); + assert(hWL); + WindowList_Add(hWL, hdlg, hContact); + + ::SetWindowLongPtr(hdlg, GWLP_USERDATA, hContact); + Utils_RestoreWindowPositionNoSize(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO); + ::ShowWindow(hdlg, SW_SHOW); break; - case WM_CLOSE: - DestroyWindow(hdlg); - return FALSE; - case WM_DESTROY: - { - MCONTACT hContact = get_contact(hdlg); - if (hContact) - { - SetWindowLongPtr(hdlg, GWLP_USERDATA, 0); - MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, false); - assert(hWL); - WindowList_Remove(hWL, hdlg); - Utils_SaveWindowPosition(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO); - } + case WM_CLOSE: + DestroyWindow(hdlg); + return FALSE; + + case WM_DESTROY: + hContact = get_contact(hdlg); + if (hContact) { + SetWindowLongPtr(hdlg, GWLP_USERDATA, 0); + + hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, false); + assert(hWL); + WindowList_Remove(hWL, hdlg); + Utils_SaveWindowPosition(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO); } return FALSE; - case WM_COMMAND: - if (LOWORD(wParam) == IDOK) - { - ::DestroyWindow(hdlg); - return FALSE; - } - default: - hContact = get_contact(hdlg); - break; + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) { + ::DestroyWindow(hdlg); + return FALSE; } - return QuoteInfoDlgProcImpl(hContact, hdlg, msg, wParam, lParam); + default: + hContact = get_contact(hdlg); + break; } + + return QuoteInfoDlgProcImpl(hContact, hdlg, msg, wParam, lParam); } int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/) -- cgit v1.2.3