diff --git a/contrib/platform/src/com/sun/jna/platform/mac/IOKit.java b/contrib/platform/src/com/sun/jna/platform/mac/IOKit.java index 7b079d0d27..edc437dc7a 100644 --- a/contrib/platform/src/com/sun/jna/platform/mac/IOKit.java +++ b/contrib/platform/src/com/sun/jna/platform/mac/IOKit.java @@ -54,8 +54,6 @@ public interface IOKit extends Library { MachPort MACH_PORT_NULL = new MachPort(); - - /** * IOKitLib implements non-kernel task access to common IOKit object types - * IORegistryEntry, IOService, IOIterator etc. These functions are generic - @@ -322,8 +320,7 @@ CFTypeRef IORegistryEntryCreateCFProperty(IORegistryEntry entry, CFStringRef key * @return 0 if successful, otherwise a {@code kern_return_t} error code. */ int IORegistryEntryCreateCFProperties(IORegistryEntry entry, PointerByReference properties, - CFAllocatorRef allocator, - int options); + CFAllocatorRef allocator, int options); /** * Create a CF representation of a registry entry's property. @@ -348,8 +345,7 @@ int IORegistryEntryCreateCFProperties(IORegistryEntry entry, PointerByReference * caller should release with CFRelease. */ CFTypeRef IORegistryEntrySearchCFProperty(IORegistryEntry entry, String plane, CFStringRef key, - CFAllocatorRef allocator, - int options); + CFAllocatorRef allocator, int options); /** * Returns an ID for the registry entry that is global to all tasks. diff --git a/contrib/platform/test/com/sun/jna/platform/mac/CoreFoundationTest.java b/contrib/platform/test/com/sun/jna/platform/mac/CoreFoundationTest.java index 023b9eb7b1..a6d1a173a8 100644 --- a/contrib/platform/test/com/sun/jna/platform/mac/CoreFoundationTest.java +++ b/contrib/platform/test/com/sun/jna/platform/mac/CoreFoundationTest.java @@ -61,7 +61,7 @@ public class CoreFoundationTest { public void testCFStringRef() { String awesome = "ǝɯosǝʍɐ sı ∀Nſ"; // Unicode CFStringRef cfAwesome = CFStringRef.createCFString(awesome); - assertEquals(awesome.length(), CF.CFStringGetLength(cfAwesome)); + assertEquals(awesome.length(), CF.CFStringGetLength(cfAwesome).intValue()); assertEquals(awesome, cfAwesome.stringValue()); Memory mem = new Memory(awesome.getBytes().length + 1); @@ -105,13 +105,13 @@ public void testCFRetainCount() { DoubleByReference e = new DoubleByReference(Math.E); CFNumberRef cfE = CF.CFNumberCreate(null, CFNumberType.kCFNumberDoubleType.typeIndex(), e); CFNumberRef cfPi = CF.CFNumberCreate(null, CFNumberType.kCFNumberDoubleType.typeIndex(), pi); - assertEquals(1, CF.CFGetRetainCount(cfE)); - assertEquals(1, CF.CFGetRetainCount(cfPi)); + assertEquals(1, CF.CFGetRetainCount(cfE).intValue()); + assertEquals(1, CF.CFGetRetainCount(cfPi).intValue()); cfE.retain(); cfPi.retain(); cfPi.retain(); - assertEquals(2, CF.CFGetRetainCount(cfE)); - assertEquals(3, CF.CFGetRetainCount(cfPi)); + assertEquals(2, CF.CFGetRetainCount(cfE).intValue()); + assertEquals(3, CF.CFGetRetainCount(cfPi).intValue()); List irrationalReferences = new ArrayList<>(); irrationalReferences.add(cfE); @@ -120,10 +120,10 @@ public void testCFRetainCount() { value.release(); } - assertEquals(1, CF.CFGetRetainCount(cfE)); - assertEquals(2, CF.CFGetRetainCount(cfPi)); + assertEquals(1, CF.CFGetRetainCount(cfE).intValue()); + assertEquals(2, CF.CFGetRetainCount(cfPi).intValue()); cfPi.release(); - assertEquals(1, CF.CFGetRetainCount(cfPi)); + assertEquals(1, CF.CFGetRetainCount(cfPi).intValue()); cfE.release(); cfPi.release(); } @@ -140,7 +140,7 @@ public void testCFArray() { } CFArrayRef cfPtrArray = CF.CFArrayCreate(null, contiguousArray, new CFIndex(refArray.length), null); - assertEquals(refArray.length, CF.CFArrayGetCount(cfPtrArray)); + assertEquals(refArray.length, CF.CFArrayGetCount(cfPtrArray).intValue()); for (int i = 0; i < refArray.length; i++) { Pointer result = CF.CFArrayGetValueAtIndex(cfPtrArray, new CFIndex(i)); CFNumberRef numRef = new CFNumberRef(result); diff --git a/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java b/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java index 93c1e83f8d..a49f61932b 100644 --- a/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java +++ b/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java @@ -147,6 +147,7 @@ public void testIteratorParentChild() { // Iterate over USB Controllers. All devices are children of one of // these controllers in the "IOService" plane IOIterator iter = IOKitUtil.getMatchingServices("IOUSBController"); + assertNotNull(iter); IORegistryEntry controllerDevice = iter.next(); while (controllerDevice != null) { LongByReference id = new LongByReference();