Skip to content

Commit

Permalink
Manually backporting #74599 to 7.0 for RC2. (#75366)
Browse files Browse the repository at this point in the history
* Manually backporting #74599 to 7.0 for RC2.

* Fix a couple mis-copied lines of code and a couple nits.
  • Loading branch information
StephenMolloy committed Sep 12, 2022
1 parent fa4ba1b commit 3fbdf4c
Show file tree
Hide file tree
Showing 5 changed files with 397 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1350,14 +1350,14 @@ private unsafe int ReadArray(float[] array, int offset, int count)

public override int ReadArray(string localName, string namespaceUri, float[] array, int offset, int count)
{
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement))
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement) && BitConverter.IsLittleEndian)
return ReadArray(array, offset, count);
return base.ReadArray(localName, namespaceUri, array, offset, count);
}

public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, float[] array, int offset, int count)
{
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement))
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement) && BitConverter.IsLittleEndian)
return ReadArray(array, offset, count);
return base.ReadArray(localName, namespaceUri, array, offset, count);
}
Expand All @@ -1373,14 +1373,14 @@ private unsafe int ReadArray(double[] array, int offset, int count)

public override int ReadArray(string localName, string namespaceUri, double[] array, int offset, int count)
{
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement))
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement) && BitConverter.IsLittleEndian)
return ReadArray(array, offset, count);
return base.ReadArray(localName, namespaceUri, array, offset, count);
}

public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, double[] array, int offset, int count)
{
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement))
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement) && BitConverter.IsLittleEndian)
return ReadArray(array, offset, count);
return base.ReadArray(localName, namespaceUri, array, offset, count);
}
Expand All @@ -1396,14 +1396,14 @@ private unsafe int ReadArray(decimal[] array, int offset, int count)

public override int ReadArray(string localName, string namespaceUri, decimal[] array, int offset, int count)
{
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement))
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement) && BitConverter.IsLittleEndian)
return ReadArray(array, offset, count);
return base.ReadArray(localName, namespaceUri, array, offset, count);
}

public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, decimal[] array, int offset, int count)
{
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement))
if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement) && BitConverter.IsLittleEndian)
return ReadArray(array, offset, count);
return base.ReadArray(localName, namespaceUri, array, offset, count);
}
Expand Down
Loading

0 comments on commit 3fbdf4c

Please sign in to comment.