Updated code to correct build errors for Jellyfin.Extensions
This commit is contained in:
@@ -28,13 +28,14 @@ SOFTWARE.
|
||||
|
||||
// TODO: remove when analyzer is fixed: https://github.com/dotnet/roslyn-analyzers/issues/5158
|
||||
#pragma warning disable CA1034 // Nested types should not be visible
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.InteropServices;
|
||||
#pragma warning disable SA1309 // Variables should not begin with underscore
|
||||
|
||||
namespace Jellyfin.Extensions
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// Extension class for splitting lines without unnecessary allocations.
|
||||
/// </summary>
|
||||
@@ -74,9 +75,9 @@ namespace Jellyfin.Extensions
|
||||
/// <param name="separator">The separator to split on.</param>
|
||||
public Enumerator(ReadOnlySpan<char> str, char separator)
|
||||
{
|
||||
_str = str;
|
||||
_separator = separator;
|
||||
Current = default;
|
||||
this._str = str;
|
||||
this._separator = separator;
|
||||
this.Current = default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -96,22 +97,22 @@ namespace Jellyfin.Extensions
|
||||
/// <returns><c>true</c> if there is a next element; otherwise <c>false</c>.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (_str.Length == 0)
|
||||
if (this._str.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var span = _str;
|
||||
var index = span.IndexOf(_separator);
|
||||
var span = this._str;
|
||||
var index = span.IndexOf(this._separator);
|
||||
if (index == -1)
|
||||
{
|
||||
_str = ReadOnlySpan<char>.Empty;
|
||||
Current = span;
|
||||
this._str = ReadOnlySpan<char>.Empty;
|
||||
this.Current = span;
|
||||
return true;
|
||||
}
|
||||
|
||||
Current = span.Slice(0, index);
|
||||
_str = span[(index + 1)..];
|
||||
this.Current = span.Slice(0, index);
|
||||
this._str = span[(index + 1)..];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user