You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -13,7 +13,7 @@ namespace System.Runtime.Serialization.Configuration
|
||||
{
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("config");
|
||||
}
|
||||
#pragma warning suppress 56506 // [....], config is checked above
|
||||
#pragma warning suppress 56506 // Microsoft, config is checked above
|
||||
return (SerializationSectionGroup)config.SectionGroups[ConfigurationStrings.SectionGroupName];
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace System.Runtime.Serialization.Json
|
||||
|
||||
// This wrapper does not support seek.
|
||||
// Supports: UTF-8, Unicode, BigEndianUnicode
|
||||
// ASSUMPTION ([....]): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
|
||||
// ASSUMPTION (Microsoft): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
|
||||
class JsonEncodingStreamWrapper : Stream
|
||||
{
|
||||
[Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview - Static fields are marked SecurityCritical or readonly to prevent"
|
||||
|
@ -27,6 +27,9 @@ namespace System.Runtime.Serialization.Json
|
||||
const char WHITESPACE = ' ';
|
||||
const char CARRIAGE_RETURN = '\r';
|
||||
const char NEWLINE = '\n';
|
||||
const char BACKSPACE = '\b';
|
||||
const char FORM_FEED = '\f';
|
||||
const char HORIZONTAL_TABULATION = '\t';
|
||||
const string xmlNamespace = "http://www.w3.org/XML/1998/namespace";
|
||||
const string xmlnsNamespace = "http://www.w3.org/2000/xmlns/";
|
||||
|
||||
@ -34,6 +37,9 @@ namespace System.Runtime.Serialization.Json
|
||||
+ " data from being modified or leaked to other components in appdomain.")]
|
||||
[SecurityCritical]
|
||||
static BinHexEncoding binHexEncoding;
|
||||
|
||||
// This array was part of a perf improvement for escaping characters < WHITESPACE.
|
||||
static char[] CharacterAbbrevs;
|
||||
|
||||
string attributeText;
|
||||
JsonDataType dataType;
|
||||
@ -71,6 +77,57 @@ namespace System.Runtime.Serialization.Json
|
||||
this.indentChars = indentChars;
|
||||
}
|
||||
InitializeWriter();
|
||||
|
||||
if (CharacterAbbrevs == null)
|
||||
{
|
||||
CharacterAbbrevs = GetCharacterAbbrevs();
|
||||
}
|
||||
}
|
||||
|
||||
private static char[] GetCharacterAbbrevs()
|
||||
{
|
||||
var abbrevs = new char[WHITESPACE];
|
||||
for(int i = 0; i < WHITESPACE; i++)
|
||||
{
|
||||
char abbrev;
|
||||
if (!LocalAppContextSwitches.DoNotUseEcmaScriptV6EscapeControlCharacter && TryEscapeControlCharacter((char)i, out abbrev))
|
||||
{
|
||||
abbrevs[i] = abbrev;
|
||||
}
|
||||
else
|
||||
{
|
||||
abbrevs[i] = (char) 0;
|
||||
}
|
||||
}
|
||||
|
||||
return abbrevs;
|
||||
}
|
||||
|
||||
private static bool TryEscapeControlCharacter(char ch, out char abbrev)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case BACKSPACE:
|
||||
abbrev = 'b';
|
||||
break;
|
||||
case HORIZONTAL_TABULATION:
|
||||
abbrev = 't';
|
||||
break;
|
||||
case NEWLINE:
|
||||
abbrev = 'n';
|
||||
break;
|
||||
case FORM_FEED:
|
||||
abbrev = 'f';
|
||||
break;
|
||||
case CARRIAGE_RETURN:
|
||||
abbrev = 'r';
|
||||
break;
|
||||
default:
|
||||
abbrev = ' ';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
enum JsonDataType
|
||||
@ -794,7 +851,7 @@ namespace System.Runtime.Serialization.Json
|
||||
WriteString(new string(buffer, index, count));
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // [....], ToLowerInvariant is just used in Json error message
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // Microsoft, ToLowerInvariant is just used in Json error message
|
||||
public override void WriteStartAttribute(string prefix, string localName, string ns)
|
||||
{
|
||||
if (IsClosed)
|
||||
@ -1376,7 +1433,7 @@ namespace System.Runtime.Serialization.Json
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // [....], ToLowerInvariant is just used in Json error message
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] // Microsoft, ToLowerInvariant is just used in Json error message
|
||||
void ThrowInvalidAttributeContent()
|
||||
{
|
||||
if (HasOpenAttribute)
|
||||
@ -1450,7 +1507,7 @@ namespace System.Runtime.Serialization.Json
|
||||
{
|
||||
char ch = chars[j];
|
||||
if (ch <= FORWARD_SLASH)
|
||||
{
|
||||
{
|
||||
if (ch == FORWARD_SLASH || ch == JsonGlobals.QuoteChar)
|
||||
{
|
||||
nodeWriter.WriteChars(chars + i, j - i);
|
||||
@ -1462,9 +1519,17 @@ namespace System.Runtime.Serialization.Json
|
||||
{
|
||||
nodeWriter.WriteChars(chars + i, j - i);
|
||||
nodeWriter.WriteText(BACK_SLASH);
|
||||
nodeWriter.WriteText('u');
|
||||
nodeWriter.WriteText(string.Format(CultureInfo.InvariantCulture, "{0:x4}", (int)ch));
|
||||
i = j + 1;
|
||||
if (CharacterAbbrevs[ch] == 0)
|
||||
{
|
||||
nodeWriter.WriteText('u');
|
||||
nodeWriter.WriteText(string.Format(CultureInfo.InvariantCulture, "{0:x4}", (int)ch));
|
||||
i = j + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeWriter.WriteText(CharacterAbbrevs[ch]);
|
||||
i = j + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ch == BACK_SLASH)
|
||||
|
@ -11,9 +11,9 @@ namespace System.Xml
|
||||
// This wrapper does not support seek.
|
||||
// Constructors consume/emit byte order mark.
|
||||
// Supports: UTF-8, Unicode, BigEndianUnicode
|
||||
// ASSUMPTION ([....]): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
|
||||
// ASSUMPTION ([....]): The byte buffer is large enough to hold the declaration
|
||||
// ASSUMPTION ([....]): The buffer manipulation methods (FillBuffer/Compare/etc.) will only be used to parse the declaration
|
||||
// ASSUMPTION (Microsoft): This class will only be used for EITHER reading OR writing. It can be done, it would just mean more buffers.
|
||||
// ASSUMPTION (Microsoft): The byte buffer is large enough to hold the declaration
|
||||
// ASSUMPTION (Microsoft): The buffer manipulation methods (FillBuffer/Compare/etc.) will only be used to parse the declaration
|
||||
// during construction.
|
||||
class EncodingStreamWrapper : Stream
|
||||
{
|
||||
@ -749,7 +749,7 @@ namespace System.Xml
|
||||
|
||||
// Add format exceptions
|
||||
// Do we need to modify the stream position/Seek to account for the buffer?
|
||||
// ASSUMPTION ([....]): This class will only be used for EITHER reading OR writing.
|
||||
// ASSUMPTION (Microsoft): This class will only be used for EITHER reading OR writing.
|
||||
#if NO
|
||||
class UTF16Stream : Stream
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ namespace System.Xml
|
||||
if (object.ReferenceEquals(id1, null) || object.ReferenceEquals(id2, null))
|
||||
return false;
|
||||
|
||||
#pragma warning suppress 56506 // [....], checks for whether id1 and id2 are null done above.
|
||||
#pragma warning suppress 56506 // Microsoft, checks for whether id1 and id2 are null done above.
|
||||
if (id1.IsGuid && id2.IsGuid)
|
||||
{
|
||||
return id1.idLow == id2.idLow && id1.idHigh == id2.idHigh;
|
||||
|
@ -539,7 +539,7 @@ namespace System.Xml
|
||||
}
|
||||
}
|
||||
|
||||
// ASSUMPTION ([....]): all chars in str will be ASCII
|
||||
// ASSUMPTION (Microsoft): all chars in str will be ASCII
|
||||
public bool Equals2(string str, bool checkLower)
|
||||
{
|
||||
if (this.type != ValueHandleType.UTF8)
|
||||
|
@ -1 +1 @@
|
||||
008ed195fb5be846e544d683f6ae95ec2f25c1fe
|
||||
f92e4af7485d831932c37d65ed819620bfd40c4f
|
@ -1,9 +1,9 @@
|
||||
//------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------
|
||||
// PERF, [....], [....]: Make LookupNamespace do something smarter when lots of names
|
||||
// PERF, [....], [....]: Make Attribute lookup smarter when lots of attributes
|
||||
// PERF: [....], [....]: Compare safe/unsafe versions
|
||||
// PERF, Microsoft, Microsoft: Make LookupNamespace do something smarter when lots of names
|
||||
// PERF, Microsoft, Microsoft: Make Attribute lookup smarter when lots of attributes
|
||||
// PERF: Microsoft, Microsoft: Compare safe/unsafe versions
|
||||
|
||||
namespace System.Xml
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ namespace System.Xml
|
||||
{
|
||||
if (LookupPrefix(namespaceUri) != null)
|
||||
return;
|
||||
#pragma warning suppress 56506 // [....], namespaceUri is already checked
|
||||
#pragma warning suppress 56506 // Microsoft, namespaceUri is already checked
|
||||
prefix = namespaceUri.Length == 0 ? string.Empty : string.Concat("d", namespaceUri.Length.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
|
||||
}
|
||||
WriteAttributeString("xmlns", prefix, null, namespaceUri);
|
||||
@ -196,7 +196,7 @@ namespace System.Xml
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("localName"));
|
||||
if (namespaceUri == null)
|
||||
namespaceUri = XmlDictionaryString.Empty;
|
||||
#pragma warning suppress 56506 // [....], XmlDictionaryString.Empty is never null
|
||||
#pragma warning suppress 56506 // Microsoft, XmlDictionaryString.Empty is never null
|
||||
WriteQualifiedName(localName.Value, namespaceUri.Value);
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ namespace System.Xml
|
||||
{
|
||||
if (completionException == null)
|
||||
{
|
||||
// only release stream when no exception (mirrors [....] behaviour)
|
||||
// only release stream when no exception (mirrors sync behaviour)
|
||||
this.streamProvider.ReleaseStream(this.stream);
|
||||
this.stream = null;
|
||||
}
|
||||
@ -311,7 +311,7 @@ namespace System.Xml
|
||||
|
||||
void ContinueWork(bool completedSynchronously, Exception completionException = null)
|
||||
{
|
||||
// Individual Reads or writes may complete [....] or async. A callback however
|
||||
// Individual Reads or writes may complete sync or async. A callback however
|
||||
// will always all ContinueWork() with CompletedSynchronously=false this flag
|
||||
// is used to complete this AsyncResult.
|
||||
try
|
||||
@ -565,7 +565,7 @@ namespace System.Xml
|
||||
{
|
||||
if (completionException == null)
|
||||
{
|
||||
// only release stream when no exception (mirrors [....] behaviour)
|
||||
// only release stream when no exception (mirrors sync behaviour)
|
||||
this.streamProvider.ReleaseStream(this.stream);
|
||||
this.stream = null;
|
||||
}
|
||||
@ -582,7 +582,7 @@ namespace System.Xml
|
||||
{
|
||||
if (HandleReadBlock(result))
|
||||
{
|
||||
// Read completed ([....] or async, doesn't matter)
|
||||
// Read completed (sync or async, doesn't matter)
|
||||
if (this.bytesRead > 0)
|
||||
{
|
||||
// allow loop to continue at Write
|
||||
@ -604,7 +604,7 @@ namespace System.Xml
|
||||
{
|
||||
if (this.writeBlockHandler(result, this))
|
||||
{
|
||||
// Write completed ([....] or async, doesn't matter)
|
||||
// Write completed (sync or async, doesn't matter)
|
||||
AdjustBlockSize();
|
||||
operation = Operation.Read;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
69831c0d846ab89693ca98cffb0788052c2229ac
|
||||
1c5fd2c4cfdbe3342d1edbde3ae67caf041added
|
Reference in New Issue
Block a user