Skip to content

Commit

Permalink
Remove unused native methods and assume unicode is always supported
Browse files Browse the repository at this point in the history
Unicode support is assumed to be present if the Windows-OS version is
greater or equal five which corresponds to Windows XP or later [1].

[1] - https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
  • Loading branch information
HannesWell committed May 26, 2024
1 parent abad786 commit 873ccb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 242 deletions.
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
67 changes: 1 addition & 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,6 @@
#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 */
/*
* Class: org_eclipse_core_internal_resources_refresh_win32_Win32Natives
* Method: FindFirstChangeNotificationW
Expand All @@ -42,14 +25,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 +49,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 +73,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 +89,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 +97,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

0 comments on commit 873ccb1

Please sign in to comment.