This is an automated email from the ASF dual-hosted git repository. skygo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans-native-installers.git
commit dddccddb7925e6d929157c0da1474e2947244ca5 Author: Peter Hull <[email protected]> AuthorDate: Mon Mar 6 15:36:36 2023 +0000 Fix all W/Wall warnings --- src/main/cpp/cleaner/windows/src/main.c | 5 ++++- src/main/cpp/launcher/windows/src/JavaUtils.c | 7 ++----- src/main/cpp/launcher/windows/src/Launcher.c | 3 +-- src/main/cpp/launcher/windows/src/Main.c | 5 +---- src/main/cpp/launcher/windows/src/ProcessUtils.c | 9 ++++----- src/main/cpp/launcher/windows/src/StringUtils.c | 1 + src/main/cpp/launcher/windows/src/SystemUtils.c | 12 ++++++------ 7 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/main/cpp/cleaner/windows/src/main.c b/src/main/cpp/cleaner/windows/src/main.c index 43271ff..ac7fd65 100644 --- a/src/main/cpp/cleaner/windows/src/main.c +++ b/src/main/cpp/cleaner/windows/src/main.c @@ -426,7 +426,10 @@ void changeCurrentDirectory() { #define MAXIMUM_THREADS MAXIMUM_WAIT_OBJECTS int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hi, PSTR pszCmdLine, int nCmdShow) { -//int main(void) { + UNREFERENCED_PARAMETER(hInstance); + UNREFERENCED_PARAMETER(hi); + UNREFERENCED_PARAMETER(pszCmdLine); + UNREFERENCED_PARAMETER(nCmdShow); int argumentsNumber = 0; DWORD i=0; DWORD threadCounter = 0; diff --git a/src/main/cpp/launcher/windows/src/JavaUtils.c b/src/main/cpp/launcher/windows/src/JavaUtils.c index 9e4245e..e0a8c11 100644 --- a/src/main/cpp/launcher/windows/src/JavaUtils.c +++ b/src/main/cpp/launcher/windows/src/JavaUtils.c @@ -395,7 +395,6 @@ void searchCurrentJavaRegistry(LauncherProperties * props, BOOL access64key) { HKEY rootKeys [2] = {HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER}; DWORD rootKeysNumber = sizeof(rootKeys)/sizeof(HKEY); DWORD keysNumber = sizeof(JAVA_REGISTRY_KEYS)/sizeof(WCHAR*); - DWORD status = ERROR_OK; writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "Search java in CurrentVersion values...", 1); @@ -455,7 +454,6 @@ void searchCurrentJavaRegistry(LauncherProperties * props, BOOL access64key) { err = RegEnumKeyExW(hkey, index, buffer, &size, NULL, NULL, NULL, NULL); if (err == ERROR_SUCCESS) { WCHAR * javaHome = getJavaHomeValue(keys[i], buffer, access64key); - status = ERROR_OK; writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, (rootKeys[k]==HKEY_LOCAL_MACHINE) ? "HKEY_LOCAL_MACHINE" : "HKEY_CURRENT_USER", 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "\\", 0); @@ -531,7 +529,6 @@ void searchJavaFromEnvVariables(LauncherProperties * props) { void unpackJars(LauncherProperties * props, WCHAR * jvmDir, WCHAR * startDir, WCHAR * unpack200exe) { DWORD attrs; DWORD dwError; - DWORD count = 0 ; if(!isOK(props)) return; attrs = GetFileAttributesW(startDir); @@ -686,10 +683,10 @@ void searchJavaInstallationFolder(LauncherProperties * props) { GetModuleFileName(0, executablePath, MAX_PATH); char * pch = strrchr(executablePath, '\\'); char installationFolder [MAX_PATH]= ""; - int i = 0; + int i; int end = (int) (pch - executablePath); printf("%i", end); - for(i; i < end; i++) { + for(i = 0; i < end; i++) { installationFolder[i] = executablePath[i]; } strcat(installationFolder, "\\bin\\jre"); diff --git a/src/main/cpp/launcher/windows/src/Launcher.c b/src/main/cpp/launcher/windows/src/Launcher.c index 95bdcbd..fee1f22 100644 --- a/src/main/cpp/launcher/windows/src/Launcher.c +++ b/src/main/cpp/launcher/windows/src/Launcher.c @@ -479,8 +479,7 @@ void resolveString(LauncherProperties * props, WCHAR ** result) { } void resolvePath(LauncherProperties * props, LauncherResource * file) { - WCHAR * result = NULL; - DWORD i=0; + DWORD i; if(file==NULL) return; if(file->resolved!=NULL) return; diff --git a/src/main/cpp/launcher/windows/src/Main.c b/src/main/cpp/launcher/windows/src/Main.c index 5a819ee..4dbb8c6 100644 --- a/src/main/cpp/launcher/windows/src/Main.c +++ b/src/main/cpp/launcher/windows/src/Main.c @@ -103,8 +103,6 @@ void initMainWindow(LauncherProperties * props, HINSTANCE hInstance) { void initErrorTitleWindow(LauncherProperties *props, HINSTANCE hInstance) { if(!isSilent(props)) { RECT rcClient; - int cyVScroll; - cyVScroll = GetSystemMetrics(SM_CYVSCROLL); GetClientRect(hwndMain, &rcClient); hwndErrorTitle = CreateWindowExW(0, WC_STATICW, WC_STATICW, WS_CHILD, rcClient.left + 10, 15, rcClient.right - 20, 20, hwndMain, NULL, hInstance, NULL); @@ -128,8 +126,6 @@ void initErrorTitleWindow(LauncherProperties *props, HINSTANCE hInstance) { void initErrorDetailWindow(LauncherProperties *props, HINSTANCE hInstance) { if(!isSilent(props)) { RECT rcClient; - int cyVScroll; - cyVScroll = GetSystemMetrics(SM_CYVSCROLL); GetClientRect(hwndMain, &rcClient); hwndErrorDetail = CreateWindowExW(0, WC_STATICW, WC_STATICW, WS_CHILD , rcClient.left + 10, 40, rcClient.right - 20, 80, @@ -587,6 +583,7 @@ void createLauncherThread(LauncherProperties *props) { } DWORD createGui(LauncherProperties* props, HINSTANCE hInstance, HINSTANCE hi, int nCmdShow) { + (void) hi; if (!InitApplication(props, hInstance)) { SetEvent(initializationFailed); return 0; diff --git a/src/main/cpp/launcher/windows/src/ProcessUtils.c b/src/main/cpp/launcher/windows/src/ProcessUtils.c index 0fcd9dd..46f156d 100644 --- a/src/main/cpp/launcher/windows/src/ProcessUtils.c +++ b/src/main/cpp/launcher/windows/src/ProcessUtils.c @@ -28,21 +28,20 @@ DWORD readBuf(HANDLE hRead, WCHAR * buf, DWORD * bytesRead, HANDLE hWrite) { ReadFile(hRead, buf, STREAM_BUF_LENGTH - 1, bytesRead, NULL); if((*bytesRead)>0 && hWrite!=INVALID_HANDLE_VALUE) { - DWORD bytesWritten = 0; - WriteFile(hWrite, buf, (*bytesRead), &bytesWritten, 0); + WriteFile(hWrite, buf, (*bytesRead), NULL, 0); } - ZERO(buf, sizeof(buf)); + ZERO(buf, STREAM_BUF_LENGTH); return 0; } DWORD readNextData(HANDLE hRead, WCHAR * buf, HANDLE hWrite) { DWORD bytesRead; DWORD bytesAvailable; - ZERO(buf, sizeof(buf)); + ZERO(buf, STREAM_BUF_LENGTH); PeekNamedPipe(hRead, buf, STREAM_BUF_LENGTH - 1, &bytesRead, &bytesAvailable, NULL); if (bytesRead != 0) { - ZERO(buf, sizeof(buf)); + ZERO(buf, STREAM_BUF_LENGTH); if (bytesAvailable >= STREAM_BUF_LENGTH) { while (bytesRead >= STREAM_BUF_LENGTH-1) { readBuf(hRead, buf, &bytesRead, hWrite); diff --git a/src/main/cpp/launcher/windows/src/StringUtils.c b/src/main/cpp/launcher/windows/src/StringUtils.c index cf0423b..08f7f7c 100644 --- a/src/main/cpp/launcher/windows/src/StringUtils.c +++ b/src/main/cpp/launcher/windows/src/StringUtils.c @@ -320,6 +320,7 @@ WCHAR * escapeString(const WCHAR * string) { result[r++] = '\\'; bsCounter--; } while(bsCounter>0); + break; default: bsCounter = 0; break; diff --git a/src/main/cpp/launcher/windows/src/SystemUtils.c b/src/main/cpp/launcher/windows/src/SystemUtils.c index c8b423e..feabb49 100644 --- a/src/main/cpp/launcher/windows/src/SystemUtils.c +++ b/src/main/cpp/launcher/windows/src/SystemUtils.c @@ -81,15 +81,15 @@ DWORD is7() { return (id == VER_PLATFORM_WIN32_NT && major == 6 && minor == 1 && type == VER_NT_WORKSTATION) ? 1 : 0; } -typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); -LPFN_ISWOW64PROCESS fnIsWow64Process; - void initWow64() { - IsWow64 = FALSE; + typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); - fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")),"IsWow64Process"); - + IsWow64 = FALSE; + // Have to ignore the warning here: +#pragma GCC diagnostic ignored "-Wcast-function-type" + LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")),"IsWow64Process"); +#pragma GCC diagnostic pop if (NULL != fnIsWow64Process) { if (!fnIsWow64Process(GetCurrentProcess(),&IsWow64)) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
