diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-19 14:35:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-19 14:35:34 +0000 |
commit | 41f218316dce6b1bfcfb0f2754379fa74c5138ed (patch) | |
tree | 1cd44fe63c6ebabf70d8c4b6f34be37ab8e844f7 | |
parent | 397e25f2b71347c7c83495fe5b25496ff3b02b75 (diff) |
warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@6534 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_core.h | 4 | ||||
-rw-r--r-- | plugins/AVS/src/poll.cpp | 8 | ||||
-rw-r--r-- | plugins/AVS/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/AdvaImg/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/Alarms/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/cpuusage.cpp | 2 | ||||
-rw-r--r-- | plugins/BasicHistory/src/EventList.cpp | 3 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Scheduler.cpp | 2 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_folders.h | 10 | ||||
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 5 | ||||
-rw-r--r-- | plugins/Scriver/src/msgtimedout.cpp | 2 | ||||
-rw-r--r-- | plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp | 2 | ||||
-rw-r--r-- | plugins/StatusPlugins/AdvancedAutoAway/options.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/manager.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/tools.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/eventpopups.cpp | 2 | ||||
-rw-r--r-- | protocols/AimOscar/src/conv.cpp | 2 | ||||
-rw-r--r-- | src/modules/options/iconheader.cpp | 2 |
18 files changed, 23 insertions, 39 deletions
diff --git a/include/m_core.h b/include/m_core.h index e242aa38f5..5357bc79b1 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -534,10 +534,6 @@ MIR_CORE_DLL(int) mir_writeLogVW(HANDLE logger, const WCHAR *format, va_list arg ///////////////////////////////////////////////////////////////////////////////
// md5 functions
-/* Define the state of the MD5 Algorithm. */
-typedef unsigned char BYTE; /* 8-bit byte */
-typedef unsigned int UINT32; /* 32-bit word */
-
typedef struct mir_md5_state_s {
UINT32 count[2]; /* message length in bits, lsw first */
UINT32 abcd[4]; /* digest buffer */
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index 22968fe5a0..840c3d78b9 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -136,11 +136,9 @@ static void QueueAdd(HANDLE hContact, int waitTime) return;
QueueItem *item = new QueueItem;
- if (item != NULL) {
- item->hContact = hContact;
- item->check_time = GetTickCount() + waitTime;
- queue.insert(item);
- }
+ item->hContact = hContact;
+ item->check_time = GetTickCount() + waitTime;
+ queue.insert(item);
}
// Add an contact to a queue
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 7aa9f205d3..ab79fc7b85 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -125,7 +125,7 @@ void MakePathRelative(HANDLE hContact, TCHAR *path) szFinalPath[0] = '\0';
size_t result = AVS_pathToRelative(path, szFinalPath);
- if (result && lstrlen(szFinalPath) > 0) {
+ if (result && szFinalPath[0] != '\0') {
db_set_ts(hContact, "ContactPhoto", "RFile", szFinalPath);
if (!db_get_b(hContact, "ContactPhoto", "Locked", 0))
db_set_ts(hContact, "ContactPhoto", "Backup", szFinalPath);
diff --git a/plugins/AdvaImg/src/main.cpp b/plugins/AdvaImg/src/main.cpp index 83b092a59a..9c7bdb698a 100644 --- a/plugins/AdvaImg/src/main.cpp +++ b/plugins/AdvaImg/src/main.cpp @@ -759,7 +759,7 @@ extern "C" BOOL __declspec(dllexport) dib2mempng( BITMAPINFO* pbmi, png_byte* pD } }
else {
for ( j = 0; j < pbmi->bmiHeader.biWidth; j++ ) {
- DWORD point;
+ DWORD point = 0;
if ( ciChannels == 1 ) {
*d++ = ( BYTE )( point & 0x03 ) << 6;
*d++ = ( BYTE )(( point & 0x0C ) >> 2 ) << 6;
@@ -772,7 +772,7 @@ extern "C" BOOL __declspec(dllexport) dib2mempng( BITMAPINFO* pbmi, png_byte* pD *d++ = ( BYTE )(( point & 0x001F ) << 3 );
*d++ = ( BYTE )((( point & 0x07e0 ) >> 6 ) << 3 );
*d++ = ( BYTE )((( point & 0xF800 ) >> 11 ) << 3 );
- } } } }
+ } } } }
png_write_image (png_ptr, ppbRowPointers);
png_write_end(png_ptr, info_ptr);
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 68657c65f7..9d52447fc0 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -538,7 +538,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemText(hwndDlg, IDC_DESC, buff, MAX_PATH);
replaceStrT(add_edit_alarm->szDesc, buff);
- if (add_edit_alarm->szTitle == 0 || _tcslen(add_edit_alarm->szTitle) == 0) {
+ if (add_edit_alarm->szTitle == 0 || add_edit_alarm->szTitle[0] == '\0') {
MessageBox(hwndDlg, TranslateT("Please enter a title for this alarm."), TranslateT("Error"), MB_OK | MB_ICONERROR);
return TRUE;
}
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp index cc4a3fac15..5009f0b998 100644 --- a/plugins/AutoShutdown/src/cpuusage.cpp +++ b/plugins/AutoShutdown/src/cpuusage.cpp @@ -130,7 +130,7 @@ static void WinNT_PollThread(void *vparam) pPerfInstance=(PERF_INSTANCE_DEFINITION*)((BYTE*)pPerfObj+pPerfObj->DefinitionLength);
for(lCount=0;lCount<(pPerfObj->NumInstances);++lCount) {
pPerfCounterBlock=(PERF_COUNTER_BLOCK*)((BYTE*)pPerfInstance+pPerfInstance->ByteLength);
- if (!lstrcmpiW(pwszInstanceName,(WCHAR*)((BYTE*)pPerfInstance+pPerfInstance->NameOffset)) || !pwszInstanceName) {
+ if (!lstrcmpiW(pwszInstanceName,(WCHAR*)((BYTE*)pPerfInstance+pPerfInstance->NameOffset))) {
liCurrentCounterValue=*(LARGE_INTEGER*)((BYTE*)pPerfCounterBlock+pPerfCounter->CounterOffset);
fFound=TRUE;
break;
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 4f98cb34e7..93e3440f72 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -643,7 +643,7 @@ void EventList::MargeMessages(const std::vector<IImport::ExternalMessage>& messa dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, NULL, NULL);
dbei.pBlob = (PBYTE)buf;
db_event_add(hContact, &dbei);
- delete buf;
+ delete [] buf;
}
}
@@ -728,7 +728,6 @@ void EventList::AddImporter(HANDLE hContact, IImport::ImportType type, const std EnterCriticalSection(&criticalSection);
TCHAR buf[32];
mir_sntprintf(buf, SIZEOF(buf), _T("%016llx"), (unsigned long long int)hContact);
- std::wstring internalFile = contactFileDir;
ImportDiscData data;
data.file = contactFileDir + buf;
data.type = type;
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 768b9fe5b5..ec57f9726e 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -984,7 +984,6 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::string& password)
{
- std::list<std::wstring> files;
bool error = false;
zlib_filefunc_def pzlib_filefunc_def;
fill_win32_filefunc(&pzlib_filefunc_def);
@@ -1195,7 +1194,6 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files, const std::wstring& ftpName)
{
- std::map<std::wstring, bool> existingContacts;
std::wstring script = dir + _T("\\script.sc");
std::wofstream stream (script.c_str());
if (stream.is_open()) {
diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h index 9e0d1f7546..e2fc98626a 100644 --- a/plugins/ExternalAPI/m_folders.h +++ b/plugins/ExternalAPI/m_folders.h @@ -208,10 +208,8 @@ __inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, mir_snprintf(path, size, "%s", buffer);
}
- if (strlen(path) > 0)
+ if (path[0] != '\0')
strncat(path, "\\", size);
- else
- path[0] = '\0';
if (fileName)
strncat(path, fileName, size);
@@ -233,10 +231,8 @@ __inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pa mir_sntprintf(pathW, size, _T("%s"), buffer);
}
- if (wcslen(pathW) > 0)
- wcsncat(pathW, L"\\",size);
- else
- pathW[0] = L'\0';
+ if (pathW[0] != '\0')
+ wcsncat(pathW, L"\\", size);
if (fileNameW)
wcsncat(pathW, fileNameW, size);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 2aebe789e0..d36c982b8e 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -367,10 +367,7 @@ static char *CreateRTFHeader(struct SrmmWindowData *dat, struct GlobalMessageDat bufferAlloced = 1024;
buffer = (char*) mir_alloc(bufferAlloced);
buffer[0] = '\0';
- if (dat->flags & SMF_RTL)
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced,"{\\rtf1\\ansi\\deff0{\\fonttbl");
- else
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "{\\rtf1\\ansi\\deff0{\\fonttbl");
+ AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced,"{\\rtf1\\ansi\\deff0{\\fonttbl");
for (i = 0; i < fontOptionsListSize; i++) {
LoadMsgDlgFont(i, &lf, NULL, FALSE);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "{\\f%u\\fnil\\fcharset%u %S;}", i,
diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp index 96612fa2be..a1546a6b0d 100644 --- a/plugins/Scriver/src/msgtimedout.cpp +++ b/plugins/Scriver/src/msgtimedout.cpp @@ -35,8 +35,8 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ewd = (ErrorWindowData *) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) ewd);
TranslateDialogDefault(hwndDlg);
- ShowWindow(GetParent(ewd->hwndParent), SW_RESTORE);
if (ewd != NULL) {
+ ShowWindow(GetParent(ewd->hwndParent), SW_RESTORE);
if (ewd->szDescription) {
SetDlgItemText(hwndDlg, IDC_ERRORTEXT, ewd->szDescription);
} else {
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index 8220db57cb..1954ccb49f 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -167,7 +167,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_STATUS,CBN_SELCHANGE),0);
for (int i=0; i < count; i++ ) {
db_set_b(NULL, MODULENAME, StatusModeToDbSetting(settings[i]->status,SETTING_MSGCUSTOM), (BYTE)settings[i]->useCustom);
- if ( (settings[i]->useCustom) && (settings[i]->msg != NULL) && (strlen(settings[i]->msg) > 0))
+ if ( (settings[i]->useCustom) && (settings[i]->msg != NULL) && (settings[i]->msg[0] != '\0'))
db_set_s(NULL, MODULENAME, StatusModeToDbSetting(settings[i]->status,SETTING_STATUSMSG), settings[i]->msg);
}
break;
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp index 9eb70c5307..59f37b7018 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp @@ -204,8 +204,8 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM if ( (flags & statusModePf2List[i]) || statusModePf2List[i] == PF2_OFFLINE || bSettingSame ) {
TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
item = SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
- item = SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
+ item = SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
if (statusModeList[i] == setting->lv1Status) {
SendDlgItemMessage(hwndDlg,IDC_LV1STATUS,CB_SETCURSEL,(WPARAM)item,0);
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index d8b62225ac..1b78cfcc8b 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -1223,11 +1223,11 @@ TCHAR* UM_FindUserAutoComplete(USERINFO* pUserList, const TCHAR* pszOriginal, co BOOL UM_RemoveUser(USERINFO** ppUserList, const TCHAR* pszUID)
{
- USERINFO *pTemp = *ppUserList, *pLast = NULL;
-
if (!ppUserList || !pszUID)
return FALSE;
+ USERINFO *pTemp = *ppUserList, *pLast = NULL;
+
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->pszUID, pszUID)) {
if (pLast == NULL)
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index ba0501be3f..2019d6a4f5 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -297,7 +297,6 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce, TWindowData *dat) {
int iEvent = gce->pDest->iType;
TContainerData *pContainer = dat ? dat->pContainer : NULL;
- char *szProto = dat ? dat->szProto : si->pszModule;
TCHAR *bbStart, *bbEnd;
if (g_Settings.bBBCodeInPopups) {
@@ -313,6 +312,7 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce, TWindowData *dat) * check the status mode against the status mask
*/
+ char *szProto = dat ? dat->szProto : si->pszModule;
if (nen_options.dwStatusMask != -1) {
DWORD dwStatus = 0;
if (szProto != NULL) {
@@ -505,7 +505,7 @@ void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p) }
if (p->bMustFlash && p->bInactive)
- UpdateTrayMenu(dat, si->wStatus, si->pszModule, dat ? dat->szStatus : NULL, si->hContact, p->bHighlight ? 1 : 1);
+ UpdateTrayMenu(dat, si->wStatus, si->pszModule, dat->szStatus, si->hContact, p->bHighlight ? 1 : 1);
}
mir_free(p);
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index cf6fb45ae4..531c974e71 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -614,7 +614,7 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) }
i = (available > 0) ? i + 1 : i + 2;
for (; i <= pdata->nrMerged; i++)
- _tcsncat(lpzText, pdata->eventData[i].tszText, MAX_SECONDLINE);
+ _tcsncat(lpzText, pdata->eventData[i].tszText, SIZEOF(lpzText));
pdata->eventData[pdata->nrMerged].hEvent = hEvent;
pdata->eventData[pdata->nrMerged].timestamp = dbe.timestamp;
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index 04f87d068a..d1df140180 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -26,6 +26,7 @@ char* process_status_msg (const char *str, const char* sn) size_t size = strlen(src) + 1;
char* res = (char*)mir_alloc(size);
char* dest = res;
+ size_t len = strlen(sn);
for (; *src; ++src)
{
@@ -39,7 +40,6 @@ char* process_status_msg (const char *str, const char* sn) }
else if (src[0] == '%' && src[1] == 'n')
{
- size_t len = strlen(sn);
int off = dest - res;
res = (char*)mir_realloc(res, size + len);
dest = res + off;
diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index a185e1aecd..ab23c41d2e 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -517,7 +517,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return itc->nSelectedIdx;
case ITCM_GETITEMDATA:
- if ((int)wParam < itc->pList.getCount())
+ if ((int)wParam >= 0 && (int)wParam < itc->pList.getCount())
return ((MIcoTab *)itc->pList[wParam])->data;
return 0;
|