diff --git a/Directory.Build.props b/Directory.Build.props index 3d045f1..850fc00 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ - 2.2.3 + 2.2.4 diff --git a/src/Vortice.Win32.Graphics.Direct3D11/ID3D11DeviceChild.cs b/src/Vortice.Win32.Graphics.Direct3D11/ID3D11DeviceChild.cs index 6030542..01a9728 100644 --- a/src/Vortice.Win32.Graphics.Direct3D11/ID3D11DeviceChild.cs +++ b/src/Vortice.Win32.Graphics.Direct3D11/ID3D11DeviceChild.cs @@ -10,7 +10,7 @@ public static unsafe class ID3D11DeviceChildExtensions public static string? GetDebugName(ref this TD3D11DeviceChild self) where TD3D11DeviceChild : unmanaged, ID3D11DeviceChild.Interface { - sbyte* pname = stackalloc sbyte[1024]; + byte* pname = stackalloc byte[1024]; uint size = 1024 - 1; if (self.GetPrivateData(ID3D11DeviceChild.D3DDebugObjectNameGuid, &size, pname).Failure) { @@ -30,7 +30,7 @@ public static unsafe class ID3D11DeviceChildExtensions } else { - fixed (sbyte* valuePtr = value.GetUtf8Span()) + fixed (byte* valuePtr = value.GetUtf8Span()) { _ = self.SetPrivateData(ID3D11DeviceChild.D3DDebugObjectNameGuid, (uint)value!.Length, valuePtr); } diff --git a/src/Vortice.Win32/StringUtilities.cs b/src/Vortice.Win32/StringUtilities.cs index b103a19..2c9aaee 100644 --- a/src/Vortice.Win32/StringUtilities.cs +++ b/src/Vortice.Win32/StringUtilities.cs @@ -1,9 +1,7 @@ // Copyright (c) Amer Koleci and contributors. // Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System.Text; -using static Win32.UnsafeUtilities; namespace Win32; @@ -12,7 +10,7 @@ namespace Win32; /// public static unsafe class StringUtilities { - public static string? GetString(sbyte* pointer, int maxLength = -1) + public static string? GetString(byte* pointer, int maxLength = -1) { return GetUtf8Span(pointer, maxLength).GetString(); } @@ -26,7 +24,7 @@ public static unsafe class StringUtilities /// The string for which to get the null-terminated UTF8 character sequence. /// A null-terminated UTF8 character sequence created from . [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan GetUtf8Span(this string? source) + public static ReadOnlySpan GetUtf8Span(this string? source) { ReadOnlySpan result; @@ -42,7 +40,7 @@ public static unsafe class StringUtilities result = null; } - return result.As(); + return result; } /// Gets a span for a null-terminated UTF8 character sequence. @@ -50,7 +48,7 @@ public static unsafe class StringUtilities /// The maxmimum length of or -1 if the maximum length is unknown. /// A span that starts at and extends to or the first null character, whichever comes first. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan GetUtf8Span(sbyte* source, int maxLength = -1) + public static ReadOnlySpan GetUtf8Span(byte* source, int maxLength = -1) => (source != null) ? GetUtf8Span(in source[0], maxLength) : null; /// Gets a span for a null-terminated UTF8 character sequence. @@ -58,9 +56,9 @@ public static unsafe class StringUtilities /// The maxmimum length of or -1 if the maximum length is unknown. /// A span that starts at and extends to or the first null character, whichever comes first. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan GetUtf8Span(in sbyte source, int maxLength = -1) + public static ReadOnlySpan GetUtf8Span(in byte source, int maxLength = -1) { - ReadOnlySpan result; + ReadOnlySpan result; if (!Unsafe.IsNullRef(in source)) { @@ -70,7 +68,7 @@ public static unsafe class StringUtilities } result = MemoryMarshal.CreateReadOnlySpan(in source, maxLength); - var length = result.IndexOf((sbyte)'\0'); + var length = result.IndexOf((byte)'\0'); if (length != -1) { @@ -147,11 +145,11 @@ public static unsafe class StringUtilities /// The span for which to create the string. /// A string created from . [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static string? GetString(this ReadOnlySpan span) + public static string? GetString(this ReadOnlySpan span) { if (span.GetPointer() == null) return null; - return Encoding.UTF8.GetString(span.As()); + return Encoding.UTF8.GetString(span); } }