summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Text/EncoderBestFitFallback.cs')
-rw-r--r--src/mscorlib/src/System/Text/EncoderBestFitFallback.cs39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs b/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs
index 9be095bbd8..eb3165526b 100644
--- a/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs
+++ b/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs
@@ -5,21 +5,22 @@
//
// This is used internally to create best fit behavior as per the original windows best fit behavior.
//
+
+using System;
+using System.Globalization;
+using System.Text;
+using System.Threading;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+
namespace System.Text
{
- using System;
- using System.Globalization;
- using System.Text;
- using System.Threading;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
-
[Serializable]
- internal class InternalEncoderBestFitFallback : EncoderFallback
+ internal sealed class InternalEncoderBestFitFallback : EncoderFallback
{
// Our variables
internal Encoding encoding = null;
- internal char[] arrayBestFit = null;
+ internal char[] arrayBestFit = null;
internal InternalEncoderBestFitFallback(Encoding encoding)
{
@@ -61,10 +62,10 @@ namespace System.Text
internal sealed class InternalEncoderBestFitFallbackBuffer : EncoderFallbackBuffer
{
// Our variables
- private char cBestFit = '\0';
- private InternalEncoderBestFitFallback oFallback;
- private int iCount = -1;
- private int iSize;
+ private char cBestFit = '\0';
+ private InternalEncoderBestFitFallback oFallback;
+ private int iCount = -1;
+ private int iSize;
// Private object for locking instead of locking on a public type for SQL reliability work.
private static Object s_InternalSyncObject;
@@ -84,12 +85,12 @@ namespace System.Text
// Constructor
public InternalEncoderBestFitFallbackBuffer(InternalEncoderBestFitFallback fallback)
{
- this.oFallback = fallback;
+ oFallback = fallback;
if (oFallback.arrayBestFit == null)
{
// Lock so we don't confuse ourselves.
- lock(InternalSyncObject)
+ lock (InternalSyncObject)
{
// Double check before we do it again.
if (oFallback.arrayBestFit == null)
@@ -119,13 +120,11 @@ namespace System.Text
// Double check input surrogate pair
if (!Char.IsHighSurrogate(charUnknownHigh))
throw new ArgumentOutOfRangeException(nameof(charUnknownHigh),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xD800, 0xDBFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xD800, 0xDBFF));
if (!Char.IsLowSurrogate(charUnknownLow))
throw new ArgumentOutOfRangeException(nameof(charUnknownLow),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xDC00, 0xDFFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xDC00, 0xDFFF));
Contract.EndContractBlock();
// If we had a buffer already we're being recursive, throw, it's probably at the suspect
@@ -146,7 +145,7 @@ namespace System.Text
// We want it to get < 0 because == 0 means that the current/last character is a fallback
// and we need to detect recursion. We could have a flag but we already have this counter.
iCount--;
-
+
// Do we have anything left? 0 is now last fallback char, negative is nothing left
if (iCount < 0)
return '\0';