< prev index next >

src/java.desktop/macosx/native/libosxui/AquaFileView.m

Print this page
rev 54096 : 8259651: [macOS] Replace JNF_COCOA_ENTER/EXIT macros
rev 54098 : 8260616: Removing remaining JNF dependencies in the java.desktop module
8259729: Missed JNFInstanceOf -> IsInstanceOf conversion

*** 22,38 **** * or visit www.oracle.com if you need additional information or have any * questions. */ ! #include <jni_util.h> #import "com_apple_laf_AquaFileView.h" #import <sys/param.h> // for MAXPATHLEN #import <CoreFoundation/CoreFoundation.h> - #import <JavaNativeFoundation/JavaNativeFoundation.h> /* * Class: com_apple_laf_AquaFileView * Method: getNativePathToRunningJDKBundle * Signature: ()Ljava/lang/String; --- 22,37 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ ! #include <JNIUtilities.h> #import "com_apple_laf_AquaFileView.h" #import <sys/param.h> // for MAXPATHLEN #import <CoreFoundation/CoreFoundation.h> /* * Class: com_apple_laf_AquaFileView * Method: getNativePathToRunningJDKBundle * Signature: ()Ljava/lang/String;
*** 40,54 **** // TODO: Un-comment this out /*JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativePathToRunningJDKBundle (JNIEnv *env, jclass clazz) { jstring returnValue = NULL; ! JNF_COCOA_ENTER(env); ! returnValue = JNFNSToJavaString(env, getRunningJavaBundle()); ! JNF_COCOA_EXIT(env); return returnValue; }*/ /* * Class: com_apple_laf_AquaFileView --- 39,53 ---- // TODO: Un-comment this out /*JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativePathToRunningJDKBundle (JNIEnv *env, jclass clazz) { jstring returnValue = NULL; ! JNI_COCOA_ENTER(env); ! returnValue = NSStringToJavaString(env, getRunningJavaBundle()); ! JNI_COCOA_EXIT(env); return returnValue; }*/ /* * Class: com_apple_laf_AquaFileView
*** 57,71 **** */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativePathToSharedJDKBundle (JNIEnv *env, jclass clazz) { jstring returnValue = NULL; ! JNF_COCOA_ENTER(env); ! returnValue = JNFNSToJavaString(env, [[NSBundle bundleWithIdentifier:@"com.apple.JavaVM"] bundlePath]); ! JNF_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView --- 56,70 ---- */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativePathToSharedJDKBundle (JNIEnv *env, jclass clazz) { jstring returnValue = NULL; ! JNI_COCOA_ENTER(env); ! returnValue = NSStringToJavaString(env, [[NSBundle bundleWithIdentifier:@"com.apple.JavaVM"] bundlePath]); ! JNI_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView
*** 74,93 **** */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativeMachineName (JNIEnv *env, jclass clazz) { jstring returnValue = NULL; ! JNF_COCOA_ENTER(env); CFStringRef machineName = CSCopyMachineName(); ! returnValue = JNFNSToJavaString(env, (NSString*)machineName); if (machineName != NULL) { CFRelease(machineName); } ! JNF_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView --- 73,92 ---- */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativeMachineName (JNIEnv *env, jclass clazz) { jstring returnValue = NULL; ! JNI_COCOA_ENTER(env); CFStringRef machineName = CSCopyMachineName(); ! returnValue = NSStringToJavaString(env, (NSString*)machineName); if (machineName != NULL) { CFRelease(machineName); } ! JNI_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView
*** 96,106 **** */ JNIEXPORT jint JNICALL Java_com_apple_laf_AquaFileView_getNativeLSInfo (JNIEnv *env, jclass clazz, jbyteArray absolutePath, jboolean isDir) { jint returnValue = com_apple_laf_AquaFileView_UNINITALIZED_LS_INFO; ! JNF_COCOA_ENTER(env); jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL); CHECK_NULL_RETURN(byteArray, returnValue); jsize length = (*env)->GetArrayLength(env, absolutePath); --- 95,105 ---- */ JNIEXPORT jint JNICALL Java_com_apple_laf_AquaFileView_getNativeLSInfo (JNIEnv *env, jclass clazz, jbyteArray absolutePath, jboolean isDir) { jint returnValue = com_apple_laf_AquaFileView_UNINITALIZED_LS_INFO; ! JNI_COCOA_ENTER(env); jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL); CHECK_NULL_RETURN(byteArray, returnValue); jsize length = (*env)->GetArrayLength(env, absolutePath);
*** 124,134 **** if (err == noErr) { returnValue = itemInfo.flags; } } ! JNF_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView --- 123,133 ---- if (err == noErr) { returnValue = itemInfo.flags; } } ! JNI_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView
*** 137,147 **** */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativeDisplayName (JNIEnv *env, jclass clazz, jbyteArray absolutePath, jboolean isDir) { jstring returnValue = NULL; ! JNF_COCOA_ENTER(env); jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL); CHECK_NULL_RETURN(byteArray, returnValue); jsize length = (*env)->GetArrayLength(env, absolutePath); --- 136,146 ---- */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativeDisplayName (JNIEnv *env, jclass clazz, jbyteArray absolutePath, jboolean isDir) { jstring returnValue = NULL; ! JNI_COCOA_ENTER(env); jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL); CHECK_NULL_RETURN(byteArray, returnValue); jsize length = (*env)->GetArrayLength(env, absolutePath);
*** 167,186 **** theErr = LSCopyDisplayNameForRef(&ref, &displayName); if (theErr == noErr) { CFMutableStringRef mutableDisplayName = CFStringCreateMutableCopy(NULL, 0, displayName); CFStringNormalize(mutableDisplayName, kCFStringNormalizationFormC); ! returnValue = JNFNSToJavaString(env, (NSString *)mutableDisplayName); CFRelease(mutableDisplayName); } if (displayName != NULL) { CFRelease(displayName); } } ! JNF_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView --- 166,185 ---- theErr = LSCopyDisplayNameForRef(&ref, &displayName); if (theErr == noErr) { CFMutableStringRef mutableDisplayName = CFStringCreateMutableCopy(NULL, 0, displayName); CFStringNormalize(mutableDisplayName, kCFStringNormalizationFormC); ! returnValue = NSStringToJavaString(env, (NSString *)mutableDisplayName); CFRelease(mutableDisplayName); } if (displayName != NULL) { CFRelease(displayName); } } ! JNI_COCOA_EXIT(env); return returnValue; } /* * Class: com_apple_laf_AquaFileView
*** 189,199 **** */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativePathForResolvedAlias (JNIEnv *env, jclass clazz, jbyteArray pathToAlias, jboolean isDir) { jstring returnValue = NULL; ! JNF_COCOA_ENTER(env); UInt8 pathCString[MAXPATHLEN + 1]; size_t maxPathLen = sizeof(pathCString) - 1; jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL); --- 188,198 ---- */ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativePathForResolvedAlias (JNIEnv *env, jclass clazz, jbyteArray pathToAlias, jboolean isDir) { jstring returnValue = NULL; ! JNI_COCOA_ENTER(env); UInt8 pathCString[MAXPATHLEN + 1]; size_t maxPathLen = sizeof(pathCString) - 1; jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
*** 222,229 **** if (theErr == noErr) { returnValue = (*env)->NewStringUTF(env, (char *)resolvedPath); } } ! JNF_COCOA_EXIT(env); return returnValue; } --- 221,228 ---- if (theErr == noErr) { returnValue = (*env)->NewStringUTF(env, (char *)resolvedPath); } } ! JNI_COCOA_EXIT(env); return returnValue; }
< prev index next >