Skip to content

Commit ae20846

Browse files
committedOct 4, 2021
Remove native methods not used by jansi, fixes #208
1 parent 1ab54ca commit ae20846

File tree

15 files changed

+0
-86
lines changed

15 files changed

+0
-86
lines changed
 

‎src/main/java/org/fusesource/jansi/internal/CLibrary.java

-4
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,4 @@ public static class Termios {
164164
public long c_ospeed;
165165
}
166166

167-
public static native int setenv(String name, String value);
168-
169-
public static native int chdir(String path);
170-
171167
}

‎src/main/native/jansi.c

-46
Original file line numberDiff line numberDiff line change
@@ -588,26 +588,6 @@ wchar_t* java_to_wchar(JNIEnv* env, jstring string) {
588588
return str;
589589
}
590590

591-
JNIEXPORT jint JNICALL CLibrary_NATIVE(chdir)(JNIEnv *env, jobject thiz, jstring path)
592-
{
593-
jint rc = 0;
594-
wchar_t* nativePath = path != NULL ? java_to_wchar(env, path) : NULL;
595-
rc = (jint) SetCurrentDirectoryW(nativePath);
596-
if (nativePath) free(nativePath);
597-
return rc;
598-
}
599-
600-
JNIEXPORT jint JNICALL CLibrary_NATIVE(setenv)(JNIEnv *env, jobject thiz, jstring name, jstring value)
601-
{
602-
jint rc = 0;
603-
wchar_t* nativeName = name != NULL ? java_to_wchar(env, name) : NULL;
604-
wchar_t* nativeValue = value != NULL ? java_to_wchar(env, value) : NULL;
605-
rc = (jint) SetEnvironmentVariableW(nativeName, nativeValue);
606-
if (nativeName) free(nativeName);
607-
if (nativeValue) free(nativeValue);
608-
return rc;
609-
}
610-
611591
#else
612592

613593
char* java_to_char(JNIEnv* env, jstring string) {
@@ -619,30 +599,4 @@ char* java_to_char(JNIEnv* env, jstring string) {
619599
return chars;
620600
}
621601

622-
JNIEXPORT jint JNICALL CLibrary_NATIVE(chdir)(JNIEnv *env, jobject thiz, jstring path)
623-
{
624-
jint rc = 0;
625-
char* nativePath = java_to_char(env, path);
626-
rc = (jint) chdir(nativePath);
627-
free(nativePath);
628-
return rc;
629-
}
630-
631-
JNIEXPORT jint JNICALL CLibrary_NATIVE(setenv)(JNIEnv *env, jobject thiz, jstring name, jstring value)
632-
{
633-
jint rc = 0;
634-
if (name) {
635-
char* nativeName = java_to_char(env, name);
636-
if (value) {
637-
char* nativeValue = java_to_char(env, value);
638-
rc = setenv(nativeName, nativeValue, 1);
639-
free(nativeValue);
640-
} else {
641-
rc = unsetenv(nativeName);
642-
}
643-
free(nativeName);
644-
}
645-
return rc;
646-
}
647-
648602
#endif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

‎src/test/java/org/fusesource/jansi/internal/CLibraryTest.java

-36
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.