Skip to content

Commit f93cadf

Browse files
author
ladeak
committed
Using a const for the stackallocted buffer sizes.
1 parent d691376 commit f93cadf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Http/Headers/src/ContentDispositionHeaderValue.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,12 @@ private static string Encode5987(StringSegment input)
623623
var maxInputBytes = Encoding.UTF8.GetMaxByteCount(input.Length);
624624
byte[]? bufferFromPool = null;
625625
Span<byte> inputBytes = maxInputBytes <= MaxStackAllocSizeBytes
626-
? stackalloc byte[maxInputBytes]
626+
? stackalloc byte[MaxStackAllocSizeBytes]
627627
: bufferFromPool = ArrayPool<byte>.Shared.Rent(maxInputBytes);
628628

629629
char[]? charBufferFromPool = null;
630630
Span<char> tempCharBuffer = input.Length <= MaxStackAllocSizeChars
631-
? stackalloc char[input.Length]
631+
? stackalloc char[MaxStackAllocSizeChars]
632632
: charBufferFromPool = ArrayPool<char>.Shared.Rent(input.Length);
633633

634634
var bytesWritten = Encoding.UTF8.GetBytes(input, inputBytes);

0 commit comments

Comments
 (0)