Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Jan 27, 2021
1 parent cb246b8 commit c2b22b9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions csharp/src/Google.Protobuf/WritingPrimitives.cs
Expand Up @@ -172,9 +172,8 @@ public static void WriteString(ref Span<byte> buffer, ref WriterInternalState st
// This saves calling GetByteCount on the string. We get the string length from GetBytes.
if (value.Length <= MaxSmallStringLength && buffer.Length - state.position - 1 >= value.Length * MaxBytesPerChar)
{
// Get the original position, then increment it on state by 1, then write string to buffer.
// Method will return byte length, which is then set to the original position.
buffer[state.position++] = (byte)WriteStringToBuffer(buffer, ref state, value);
int indexOfLengthDelimiter = state.position++;
buffer[indexOfLengthDelimiter] = (byte)WriteStringToBuffer(buffer, ref state, value);
return;
}

Expand Down

0 comments on commit c2b22b9

Please sign in to comment.