Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/CoreFoundation/CFArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
using ObjCRuntime;

using CFIndex = System.nint;
using CFArrayRef = System.IntPtr;
using CFAllocatorRef = System.IntPtr;
Comment on lines +38 to +39

@ghost ghost Nov 11, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we name IntPtrs with using statements and not just use IntPtrdirectly for the parmeter types in Clone()? There's other bindings that use IntPtr directly and mention the objc/c type in an inline comment. What's the standard practice?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is easier to read. I would have changed all, but would have increase the diff. It does not change the output result of the binding.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha nice question, but yeah just for readability.

giphy


namespace CoreFoundation {

Expand Down Expand Up @@ -149,6 +151,11 @@ public static nint GetCount (IntPtr array)
{
return CFArrayGetCount (array);
}

[DllImport (Constants.CoreFoundationLibrary)]
extern static CFArrayRef CFArrayCreateCopy (CFAllocatorRef allocator, CFArrayRef theArray);

public CFArray Clone () => new CFArray (CFArrayCreateCopy (IntPtr.Zero, this.Handle), true);
}
}

1 change: 0 additions & 1 deletion tests/xtro-sharpie/common-CoreFoundation.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@
!missing-pinvoke! CFArrayApplyFunction is not bound
!missing-pinvoke! CFArrayBSearchValues is not bound
!missing-pinvoke! CFArrayContainsValue is not bound
!missing-pinvoke! CFArrayCreateCopy is not bound
!missing-pinvoke! CFArrayCreateMutable is not bound
!missing-pinvoke! CFArrayCreateMutableCopy is not bound
!missing-pinvoke! CFArrayExchangeValuesAtIndices is not bound
Expand Down