mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fix missing length modification in ImVectorWrapper.Insert
This commit is contained in:
parent
b89df8b130
commit
0c3ebd4b5b
1 changed files with 5 additions and 1 deletions
|
|
@ -519,10 +519,11 @@ public unsafe struct ImVectorWrapper<T> : IList<T>, IList, IReadOnlyList<T>, IDi
|
|||
if (index < 0 || index > this.LengthUnsafe)
|
||||
throw new IndexOutOfRangeException();
|
||||
|
||||
this.EnsureCapacityExponential(this.CapacityUnsafe + 1);
|
||||
this.EnsureCapacityExponential(this.LengthUnsafe + 1);
|
||||
var num = this.LengthUnsafe - index;
|
||||
Buffer.MemoryCopy(this.DataUnsafe + index, this.DataUnsafe + index + 1, num * sizeof(T), num * sizeof(T));
|
||||
this.DataUnsafe[index] = item;
|
||||
this.LengthUnsafe += 1;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="List{T}.InsertRange"/>
|
||||
|
|
@ -535,6 +536,7 @@ public unsafe struct ImVectorWrapper<T> : IList<T>, IList, IReadOnlyList<T>, IDi
|
|||
Buffer.MemoryCopy(this.DataUnsafe + index, this.DataUnsafe + index + count, num * sizeof(T), num * sizeof(T));
|
||||
foreach (var item in items)
|
||||
this.DataUnsafe[index++] = item;
|
||||
this.LengthUnsafe += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -551,6 +553,7 @@ public unsafe struct ImVectorWrapper<T> : IList<T>, IList, IReadOnlyList<T>, IDi
|
|||
Buffer.MemoryCopy(this.DataUnsafe + index, this.DataUnsafe + index + items.Length, num * sizeof(T), num * sizeof(T));
|
||||
foreach (var item in items)
|
||||
this.DataUnsafe[index++] = item;
|
||||
this.LengthUnsafe += items.Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -566,6 +569,7 @@ public unsafe struct ImVectorWrapper<T> : IList<T>, IList, IReadOnlyList<T>, IDi
|
|||
this.destroyer?.Invoke(&this.DataUnsafe[index]);
|
||||
|
||||
Buffer.MemoryCopy(this.DataUnsafe + index + 1, this.DataUnsafe + index, num * sizeof(T), num * sizeof(T));
|
||||
this.LengthUnsafe -= 1;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue