Skip to content

Commit 7114de9

Browse files
committed
remove 'CChar' alias
1 parent f59ce91 commit 7114de9

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

tools/Discord.Net.Dave/DaveSession.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public unsafe DaveKeyRatchet GetKeyRatchet(ulong userId)
276276
return new(
277277
libdave.SessionGetKeyRatchet(
278278
UnderlyingHandle,
279-
(CChar*)strHandle.Pointer
279+
(byte*)strHandle.Pointer
280280
)
281281
);
282282
}
@@ -320,7 +320,7 @@ public async Task<ManuallyAllocatedHeapSpan<byte>> GetPairwiseFingerprintAsync(
320320
libdave.SessionGetPairwiseFingerprint(
321321
UnderlyingHandle,
322322
protocolVersion.Value,
323-
(CChar*)userIdStr.Pointer,
323+
(byte*)userIdStr.Pointer,
324324
(PairwiseFingerprintCallback)Marshal.GetFunctionPointerForDelegate(callback)
325325
);
326326
}

tools/Discord.Net.Dave/Utils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ internal static class Utils
2020
/// <param name="str">The span containing the C string of the snowflake.</param>
2121
/// <returns>A handle used to free the C string.</returns>
2222
/// <exception cref="InvalidOperationException">The ID couldn't be formatted.</exception>
23-
public static unsafe AllocHandle ToCString(ulong id, out ReadOnlySpan<CChar> str)
23+
public static unsafe AllocHandle ToCString(ulong id, out ReadOnlySpan<byte> str)
2424
{
25-
var ptr = (CChar*)NativeMemory.Alloc(SnowflakeMaxCStringLength);
25+
var ptr = (byte*)NativeMemory.Alloc(SnowflakeMaxCStringLength);
2626
var span = new Span<byte>(ptr, SnowflakeMaxCStringLength);
2727

2828
if (!id.TryFormat(span, out var sz))

tools/Discord.Net.Dave/libdave.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
*/
77
global using unsafe KeyPairContextType = byte*;
88

9-
global using CChar = byte;
10-
119
global using SessionHandle = nuint;
1210
global using CommitResultHandle = nuint;
1311
global using WelcomeResultHandle = nuint;
@@ -284,7 +282,7 @@ public static unsafe partial class libdave
284282
[LibraryImport(LIBRARY_NAME, EntryPoint = "daveSessionCreate")]
285283
public static partial SessionHandle SessionCreate(
286284
KeyPairContextType context,
287-
CChar* authSessionId,
285+
byte* authSessionId,
288286
MLSFailureCallback callback
289287
);
290288

@@ -307,7 +305,7 @@ public static partial void SessionInit(
307305
SessionHandle session,
308306
ushort version,
309307
ulong groupId,
310-
ReadOnlySpan<CChar> selfUserId
308+
ReadOnlySpan<byte> selfUserId
311309
);
312310

313311
// void daveSessionReset(DAVESessionHandle session)
@@ -366,7 +364,7 @@ public static partial void SessionProcessProposals(
366364
SessionHandle session,
367365
byte* proposals,
368366
nint length,
369-
CChar** recognizedUserIds,
367+
byte** recognizedUserIds,
370368
nint recognizedUserIdsLength,
371369
byte** commitWelcomeBytes,
372370
nint* commitWelcomeBytesLength
@@ -427,7 +425,7 @@ public static partial void SessionGetMarshalledKeyPackage(
427425
[LibraryImport(LIBRARY_NAME, EntryPoint = "daveSessionGetKeyRatchet")]
428426
public static partial KeyRatchetHandle SessionGetKeyRatchet(
429427
SessionHandle session,
430-
CChar* userId
428+
byte* userId
431429
);
432430

433431
/*
@@ -442,7 +440,7 @@ public static partial KeyRatchetHandle SessionGetKeyRatchet(
442440
public static partial void SessionGetPairwiseFingerprint(
443441
SessionHandle session,
444442
ushort version,
445-
CChar* userId,
443+
byte* userId,
446444
PairwiseFingerprintCallback callback
447445
);
448446

0 commit comments

Comments
 (0)