< prev index next >

src/java.base/macosx/native/libjava/java_props_macosx.c

Print this page

        

*** 175,186 **** // but it's not in the 10.9 SDK. So, call it via objc_msgSend_stret. if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) { OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret; OSVerStruct osVer = procInfoFn([NSProcessInfo processInfo], @selector(operatingSystemVersion)); ! NSString *nsVerStr = [NSString stringWithFormat:@"%ld.%ld.%ld", ! (long)osVer.majorVersion, (long)osVer.minorVersion, (long)osVer.patchVersion]; // Copy out the char* osVersionCStr = strdup([nsVerStr UTF8String]); } // Fallback if running on pre-10.9 Mac OS if (osVersionCStr == NULL) { --- 175,192 ---- // but it's not in the 10.9 SDK. So, call it via objc_msgSend_stret. if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) { OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret; OSVerStruct osVer = procInfoFn([NSProcessInfo processInfo], @selector(operatingSystemVersion)); ! NSString *nsVerStr; ! if (osVer.patchVersion == 0) { // Omit trailing ".0" ! nsVerStr = [NSString stringWithFormat:@"%ld.%ld", ! (long)osVer.majorVersion, (long)osVer.minorVersion]; ! } else { ! nsVerStr = [NSString stringWithFormat:@"%ld.%ld.%ld", ! (long)osVer.majorVersion, (long)osVer.minorVersion, (long)osVer.patchVersion]; ! } // Copy out the char* osVersionCStr = strdup([nsVerStr UTF8String]); } // Fallback if running on pre-10.9 Mac OS if (osVersionCStr == NULL) {
< prev index next >