Skip to content

Remove unused native code and assume unicode is always supported in Win32Natives refresh provider #1415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions resources/bundles/org.eclipse.core.resources/natives/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@
@rem Contributors:
@rem IBM Corporation - initial API and implementation
@rem ***************************************************************************
@echo off
REM build JNI header file
cd ..\bin
"C:\Program Files\Java\jdk1.8.0_65\bin\javah.exe" org.eclipse.core.internal.resources.refresh.win32.Win32Natives
move org_eclipse_core_internal_resources_refresh_win32_Win32Natives.h ..\natives\ref2.h
cd %~dp0\..\src

"%JAVA_HOME%\bin\javac" -h . org\eclipse\core\internal\resources\refresh\win32\Win32Natives.java
del org\eclipse\core\internal\resources\refresh\win32\Win32Natives.class
move org_eclipse_core_internal_resources_refresh_win32_Win32Natives.h ..\natives\ref.h

REM compile and link
if "%MSVC_HOME%"=="" set MSVC_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community
cd ..\natives
set win_include="C:\Program Files\Microsoft Visual Studio 14.0\VC\include"
set jdk_include="C:\Program Files\Java\jdk1.8.0_65\include"

set dll_name=win32refresh.dll

call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64_x86
"cl.exe" -I%win_include% -I%jdk_include% -I%jdk_include%\win32 -LD ref.c -Fe%dll_name%
move %dll_name% ..\..\org.eclipse.core.resources.win32.x86\os\win32\x86\%dll_name%

call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
"cl.exe" -I%win_include% -I%jdk_include% -I%jdk_include%\win32 -LD ref.c -Fe%dll_name%
call "%MSVC_HOME%\VC\Auxiliary\Build\vcvarsall.bat" amd64
"cl.exe" -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 -LD ref.c -Fe%dll_name%
move %dll_name% ..\..\org.eclipse.core.resources.win32.x86_64\os\win32\x86_64\%dll_name%
85 changes: 0 additions & 85 deletions resources/bundles/org.eclipse.core.resources/natives/ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,6 @@ JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_W
return result;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FindFirstChangeNotificationA
* Signature: ([BZI)J
*/
JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindFirstChangeNotificationA
(JNIEnv * env, jclass this, jbyteArray lpPathName, jboolean bWatchSubtree, jint dwNotifyFilter) {
jlong result;
jsize numberOfChars;
jbyte *path, *temp;

// create a new byte array to hold the null terminated path
numberOfChars = (*env)->GetArrayLength(env, lpPathName);
path = malloc((numberOfChars + 1) * sizeof(jbyte));

// get the path bytes from the vm, copy them, and release them
temp = (*env)->GetByteArrayElements(env, lpPathName, 0);
memcpy(path, temp, numberOfChars * sizeof(jbyte));
(*env)->ReleaseByteArrayElements(env, lpPathName, temp, 0);

// null terminate the path, make the request, and release the path memory
path[numberOfChars] = '\0';
result = (jlong) FindFirstChangeNotificationA(path, bWatchSubtree, dwNotifyFilter);
free(path);

return result;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FindCloseChangeNotification
Expand Down Expand Up @@ -122,23 +94,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Wi
return result;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: IsUnicode
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_IsUnicode
(JNIEnv *env, jclass this) {
OSVERSIONINFO osvi;
memset(&osvi, 0, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (! GetVersionEx (&osvi) )
return JNI_FALSE;
if (osvi.dwMajorVersion >= 5)
return JNI_TRUE;
return JNI_FALSE;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: GetLastError
Expand Down Expand Up @@ -169,16 +124,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Wi
return FILE_NOTIFY_CHANGE_DIR_NAME;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FILE_NOTIFY_CHANGE_ATTRIBUTES
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1ATTRIBUTES
(JNIEnv *env, jclass this) {
return FILE_NOTIFY_CHANGE_ATTRIBUTES;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FILE_NOTIFY_CHANGE_SIZE
Expand All @@ -200,16 +145,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Wi
}


/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FILE_NOTIFY_CHANGE_SECURITY
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1SECURITY
(JNIEnv *env, jclass this) {
return FILE_NOTIFY_CHANGE_SECURITY;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: MAXIMUM_WAIT_OBJECTS
Expand All @@ -220,26 +155,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Wi
return MAXIMUM_WAIT_OBJECTS;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: MAX_PATH
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_MAX_1PATH
(JNIEnv *env, jclass this) {
return MAX_PATH;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: INFINITE
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_INFINITE
(JNIEnv *env, jclass this) {
return INFINITE;
}

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: WAIT_OBJECT_0
Expand Down
69 changes: 3 additions & 66 deletions resources/bundles/org.eclipse.core.resources/natives/ref.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2016 IBM Corporation and others.
* Copyright (c) 2004, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -17,23 +17,8 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: INVALID_HANDLE_VALUE */
/* Inaccessible static: ERROR_SUCCESS */
/* Inaccessible static: ERROR_INVALID_HANDLE */
/* Inaccessible static: FILE_NOTIFY_ALL */
/* Inaccessible static: MAXIMUM_WAIT_OBJECTS */
/* Inaccessible static: MAX_PATH */
/* Inaccessible static: INFINITE */
/* Inaccessible static: WAIT_TIMEOUT */
/* Inaccessible static: WAIT_OBJECT_0 */
/* Inaccessible static: WAIT_FAILED */
/* Inaccessible static: FILE_NOTIFY_CHANGE_FILE_NAME */
/* Inaccessible static: FILE_NOTIFY_CHANGE_DIR_NAME */
/* Inaccessible static: FILE_NOTIFY_CHANGE_ATTRIBUTES */
/* Inaccessible static: FILE_NOTIFY_CHANGE_SIZE */
/* Inaccessible static: FILE_NOTIFY_CHANGE_LAST_WRITE */
/* Inaccessible static: FILE_NOTIFY_CHANGE_SECURITY */
/* Inaccessible static: UNICODE */
#undef org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_ACCESS_DENIED
#define org_eclipse_core_internal_resources_refresh_win32_Win32Natives_ERROR_ACCESS_DENIED 5L
/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FindFirstChangeNotificationW
Expand All @@ -42,14 +27,6 @@ extern "C" {
JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindFirstChangeNotificationW
(JNIEnv *, jclass, jstring, jboolean, jint);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FindFirstChangeNotificationA
* Signature: ([BZI)J
*/
JNIEXPORT jlong JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FindFirstChangeNotificationA
(JNIEnv *, jclass, jbyteArray, jboolean, jint);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FindCloseChangeNotification
Expand All @@ -74,14 +51,6 @@ JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_resources_refresh_win3
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_WaitForMultipleObjects
(JNIEnv *, jclass, jint, jlongArray, jboolean, jint);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: IsUnicode
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_IsUnicode
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: GetLastError
Expand All @@ -106,14 +75,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Wi
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1DIR_1NAME
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FILE_NOTIFY_CHANGE_ATTRIBUTES
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1ATTRIBUTES
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FILE_NOTIFY_CHANGE_SIZE
Expand All @@ -130,14 +91,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Wi
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1FILE_1NAME
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FILE_NOTIFY_CHANGE_SECURITY
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_FILE_1NOTIFY_1CHANGE_1SECURITY
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: MAXIMUM_WAIT_OBJECTS
Expand All @@ -146,22 +99,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Wi
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_MAXIMUM_1WAIT_1OBJECTS
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: MAX_PATH
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_MAX_1PATH
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: INFINITE
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_resources_refresh_win32_Win32Natives_INFINITE
(JNIEnv *, jclass);

/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: WAIT_OBJECT_0
Expand Down
Loading
Loading