Skip to content

Commit

Permalink
Remove some unused unmanaged->managed direction methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoritzinsky committed Jul 11, 2022
1 parent 07ce896 commit 72e9f03
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static unsafe class ArrayMarshaller<T, TUnmanagedElement>

// Always allocate at least one byte when the array is zero-length.
int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1);
return (byte*)Marshal.AllocCoTaskMem(spaceToAllocate);
return (TUnmanagedElement*)Marshal.AllocCoTaskMem(spaceToAllocate);
}

public static ReadOnlySpan<T> GetManagedValuesSource(T[]? managed)
Expand Down Expand Up @@ -126,21 +126,6 @@ public void FromManaged(T[]? array, Span<TUnmanagedElement> buffer)
/// </summary>
public TUnmanagedElement* ToUnmanaged() => (TUnmanagedElement*)Unsafe.AsPointer(ref GetPinnableReference());

/// <summary>
/// Sets the unmanaged value representing the array.
/// </summary>
/// <param name="value">The unmanaged value.</param>
public void FromUnmanaged(TUnmanagedElement* value)
{
_allocatedMemory = value;
}

/// <summary>
/// Returns the managed array.
/// </summary>
/// <seealso cref="CustomTypeMarshallerDirection.Out"/>
public T[]? ToManaged() => _managedArray;

/// <summary>
/// Frees resources.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,6 @@ public void FromManaged(T*[]? array, Span<TUnmanagedElement> buffer)
/// </summary>
public TUnmanagedElement* ToUnmanaged() => (TUnmanagedElement*)Unsafe.AsPointer(ref GetPinnableReference());

/// <summary>
/// Sets the unmanaged value representing the array.
/// </summary>
/// <param name="value">The unmanaged value.</param>
public void FromUnmanaged(TUnmanagedElement* value) => _allocatedMemory = value;

/// <summary>
/// Returns the managed array.
/// </summary>
/// <seealso cref="CustomTypeMarshallerDirection.Out"/>
public T*[]? ToManaged() => _managedArray;

/// <summary>
/// Frees resources.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2174,8 +2174,6 @@ public void FromManaged(T[]? array, System.Span<TUnmanagedElement> buffer) { }
public ref TUnmanagedElement GetPinnableReference() { throw null; }
public static ref T GetPinnableReference(T[]? array) { throw null; }
public TUnmanagedElement* ToUnmanaged() { throw null; }
public void FromUnmanaged(TUnmanagedElement* value) { }
public T[]? ToManaged() { throw null; }
public void Free() { }
}
}
Expand Down Expand Up @@ -2312,8 +2310,6 @@ public void FromManaged(T*[]? array, System.Span<TUnmanagedElement> buffer) { }
public ref TUnmanagedElement GetPinnableReference() { throw null; }
public static ref byte GetPinnableReference(T*[]? array) { throw null; }
public TUnmanagedElement* ToUnmanaged() { throw null; }
public void FromUnmanaged(TUnmanagedElement* value) { }
public T*[]? ToManaged() { throw null; }
public void Free() { }
}
}
Expand Down

0 comments on commit 72e9f03

Please sign in to comment.