From 96d3720a8b42bdd4e2595b57a725930289dc791f Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 5 Feb 2015 19:50:20 +0000 Subject: Various: -some warnings fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@12011 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CmdLine/src/mimcmd_handlers.cpp | 27 ++++++++------------------- plugins/Non-IM Contact/src/contactinfo.cpp | 23 ++++++++++++++++------- plugins/TabSRMM/src/container.cpp | 5 ++++- 3 files changed, 28 insertions(+), 27 deletions(-) (limited to 'plugins') diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 7f0c75260f..15ce90a618 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -121,7 +121,6 @@ void HandleUnknownParameter(PCommand command, char *param, PReply reply) int ParseValueParam(char *param, void *&result) { - int ok = VALUE_UNKNOWN; if (strlen(param) > 0) { switch (*param) @@ -132,10 +131,7 @@ int ParseValueParam(char *param, void *&result) result = (char *) malloc(len * sizeof(char)); STRNCPY((char *) result, param + 1, len); ((char *) result)[len - 1] = 0; - - ok = VALUE_STRING; - - return ok; + return VALUE_STRING; } case 'w': @@ -148,10 +144,7 @@ int ParseValueParam(char *param, void *&result) MultiByteToWideChar(CP_ACP, 0, buffer, -1, (WCHAR *) result, (int) len); free(buffer); - - ok = VALUE_WIDE; - - return ok; + return VALUE_WIDE; } case 'b': @@ -162,9 +155,7 @@ int ParseValueParam(char *param, void *&result) long tmp = strtol(param + 1, &stop, 10); * ((char *) result) = tmp; - ok = (*stop == 0) ? VALUE_BYTE : VALUE_ERROR; - - return ok; + return (*stop == 0) ? VALUE_BYTE : VALUE_ERROR; } case 'i': @@ -175,9 +166,7 @@ int ParseValueParam(char *param, void *&result) long tmp = strtol(param + 1, &stop, 10); * ((int *) result) = tmp; - ok = (*stop == 0) ? VALUE_WORD : VALUE_ERROR; - - return ok; + return (*stop == 0) ? VALUE_WORD : VALUE_ERROR; } case 'd': @@ -186,14 +175,14 @@ int ParseValueParam(char *param, void *&result) char *stop; * ((long *) result) = strtol(param + 1, &stop, 10); - ok = (*stop == 0) ? VALUE_DWORD : VALUE_ERROR; - - return ok; + return (*stop == 0) ? VALUE_DWORD : VALUE_ERRORok; } default: - return ok; + return VALUE_UNKNOWN; } } + else + return VALUE_ERROR; } int ParseStatusParam(char *status) diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index a14a5da846..9bc7750229 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -331,7 +331,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) string = newString[k]; j=0; } - else if (!strncmp(&replace[i], "\r\n",2)) { + else if (!strncmp(replace + i, "\r\n",2)) { if (string == newString[k]) k--; if (k == MAX_REPLACES) break; @@ -344,7 +344,8 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) string[++j] = '\0'; } i++; - } + } + free(replace); hContact2 =(MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact2,(LPARAM)MODNAME); CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE); @@ -616,10 +617,15 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) mir_snprintf(tmp, SIZEOF(tmp), "Icon: On The Phone\r\n"); else if (icon == ID_STATUS_OUTTOLUNCH) mir_snprintf(tmp, SIZEOF(tmp), "Icon: Out To Lunch\r\n"); - else + else { + free(msg); continue; - msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1); - strcat(msg,tmp); + } + char *msgtemp = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1); + if (msgtemp) { + msg = msgtemp; + strcat(msg,tmp); + } } if (usetimer && timer) { char tmp[64],tmp2[8]; @@ -627,8 +633,11 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) strcpy(tmp2,"Minutes"); else strcpy(tmp2,"Seconds"); mir_snprintf(tmp, SIZEOF(tmp), "UseTimer: Yes\r\nTimer: %d %s",timer, tmp2); - msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1); - strcat(msg,tmp); + char *msgtemp = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1); + if (msgtemp) { + msg = msgtemp; + strcat(msg,tmp); + } } if (MessageBoxA(0,msg,modFullname,MB_YESNO) == IDYES) { diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 1c24f0129b..481f1a9950 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -47,7 +47,10 @@ static bool fForceOverlayIcons = false; void TSAPI SetAeroMargins(TContainerData *pContainer) { - if ( !M.isAero() || !pContainer || CSkin::m_skinEnabled) { + if(!pContainer) + return; + + if (!M.isAero() || CSkin::m_skinEnabled) { pContainer->MenuBar->setAero(false); return; } -- cgit v1.2.3