Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryReadQuotedInt32Value()

static bool System.Net.Http.Headers.AltSvcHeaderParser.TryReadQuotedInt32Value ( ReadOnlySpan< char > value,
out int result )
inlinestaticprivate

Definition at line 331 of file AltSvcHeaderParser.cs.

332 {
333 if (value.Length == 0)
334 {
335 result = 0;
336 return false;
337 }
338 int num = 0;
339 ReadOnlySpan<char> readOnlySpan = value;
340 for (int i = 0; i < readOnlySpan.Length; i++)
341 {
342 char c = readOnlySpan[i];
343 switch (c)
344 {
345 default:
346 result = 0;
347 return false;
348 case '0':
349 case '1':
350 case '2':
351 case '3':
352 case '4':
353 case '5':
354 case '6':
355 case '7':
356 case '8':
357 case '9':
358 {
359 long num2 = (long)num * 10L + (c - 48);
360 if (num2 > int.MaxValue)
361 {
362 result = 0;
363 return false;
364 }
365 num = (int)num2;
366 break;
367 }
368 case '\\':
369 break;
370 }
371 }
372 result = num;
373 return true;
374 }

References System.L, System.ReadOnlySpan< T >.Length, and System.value.

Referenced by System.Net.Http.Headers.AltSvcHeaderParser.TryReadQuotedAltAuthority(), and System.Net.Http.Headers.AltSvcHeaderParser.TryReadTokenOrQuotedInt32().