Skip to content

Use span slice instead of substring in AbbreviatedGeometryParser.ReadNumber #6272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,13 @@ double ReadNumber(bool allowComma)
}
else
{
string subString = _pathString.Substring(start, _curIndex - start);

try
{
return System.Convert.ToDouble(subString, _formatProvider);
#if PRESENTATION_CORE
return double.Parse(_pathString.AsSpan(start, _curIndex - start), provider: _formatProvider);
#else
return double.Parse(_pathString.Substring(start, _curIndex - start), provider: _formatProvider);
#endif
}
catch (FormatException except)
{
Expand Down Expand Up @@ -691,9 +693,9 @@ internal void ParseToGeometryContext(
large,
#if PBTCOMPILER
sweep,
#else
#else
sweep ? SweepDirection.Clockwise : SweepDirection.Counterclockwise,
#endif
#endif
IsStroked,
! IsSmoothJoin
);
Expand Down