From 747ad310e5f34d5333a8fe660c491c6d5b1410d4 Mon Sep 17 00:00:00 2001 From: pabs3 Date: Sun, 11 Mar 2007 15:58:46 +0000 Subject: [PATCH] Kill some compiler warnings under Linux and mingw32 git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4994 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/BgImage/BgImage.cpp | 4 ++-- Contrib/InstallOptions/InstallerOptions.cpp | 8 ++++---- Contrib/MakeLangId/MakeLangId.cpp | 2 +- Contrib/Makensisw/jnetlib/util.cpp | 2 +- Contrib/Makensisw/makensisw.cpp | 12 ++++++------ Contrib/Makensisw/makensisw.h | 2 +- Contrib/Makensisw/noclib.h | 2 +- Contrib/Makensisw/toolbar.cpp | 2 +- Contrib/Makensisw/toolbar.h | 2 +- Contrib/Makensisw/utils.cpp | 2 +- Contrib/Makensisw/utils.h | 2 +- Contrib/Makensisw/version.cpp | 2 +- Contrib/Math/Source/MyMath.c | 4 ++-- Contrib/Math/Source/MyMath.h | 2 +- Contrib/Math/Source/plugin.c | 2 +- Contrib/NSISdl/nsisdl.cpp | 2 +- Contrib/NSISdl/util.cpp | 2 +- Contrib/StartMenu/StartMenu.c | 2 +- Contrib/UserInfo/UserInfo.c | 2 +- Contrib/VPatch/Source/GenPat/main.cpp | 2 +- Contrib/VPatch/Source/Plugin/checksum.h | 2 +- Contrib/nsExec/nsexec.c | 4 ++-- Contrib/zip2exe/main.cpp | 4 ++-- Source/Tests/endian.cpp | 2 +- Source/Tests/textrunner.cpp | 2 +- 25 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Contrib/BgImage/BgImage.cpp b/Contrib/BgImage/BgImage.cpp index 0ca57657..b67490a6 100644 --- a/Contrib/BgImage/BgImage.cpp +++ b/Contrib/BgImage/BgImage.cpp @@ -117,7 +117,7 @@ NSISFunc(SetBg) { hWndImage = CreateWindowEx( WS_EX_TOOLWINDOW, - (LPSTR)atomClass, + (LPSTR)(DWORD)atomClass, 0, WS_CLIPSIBLINGS|WS_POPUP, 0, @@ -225,7 +225,7 @@ NSISFunc(AddImage) { } newImg->iType = MIL_BITMAP; - newImg->cTransparent = -1; + newImg->cTransparent = (COLORREF)-1; popstring(szTemp); if (!lstrcmpi(szTemp, "/TRANSPARENT")) { diff --git a/Contrib/InstallOptions/InstallerOptions.cpp b/Contrib/InstallOptions/InstallerOptions.cpp index b195eab1..73eca1ad 100644 --- a/Contrib/InstallOptions/InstallerOptions.cpp +++ b/Contrib/InstallOptions/InstallerOptions.cpp @@ -731,7 +731,7 @@ BOOL CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara if (message == WM_NOTIFY_OUTER_NEXT && !bRes) { // if leave function didn't abort (bRes != 0 in that case) - if (wParam == -1) + if (wParam == (WPARAM)-1) g_is_back++; if (wParam == NOTIFY_BYE_BYE) g_is_cancel++; @@ -1254,7 +1254,7 @@ int WINAPI createCfgDlg() FREE(pszList); if (pField->pszState) { if (pField->nFlags & (LBS_MULTIPLESEL|LBS_EXTENDEDSEL) && nFindMsg == LB_FINDSTRINGEXACT) { - mySendMessage(hwCtrl, LB_SETSEL, FALSE, -1); + mySendMessage(hwCtrl, LB_SETSEL, FALSE, (LPARAM)-1); pszStart = pszEnd = pField->pszState; for (;;) { char c = *pszEnd; @@ -1262,7 +1262,7 @@ int WINAPI createCfgDlg() *pszEnd = '\0'; if (*pszStart) { - int nItem = mySendMessage(hwCtrl, LB_FINDSTRINGEXACT, -1, (LPARAM)pszStart); + int nItem = mySendMessage(hwCtrl, LB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pszStart); if (nItem != LB_ERR) mySendMessage(hwCtrl, LB_SETSEL, TRUE, nItem); } @@ -1275,7 +1275,7 @@ int WINAPI createCfgDlg() } } else { - int nItem = mySendMessage(hwCtrl, nFindMsg, -1, (LPARAM)pField->pszState); + int nItem = mySendMessage(hwCtrl, nFindMsg, (WPARAM)-1, (LPARAM)pField->pszState); if (nItem != CB_ERR) { // CB_ERR == LB_ERR == -1 mySendMessage(hwCtrl, nSetSelMsg, nItem, 0); } diff --git a/Contrib/MakeLangId/MakeLangId.cpp b/Contrib/MakeLangId/MakeLangId.cpp index b53c78d3..07bab7b8 100644 --- a/Contrib/MakeLangId/MakeLangId.cpp +++ b/Contrib/MakeLangId/MakeLangId.cpp @@ -241,4 +241,4 @@ int APIENTRY WinMain(HINSTANCE hInstance, ExitProcess(0); return 0; -} \ No newline at end of file +} diff --git a/Contrib/Makensisw/jnetlib/util.cpp b/Contrib/Makensisw/jnetlib/util.cpp index dd80613f..350bb161 100644 --- a/Contrib/Makensisw/jnetlib/util.cpp +++ b/Contrib/Makensisw/jnetlib/util.cpp @@ -61,4 +61,4 @@ void mini_memcpy(void *o,void*i,int l) char *oo=(char*)o; char *ii=(char*)i; while (l-- > 0) *oo++=*ii++; -} \ No newline at end of file +} diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index bb8c38ac..09265a46 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -103,7 +103,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { SetClassLong(hwndDlg,GCL_HICON,(long)hIcon); // Altered by Darren Owen (DrO) on 29/9/2003 // Added in receiving of mouse and key events from the richedit control - SendMessage(GetDlgItem(hwndDlg,IDC_LOGWIN),EM_SETEVENTMASK,NULL,ENM_SELCHANGE|ENM_MOUSEEVENTS|ENM_KEYEVENTS); + SendMessage(GetDlgItem(hwndDlg,IDC_LOGWIN),EM_SETEVENTMASK,(WPARAM)NULL,ENM_SELCHANGE|ENM_MOUSEEVENTS|ENM_KEYEVENTS); DragAcceptFiles(g_sdata.hwnd,FALSE); g_sdata.menu = GetMenu(g_sdata.hwnd); g_sdata.fileSubmenu = FindSubMenu(g_sdata.menu, IDM_FILE); @@ -207,7 +207,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_DROPFILES: { int num; char szTmp[MAX_PATH]; - num = DragQueryFile((HDROP)wParam,-1,NULL,0); + num = DragQueryFile((HDROP)wParam,(UINT)-1,NULL,0); if (num==1) { DragQueryFile((HDROP)wParam,0,szTmp,MAX_PATH); if (lstrlen(szTmp)>0) { @@ -295,14 +295,14 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { if(FileExists(temp_file_name)) { hPrev = CreateFile(temp_file_name,GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, NULL, NULL); + NULL, OPEN_EXISTING, (DWORD)NULL, NULL); if(hPrev != INVALID_HANDLE_VALUE) { prevSize = GetFileSize(hPrev, 0); CloseHandle(hPrev); if(prevSize != INVALID_FILE_SIZE) { hThis = CreateFile(g_sdata.output_exe,GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, NULL, NULL); + NULL, OPEN_EXISTING, (DWORD)NULL, NULL); if(hThis != INVALID_HANDLE_VALUE) { thisSize = GetFileSize(hThis, 0); CloseHandle(hThis); @@ -1177,10 +1177,10 @@ BOOL CALLBACK SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam else { HWND hwndParent = GetParent(hwndDlg); if(g_symbol_set_mode == 1) { //Load - SendMessage(hwndParent, WM_MAKENSIS_LOADSYMBOLSET, (WPARAM)name, NULL); + SendMessage(hwndParent, WM_MAKENSIS_LOADSYMBOLSET, (WPARAM)name, (LPARAM)NULL); } else { - SendMessage(hwndParent, WM_MAKENSIS_SAVESYMBOLSET, (WPARAM)name, NULL); + SendMessage(hwndParent, WM_MAKENSIS_SAVESYMBOLSET, (WPARAM)name, (LPARAM)NULL); } EndDialog(hwndDlg, TRUE); } diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index 5b02f707..fa231319 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -213,4 +213,4 @@ typedef struct ToolTipStruct { HHOOK hook; } NTOOLTIP; -#endif \ No newline at end of file +#endif diff --git a/Contrib/Makensisw/noclib.h b/Contrib/Makensisw/noclib.h index b7d70d76..51686b01 100644 --- a/Contrib/Makensisw/noclib.h +++ b/Contrib/Makensisw/noclib.h @@ -30,4 +30,4 @@ void *my_memset(void *dest, int c, size_t count); // iceman_k's clib methods int lstrncmp(char *s1, const char *s2, int chars); int lstrncmpi(char *s1, const char *s2, int chars); -#endif \ No newline at end of file +#endif diff --git a/Contrib/Makensisw/toolbar.cpp b/Contrib/Makensisw/toolbar.cpp index 23273c4e..55edbf7a 100644 --- a/Contrib/Makensisw/toolbar.cpp +++ b/Contrib/Makensisw/toolbar.cpp @@ -216,7 +216,7 @@ void ShowToolbarDropdownMenu() RECT rect; GetWindowRect(g_toolbar.hwnd, (LPRECT) &rect); TrackPopupMenu(g_toolbar.dropdownmenu, - NULL, + (UINT)NULL, rect.left + (int)(short)g_toolbar.dropdownpoint.x, rect.top + (int)(short)g_toolbar.dropdownpoint.y, 0, diff --git a/Contrib/Makensisw/toolbar.h b/Contrib/Makensisw/toolbar.h index ffc2d89a..568118a6 100644 --- a/Contrib/Makensisw/toolbar.h +++ b/Contrib/Makensisw/toolbar.h @@ -77,4 +77,4 @@ void EnableToolBarButton(int, BOOL); void AddToolBarTooltips(); void ShowToolbarDropdownMenu(); void UpdateToolBarCompressorButton(); -#endif \ No newline at end of file +#endif diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index b5c02441..3b56aa7a 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -656,7 +656,7 @@ char* BuildSymbols() } else { buf = (char *)GlobalAlloc(GPTR, sizeof(char)); - buf[0] = NULL; + buf[0] = '\0'; } return buf; diff --git a/Contrib/Makensisw/utils.h b/Contrib/Makensisw/utils.h index 2a344966..1428e63e 100644 --- a/Contrib/Makensisw/utils.h +++ b/Contrib/Makensisw/utils.h @@ -63,4 +63,4 @@ void ClearMRUList(); BOOL FileExists(char *fname); HMENU FindSubMenu(HMENU hMenu, UINT uId); -#endif \ No newline at end of file +#endif diff --git a/Contrib/Makensisw/version.cpp b/Contrib/Makensisw/version.cpp index 6e5bfbfa..e9bb32be 100644 --- a/Contrib/Makensisw/version.cpp +++ b/Contrib/Makensisw/version.cpp @@ -26,4 +26,4 @@ const char *NSISW_VERSION = "MakeNSISW " STR(RELEASE) " (NSIS Compiler Interface)"; #else const char *NSISW_VERSION = "MakeNSISW " __DATE__; -#endif \ No newline at end of file +#endif diff --git a/Contrib/Math/Source/MyMath.c b/Contrib/Math/Source/MyMath.c index e9f3a5b7..b4d98bf0 100644 --- a/Contrib/Math/Source/MyMath.c +++ b/Contrib/Math/Source/MyMath.c @@ -276,7 +276,7 @@ void FloatFormatF(char *s, double value, int prec) void FloatFormatE(char *s, double fnum, int options) { - int fpower, fsign, fdigit, fprec = 0, prec, fzfill = 0; + int fpower, fsign, fdigit, fprec = 0, prec; double sfnum; prec = options & 0xF; @@ -373,4 +373,4 @@ int lstrcmpn(char *s1, const char *s2, int chars) while ((chars > 0) && (*s1) && (*s2) && (*(s1) == *(s2))) chars--, s1++, s2++; if ((chars == 0) || (*s1 == *s2)) return 0; return (*s1 - *s2); -} \ No newline at end of file +} diff --git a/Contrib/Math/Source/MyMath.h b/Contrib/Math/Source/MyMath.h index 3936236d..5ed44aa8 100644 --- a/Contrib/Math/Source/MyMath.h +++ b/Contrib/Math/Source/MyMath.h @@ -163,4 +163,4 @@ void StringToItem(char *&sbuf, ExpressionItem *item, int options); void ItemToString(char *sbuf, ExpressionItem *item); void FloatFormat(char *sbuf, double value, int options); void itoa64(__int64 i, char *buffer); -int lstrcmpn(char *s1, const char *s2, int chars); \ No newline at end of file +int lstrcmpn(char *s1, const char *s2, int chars); diff --git a/Contrib/Math/Source/plugin.c b/Contrib/Math/Source/plugin.c index 8fb001e2..93cb37e1 100644 --- a/Contrib/Math/Source/plugin.c +++ b/Contrib/Math/Source/plugin.c @@ -133,4 +133,4 @@ ExpressionItem *CopyItem(ExpressionItem *citem, int NeedConst) item->param2 = citem->param2; item->next = NULL; return item; -} \ No newline at end of file +} diff --git a/Contrib/NSISdl/nsisdl.cpp b/Contrib/NSISdl/nsisdl.cpp index b03f55fd..5825d5ec 100644 --- a/Contrib/NSISdl/nsisdl.cpp +++ b/Contrib/NSISdl/nsisdl.cpp @@ -356,7 +356,7 @@ __declspec(dllexport) void download (HWND parent, get=new JNL_HTTPGet(JNL_CONNECTION_AUTODNS,16384,(p&&p[0])?p:NULL); int st; int has_printed_headers = 0; - int cl; + int cl = 0; int len; int sofar = 0; DWORD last_recv_time=start_time; diff --git a/Contrib/NSISdl/util.cpp b/Contrib/NSISdl/util.cpp index 8edaaedd..6c860b34 100644 --- a/Contrib/NSISdl/util.cpp +++ b/Contrib/NSISdl/util.cpp @@ -36,4 +36,4 @@ void mini_memcpy(void *o,void*i,int l) char *oo=(char*)o; char *ii=(char*)i; while (l-- > 0) *oo++=*ii++; -} \ No newline at end of file +} diff --git a/Contrib/StartMenu/StartMenu.c b/Contrib/StartMenu/StartMenu.c index 09f73ab5..d5d26e78 100644 --- a/Contrib/StartMenu/StartMenu.c +++ b/Contrib/StartMenu/StartMenu.c @@ -115,7 +115,7 @@ void __declspec(dllexport) Show(HWND hwndParent, int string_size, char *variable while (!g_done) { MSG msg; - int nResult = GetMessage(&msg, NULL, 0, 0); + GetMessage(&msg, NULL, 0, 0); if (!IsDialogMessage(hwStartMenuSelect,&msg) && !IsDialogMessage(hwndParent,&msg) && !TranslateMessage(&msg)) DispatchMessage(&msg); } diff --git a/Contrib/UserInfo/UserInfo.c b/Contrib/UserInfo/UserInfo.c index 0e22c30a..f0ece19e 100644 --- a/Contrib/UserInfo/UserInfo.c +++ b/Contrib/UserInfo/UserInfo.c @@ -56,7 +56,7 @@ void __declspec(dllexport) GetAccountType(HWND hwndParent, int string_size, // to explicitly deallocate it. That happens automatically // when we exit this function. - if (ptg = GlobalAlloc(GPTR, cbTokenGroups)) + if ((ptg = GlobalAlloc(GPTR, cbTokenGroups))) { // Now we ask for the group information again. diff --git a/Contrib/VPatch/Source/GenPat/main.cpp b/Contrib/VPatch/Source/GenPat/main.cpp index c6fcebab..a62ccf04 100644 --- a/Contrib/VPatch/Source/GenPat/main.cpp +++ b/Contrib/VPatch/Source/GenPat/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char * argv[] ) { // remove existing patch with sourceCRC TFileOffset fileCount = 0; while(true) { - TFileOffset previousPatchSize; + TFileOffset previousPatchSize = 0; try { previousPatchSize = POSIX::getFileSize(patchFileName.c_str()); } catch(const char* s) { diff --git a/Contrib/VPatch/Source/Plugin/checksum.h b/Contrib/VPatch/Source/Plugin/checksum.h index 287fb05a..4817f5f6 100644 --- a/Contrib/VPatch/Source/Plugin/checksum.h +++ b/Contrib/VPatch/Source/Plugin/checksum.h @@ -39,4 +39,4 @@ void CRC32ToString(char* string, DWORD crc); BOOL FileMD5(HANDLE hFile, md5_byte_t digest[16]); void MD5ToString(char* string, md5_byte_t checksum[16]); -#endif \ No newline at end of file +#endif diff --git a/Contrib/nsExec/nsexec.c b/Contrib/nsExec/nsexec.c index fa06367a..e53c45eb 100644 --- a/Contrib/nsExec/nsexec.c +++ b/Contrib/nsExec/nsexec.c @@ -187,7 +187,7 @@ params: DWORD dwExit = !STILL_ACTIVE; DWORD dwLastOutput; static char szBuf[1024]; - HGLOBAL hUnusedBuf; + HGLOBAL hUnusedBuf = NULL; char *szUnusedBuf = 0; if (log) { @@ -255,7 +255,7 @@ params: } if (!(log & 2)) { - while (p = my_strstr(p, "\t")) { + while ((p = my_strstr(p, "\t"))) { if ((int)(p - szUnusedBuf) > (int)(GlobalSize(hUnusedBuf) - TAB_REPLACE_SIZE - 1)) { *p++ = ' '; diff --git a/Contrib/zip2exe/main.cpp b/Contrib/zip2exe/main.cpp index fbe39d20..e934c0dc 100644 --- a/Contrib/zip2exe/main.cpp +++ b/Contrib/zip2exe/main.cpp @@ -668,7 +668,7 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_DROPFILES: { char dropped_file[MAX_PATH]=""; - if (DragQueryFile((HDROP)wParam,-1,NULL,0)==1) + if (DragQueryFile((HDROP)wParam,(UINT)-1,NULL,0)==1) { DragQueryFile((HDROP)wParam,0,dropped_file,MAX_PATH); if (lstrlen(dropped_file)>0) @@ -784,4 +784,4 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) break; } return 0; -} \ No newline at end of file +} diff --git a/Source/Tests/endian.cpp b/Source/Tests/endian.cpp index 38882db2..c1912d58 100644 --- a/Source/Tests/endian.cpp +++ b/Source/Tests/endian.cpp @@ -53,4 +53,4 @@ public: }; -CPPUNIT_TEST_SUITE_REGISTRATION( EndianTest ); \ No newline at end of file +CPPUNIT_TEST_SUITE_REGISTRATION( EndianTest ); diff --git a/Source/Tests/textrunner.cpp b/Source/Tests/textrunner.cpp index c1148401..171a5788 100644 --- a/Source/Tests/textrunner.cpp +++ b/Source/Tests/textrunner.cpp @@ -19,4 +19,4 @@ int main(int argc, char* argv[]) // Return error code 1 if the one of test failed. return wasSucessful ? 0 : 1; -} \ No newline at end of file +}