[Network] Make P/Invokes in NWConnection[Group] have blittable signatures. (#20662)

Contributes towards #15684.
This commit is contained in:
Rolf Bjarne Kvinge 2024-05-31 13:24:20 +02:00 коммит произвёл GitHub
Родитель 7b3ad09aac
Коммит 5c5a4580ec
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -498,7 +498,7 @@ namespace Network {
static extern unsafe void nw_connection_send (IntPtr handle,
IntPtr dispatchData,
IntPtr contentContext,
[MarshalAs (UnmanagedType.U1)] bool isComplete,
byte isComplete,
BlockLiteral* callback);
//
@ -511,7 +511,7 @@ namespace Network {
nw_connection_send (handle: GetCheckedHandle (),
dispatchData: buffer.GetHandle (),
contentContext: contentContext,
isComplete: isComplete,
isComplete: isComplete.AsByte (),
callback: callback);
}

Просмотреть файл

@ -234,7 +234,7 @@ namespace Network {
}
[DllImport (Constants.NetworkLibrary)]
unsafe static extern void nw_connection_group_set_receive_handler (OS_nw_connection_group group, uint maximum_message_size, [MarshalAs (UnmanagedType.I1)] bool reject_oversized_messages, BlockLiteral* handler);
unsafe static extern void nw_connection_group_set_receive_handler (OS_nw_connection_group group, uint maximum_message_size, byte reject_oversized_messages, BlockLiteral* handler);
#if !NET
delegate void nw_connection_group_receive_handler_t (IntPtr block, IntPtr content, IntPtr context, byte isCompleted);
@ -259,7 +259,7 @@ namespace Network {
{
unsafe {
if (handler is null) {
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages, null);
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages.AsByte (), null);
return;
}
@ -270,7 +270,7 @@ namespace Network {
using var block = new BlockLiteral ();
block.SetupBlockUnsafe (static_ReceiveHandler, handler);
#endif
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages, &block);
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages.AsByte (), &block);
}
}
@ -432,8 +432,7 @@ namespace Network {
[MacCatalyst (15, 0)]
#endif
[DllImport (Constants.NetworkLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool nw_connection_group_reinsert_extracted_connection (OS_nw_connection_group group, OS_nw_connection connection);
static extern byte nw_connection_group_reinsert_extracted_connection (OS_nw_connection_group group, OS_nw_connection connection);
#if NET
[SupportedOSPlatform ("tvos15.0")]
@ -451,7 +450,7 @@ namespace Network {
{
if (connection is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (connection));
return nw_connection_group_reinsert_extracted_connection (GetCheckedHandle (), connection.Handle);
return nw_connection_group_reinsert_extracted_connection (GetCheckedHandle (), connection.Handle) != 0;
}
#if NET

Просмотреть файл

@ -27,7 +27,6 @@ namespace Cecil.Tests {
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSend(System.IntPtr,System.IntPtr)",
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper_stret(System.IntPtr,System.IntPtr)",
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper(System.IntPtr,System.IntPtr)",
"System.Boolean Network.NWConnectionGroup::nw_connection_group_reinsert_extracted_connection(System.IntPtr,System.IntPtr)",
"System.Boolean Network.NWContentContext::nw_content_context_get_is_final(System.IntPtr)",
"System.Boolean Network.NWEstablishmentReport::nw_establishment_report_get_proxy_configured(System.IntPtr)",
"System.Boolean Network.NWEstablishmentReport::nw_establishment_report_get_used_proxy(System.IntPtr)",
@ -56,8 +55,6 @@ namespace Cecil.Tests {
"System.Int32 AudioUnit.AUGraph::NewAUGraph(System.IntPtr&)",
"System.IntPtr ObjCRuntime.Selector::GetHandle(System.String)",
"System.IntPtr Security.SecKey::SecKeyCreateEncryptedData(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr&)",
"System.Void Network.NWConnection::nw_connection_send(System.IntPtr,System.IntPtr,System.IntPtr,System.Boolean,ObjCRuntime.BlockLiteral*)",
"System.Void Network.NWConnectionGroup::nw_connection_group_set_receive_handler(System.IntPtr,System.UInt32,System.Boolean,ObjCRuntime.BlockLiteral*)",
"System.Void Network.NWContentContext::nw_content_context_set_is_final(System.IntPtr,System.Boolean)",
"System.Void Network.NWMulticastGroup::nw_multicast_group_descriptor_set_disable_unicast_traffic(System.IntPtr,System.Boolean)",
"System.Void Network.NWParameters::nw_parameters_set_fast_open_enabled(System.IntPtr,System.Boolean)",