Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CoreMedia] Make OSStatus = System.Int32 a global using directive. #21824

Merged
merged 2 commits into from
Dec 30, 2024
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
1 change: 0 additions & 1 deletion src/AudioToolbox/AudioFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
using CoreFoundation;
using Foundation;

using OSStatus = System.Int32;
using AudioFileID = System.IntPtr;

#if !NET
Expand Down
1 change: 0 additions & 1 deletion src/AudioToolbox/AudioFileStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
using CoreFoundation;
using Foundation;

using OSStatus = System.Int32;
using AudioFileStreamID = System.IntPtr;
using System.Runtime.Versioning;

Expand Down
1 change: 0 additions & 1 deletion src/AudioToolbox/AudioFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
using Foundation;
using ObjCRuntime;

using OSStatus = System.Int32;
using AudioFileID = System.IntPtr;

namespace AudioToolbox {
Expand Down
1 change: 0 additions & 1 deletion src/AudioToolbox/AudioQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
using Foundation;
using ObjCRuntime;

using OSStatus = System.Int32;
using AudioQueueParameterValue = System.Single;
using AudioQueueRef = System.IntPtr;
using AudioQueueTimelineRef = System.IntPtr;
Expand Down
2 changes: 0 additions & 2 deletions src/AudioToolbox/AudioToolbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
using ObjCRuntime;
using Foundation;

using OSStatus = System.Int32;

namespace AudioToolbox {

#if NET
Expand Down
1 change: 0 additions & 1 deletion src/CoreMedia/CMBufferQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Foundation;
using CoreFoundation;
using ObjCRuntime;
using OSStatus = System.Int32;

namespace CoreMedia {

Expand Down
33 changes: 27 additions & 6 deletions src/CoreMedia/CMSampleBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.ComponentModel;

using Foundation;
using CoreFoundation;
using ObjCRuntime;

#if NET
using OSStatus = System.IntPtr;
#else
using OSStatus = System.nint;
#endif

#if !COREBUILD
using AudioToolbox;
using CoreVideo;
Expand Down Expand Up @@ -121,6 +116,19 @@ unsafe static extern OSStatus CMSampleBufferCreateCopyWithNewTiming (
return CreateWithNewTiming (original, timing, out status);
}

#if !XAMCORE_5_0
// OSStatus was incorrectly defined as IntPtr in this file, so providing this overload to keep compatibility,
// while at the same time highly discourage using this overload.
[EditorBrowsable (EditorBrowsableState.Never)]
[OverloadResolutionPriorityAttribute (-1)]
public static CMSampleBuffer? CreateWithNewTiming (CMSampleBuffer original, CMSampleTimingInfo []? timing, out nint status)
{
var rv = CreateWithNewTiming (original, timing, out var actualStatus);
status = (nint) actualStatus;
return rv;
}
#endif // XAMCORE_5_0

public unsafe static CMSampleBuffer? CreateWithNewTiming (CMSampleBuffer original, CMSampleTimingInfo []? timing, out OSStatus status)
{
if (original is null)
Expand Down Expand Up @@ -475,6 +483,19 @@ unsafe static extern OSStatus CMSampleBufferGetSampleTimingInfoArray (
return GetSampleTimingInfo (out status);
}

#if !XAMCORE_5_0
// OSStatus was incorrectly defined as IntPtr in this file, so providing this overload to keep compatibility,
// while at the same time highly discourage using this overload.
[EditorBrowsable (EditorBrowsableState.Never)]
[OverloadResolutionPriorityAttribute (-1)]
public CMSampleTimingInfo []? GetSampleTimingInfo (out nint status)
{
var rv = GetSampleTimingInfo (out OSStatus actualStatus);
status = actualStatus;
return rv;
}
#endif // XAMCORE_5_0

public unsafe CMSampleTimingInfo []? GetSampleTimingInfo (out OSStatus status)
{
nint count;
Expand Down
1 change: 0 additions & 1 deletion src/CoreWlan/CWKeychain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#nullable enable

using OSStatus = System.Int32;
using SecIdentityRef = System.IntPtr;
using CFArrayRef = System.IntPtr;
using NSDataRef = System.IntPtr;
Expand Down
2 changes: 2 additions & 0 deletions src/DotNetGlobals.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#if NET
global using System;
global using System.Runtime.Versioning; // We need the SupportedOSPlatform/UnsupportedOSPlatform attributes pretty much everywhere

global using OSStatus = System.Int32;
#endif
2 changes: 0 additions & 2 deletions src/ImageIO/CGImageSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
using NativeHandle = System.IntPtr;
#endif

using OSStatus = System.Int32;

namespace ImageIO {

#if !COREBUILD
Expand Down
1 change: 0 additions & 1 deletion src/PrintCore/Defs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Foundation;

using PMObject = System.IntPtr;
using OSStatus = System.Int32;
using System.Runtime.Versioning;

namespace PrintCore {
Expand Down
1 change: 0 additions & 1 deletion src/PrintCore/PrintCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using CoreGraphics;
using CoreFoundation;
using PMObject = System.IntPtr;
using OSStatus = System.Int32;

#if !NET
using NativeHandle = System.IntPtr;
Expand Down
4 changes: 2 additions & 2 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31190,7 +31190,7 @@ M:CoreMedia.CMSampleBuffer.CreateForImageBuffer(CoreVideo.CVImageBuffer,System.B
M:CoreMedia.CMSampleBuffer.CreateReady(CoreMedia.CMBlockBuffer,CoreMedia.CMFormatDescription,System.Int32,CoreMedia.CMSampleTimingInfo[],System.UIntPtr[],CoreMedia.CMSampleBufferError@)
M:CoreMedia.CMSampleBuffer.CreateReadyWithImageBuffer(CoreVideo.CVImageBuffer,CoreMedia.CMFormatDescription,CoreMedia.CMSampleTimingInfo@,CoreMedia.CMSampleBufferError@)
M:CoreMedia.CMSampleBuffer.CreateReadyWithPacketDescriptions(CoreMedia.CMBlockBuffer,CoreMedia.CMFormatDescription,System.Int32,CoreMedia.CMTime,AudioToolbox.AudioStreamPacketDescription[],CoreMedia.CMSampleBufferError@)
M:CoreMedia.CMSampleBuffer.CreateWithNewTiming(CoreMedia.CMSampleBuffer,CoreMedia.CMSampleTimingInfo[],System.IntPtr@)
M:CoreMedia.CMSampleBuffer.CreateWithNewTiming(CoreMedia.CMSampleBuffer,CoreMedia.CMSampleTimingInfo[],System.Int32@)
M:CoreMedia.CMSampleBuffer.CreateWithNewTiming(CoreMedia.CMSampleBuffer,CoreMedia.CMSampleTimingInfo[])
M:CoreMedia.CMSampleBuffer.CreateWithPacketDescriptions(CoreMedia.CMBlockBuffer,CoreMedia.CMFormatDescription,System.Int32,CoreMedia.CMTime,AudioToolbox.AudioStreamPacketDescription[],CoreMedia.CMSampleBufferError@)
M:CoreMedia.CMSampleBuffer.Dispose(System.Boolean)
Expand All @@ -31200,7 +31200,7 @@ M:CoreMedia.CMSampleBuffer.GetImageBuffer
M:CoreMedia.CMSampleBuffer.GetSampleAttachments(System.Boolean)
M:CoreMedia.CMSampleBuffer.GetSampleSize(System.IntPtr)
M:CoreMedia.CMSampleBuffer.GetSampleTimingInfo
M:CoreMedia.CMSampleBuffer.GetSampleTimingInfo(System.IntPtr@)
M:CoreMedia.CMSampleBuffer.GetSampleTimingInfo(System.Int32@)
M:CoreMedia.CMSampleBuffer.GetTypeID
M:CoreMedia.CMSampleBuffer.GetVideoFormatDescription
M:CoreMedia.CMSampleBuffer.Invalidate
Expand Down
Loading