4 writes to _lineOffset
Microsoft.Extensions.AI.OpenAI (4)
src\Shared\ServerSentEvents\SseParser_1.cs (4)
153_lineOffset += advance; 233_lineOffset += advance; 319_lineOffset = 0; 552_lineOffset += 3;
22 references to _lineOffset
Microsoft.Extensions.AI.OpenAI (22)
src\Shared\ServerSentEvents\SseParser_1.cs (22)
71/// <summary>The length of valid data in <see cref="_lineBuffer"/>, starting from <see cref="_lineOffset"/>.</summary> 143_newlineIndex - _lineOffset + 1 < _lineLength || // we must have CR and we have whatever comes after it 163_lastSearchedForNewline = _lineOffset + _lineLength; 223_newlineIndex - _lineOffset + 1 < _lineLength || // newline is CR, and we have whatever comes after it 271if (_lastSearchedForNewline > _lineOffset) 274searchLength = _lineLength - (_lastSearchedForNewline - _lineOffset); 278searchOffset = _lineOffset; 282Debug.Assert(searchOffset >= _lineOffset, $"{searchOffset}, {_lineLength}"); 283Debug.Assert(searchOffset <= _lineOffset + _lineLength, $"{searchOffset}, {_lineOffset}, {_lineLength}"); 292Debug.Assert(_newlineIndex - _lineOffset < _lineLength, "Expected to be positioned at a non-empty newline"); 293return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 309if (_lineOffset + _lineLength == _lineBuffer.Length) 311if (_lineOffset != 0) 313_lineBuffer.AsSpan(_lineOffset, _lineLength).CopyTo(_lineBuffer); 316_lastSearchedForNewline -= _lineOffset; 334ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 494int offset = _lineOffset + _lineLength; 520int offset = _lineOffset + _lineLength; 548Debug.Assert(_lineOffset == 0, $"Expected _lineOffset == 0, got {_lineOffset}");