From e873b82b53d7260c742c65ad3c744ad8201164ac Mon Sep 17 00:00:00 2001 From: pabs3 Date: Mon, 2 Apr 2007 10:29:35 +0000 Subject: [PATCH] Kill some more compiler warnings under Linux and mingw32 git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5031 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/ExDLL/exdll.h | 12 ++++++++++-- Contrib/InstallOptions/InstallerOptions.cpp | 2 +- Contrib/Makensisw/utils.cpp | 2 +- Contrib/UserInfo/UserInfo.c | 2 +- Docs/src/bin/halibut/input.c | 2 ++ Source/Platform.h | 6 ++++++ Source/exehead/exec.c | 4 ++-- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Contrib/ExDLL/exdll.h b/Contrib/ExDLL/exdll.h index d81070e5..f16cf047 100644 --- a/Contrib/ExDLL/exdll.h +++ b/Contrib/ExDLL/exdll.h @@ -3,6 +3,12 @@ #include +#if defined(__GNUC__) +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + // only include this file from one place in your DLL. // (it is all static, if you use it in two places it will fail) @@ -26,8 +32,10 @@ static unsigned int g_stringsize; static stack_t **g_stacktop; static char *g_variables; -static int __stdcall popstring(char *str); // 0 on success, 1 on empty stack -static void __stdcall pushstring(const char *str); +static int __stdcall popstring(char *str) UNUSED; // 0 on success, 1 on empty stack +static void __stdcall pushstring(const char *str) UNUSED; +static char * __stdcall getuservariable(const int varnum) UNUSED; +static void __stdcall setuservariable(const int varnum, const char *var) UNUSED; enum { diff --git a/Contrib/InstallOptions/InstallerOptions.cpp b/Contrib/InstallOptions/InstallerOptions.cpp index 3cb54f93..b20092fb 100644 --- a/Contrib/InstallOptions/InstallerOptions.cpp +++ b/Contrib/InstallOptions/InstallerOptions.cpp @@ -1090,7 +1090,7 @@ int WINAPI createCfgDlg() #undef DEFAULT_STYLES - if (pField->nType < 1 || pField->nType > (sizeof(ClassTable) / sizeof(ClassTable[0]))) + if (pField->nType < 1 || pField->nType > (int)(sizeof(ClassTable) / sizeof(ClassTable[0]))) continue; DWORD dwStyle, dwExStyle; diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index 3b56aa7a..268dde48 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -28,7 +28,7 @@ NTOOLTIP g_tip; LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam); -char g_mru_list[MRU_LIST_SIZE][MAX_PATH] = { NULL, NULL, NULL, NULL, NULL }; +char g_mru_list[MRU_LIST_SIZE][MAX_PATH] = { "", "", "", "", "" }; extern NSCRIPTDATA g_sdata; extern char *compressor_names[]; diff --git a/Contrib/UserInfo/UserInfo.c b/Contrib/UserInfo/UserInfo.c index f0ece19e..fbc438bc 100644 --- a/Contrib/UserInfo/UserInfo.c +++ b/Contrib/UserInfo/UserInfo.c @@ -28,7 +28,7 @@ void __declspec(dllexport) GetAccountType(HWND hwndParent, int string_size, DWORD cbTokenGroups; DWORD i, j; - SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY; + SID_IDENTIFIER_AUTHORITY SystemSidAuthority = {SECURITY_NT_AUTHORITY}; char *group = ""; diff --git a/Docs/src/bin/halibut/input.c b/Docs/src/bin/halibut/input.c index 6a13a6bb..a709a8b3 100644 --- a/Docs/src/bin/halibut/input.c +++ b/Docs/src/bin/halibut/input.c @@ -440,6 +440,8 @@ token get_token(input * in) int c; int nls; token ret; + ret.cmd = c__invalid; + ret.aux = FALSE; rdstring rs = { 0, 0, NULL }; filepos cpos; diff --git a/Source/Platform.h b/Source/Platform.h index 9eca9d06..23f63852 100644 --- a/Source/Platform.h +++ b/Source/Platform.h @@ -162,6 +162,12 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG; # endif #endif +#if defined(__GNUC__) +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + // macros #ifndef _WIN32 diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index c104df2d..0da321fc 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -1144,7 +1144,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) case EW_DELREG: { long res=!ERROR_SUCCESS; - const char *rkn=RegKeyHandleToName((HKEY)parm1); + const char *rkn UNUSED=RegKeyHandleToName((HKEY)parm1); if (!parm4) { HKEY hKey=myRegOpenKey(KEY_SET_VALUE); @@ -1174,7 +1174,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) int rtype=parm5; char *buf0=GetStringFromParm(0x02); char *buf1=GetStringFromParm(0x11); - const char *rkn=RegKeyHandleToName(rootkey); + const char *rkn UNUSED=RegKeyHandleToName(rootkey); exec_error++; if (RegCreateKeyEx(rootkey,buf1,0,0,REG_OPTION_NON_VOLATILE,KEY_SET_VALUE,0,&hKey,0) == ERROR_SUCCESS)