From cc49c120038058ef0848fafa81f9c8d79ce440da Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 23 Apr 2020 10:29:24 -0700 Subject: [PATCH] Changes triggered by the CA1834 analyzer (#35227) * Cherry pick if needed * Changes triggered by https://github.com/dotnet/roslyn-analyzers/pull/3481 * sq * Revert "Cherry pick if needed" This reverts commit 55a98c41f6d2143737ec707faf2a3cf213474c97. * sq --- src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs | 4 ++-- .../System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidator.cs | 2 +- .../System.Private.Xml/src/System/Xml/Xsl/XsltOld/RecordBuilder.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs b/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs index 87a5db6..b514d78 100644 --- a/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs +++ b/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs @@ -38,7 +38,7 @@ namespace System.Net internal const string MaxSupportedVersionString = "1"; internal const string SeparatorLiteral = "; "; - internal const string EqualsLiteral = "="; + internal const char EqualsLiteral = '='; internal const string QuotesLiteral = "\""; internal const string SpecialAttributeLiteral = "$"; @@ -837,7 +837,7 @@ namespace System.Net { result += SeparatorLiteral + CookieFields.VersionAttributeName + EqualsLiteral + m_version.ToString(NumberFormatInfo.InvariantInfo); } - return result == EqualsLiteral ? null : result; + return result == "=" ? null : result; } } } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidator.cs b/src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidator.cs index c94e06c..d751e08 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidator.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidator.cs @@ -139,7 +139,7 @@ namespace System.Xml.Schema private static readonly XmlSchemaDatatype s_dtStringArray = s_dtCDATA.DeriveByList(null); //Error message constants - private const string Quote = "'"; + private const char Quote = '\''; //Empty arrays private static readonly XmlSchemaParticle[] s_emptyParticleArray = Array.Empty(); diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XsltOld/RecordBuilder.cs b/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XsltOld/RecordBuilder.cs index 4591f48..a062c6a 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XsltOld/RecordBuilder.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XsltOld/RecordBuilder.cs @@ -43,7 +43,7 @@ namespace System.Xml.Xsl.XsltOld private const int HaveRecord = 2; // Record was fully generated private const char s_Minus = '-'; - private const string s_Space = " "; + private const char s_Space = ' '; private const string s_SpaceMinus = " -"; private const char s_Question = '?'; private const char s_Greater = '>'; @@ -655,7 +655,7 @@ namespace System.Xml.Xsl.XsltOld } else if (minus) { - _mainNode.ValueAppend(s_Space, false); + _mainNode.ValueAppend(" ", false); } } -- 2.7.4