mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
Use SeString.EncodeWithNullTerminator and improve doc comments for raw setters
This commit is contained in:
parent
15034298a5
commit
c0968a61f6
1 changed files with 14 additions and 4 deletions
|
|
@ -273,14 +273,14 @@ public interface INamePlateUpdateHandler
|
||||||
void SetField(NamePlateStringField field, SeString value);
|
void SetField(NamePlateStringField field, SeString value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the string array value for the provided field.
|
/// Sets the string array value for the provided field. The provided byte sequence must be null-terminated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="field">The field to write to.</param>
|
/// <param name="field">The field to write to.</param>
|
||||||
/// <param name="value">The ReadOnlySpan of bytes to write.</param>
|
/// <param name="value">The ReadOnlySpan of bytes to write.</param>
|
||||||
void SetField(NamePlateStringField field, ReadOnlySpan<byte> value);
|
void SetField(NamePlateStringField field, ReadOnlySpan<byte> value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the string array value for the provided field.
|
/// Sets the string array value for the provided field. The provided byte sequence must be null-terminated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="field">The field to write to.</param>
|
/// <param name="field">The field to write to.</param>
|
||||||
/// <param name="value">The pointer to a null-terminated sequence of bytes to write.</param>
|
/// <param name="value">The pointer to a null-terminated sequence of bytes to write.</param>
|
||||||
|
|
@ -550,7 +550,12 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void SetField(NamePlateStringField field, SeString value)
|
public void SetField(NamePlateStringField field, SeString value)
|
||||||
{
|
{
|
||||||
this.context.StringData->SetValue(this.ArrayIndex + (int)field, value.Encode(), true, true, true);
|
this.context.StringData->SetValue(
|
||||||
|
this.ArrayIndex + (int)field,
|
||||||
|
value.EncodeWithNullTerminator(),
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -601,6 +606,11 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler
|
||||||
{
|
{
|
||||||
if ((nint)this.GetFieldAsPointer(field) == NamePlateGui.EmptyStringPointer)
|
if ((nint)this.GetFieldAsPointer(field) == NamePlateGui.EmptyStringPointer)
|
||||||
return;
|
return;
|
||||||
this.context.StringData->SetValue(this.ArrayIndex + (int)field, value.Encode(), true, true, true);
|
this.context.StringData->SetValue(
|
||||||
|
this.ArrayIndex + (int)field,
|
||||||
|
value.EncodeWithNullTerminator(),
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue