// GetCharCount method can be used to determine the exact number of
// characters that will be produced for a given range of bytes.
// Alternatively, the GetMaxCharCount method can be used to
- // determine the maximum number of characterss that will be produced for a
+ // determine the maximum number of characters that will be produced for a
// given number of bytes, regardless of the actual byte values.
//
internal void ThrowBytesOverflow()
{
// Special message to include fallback type in case fallback's GetMaxCharCount is broken
- // This happens if user has implimented an encoder fallback with a broken GetMaxCharCount
+ // This happens if user has implemented an encoder fallback with a broken GetMaxCharCount
throw new ArgumentException(
SR.Format(SR.Argument_EncodingConversionOverflowBytes, EncodingName, EncoderFallback.GetType()), "bytes");
}
internal void ThrowBytesOverflow(EncoderNLS encoder, bool nothingEncoded)
{
- if (encoder == null || encoder.m_throwOnOverflow || nothingEncoded)
+ if (encoder == null || encoder._throwOnOverflow || nothingEncoded)
{
if (encoder != null && encoder.InternalHasFallbackBuffer)
encoder.FallbackBuffer.InternalReset();
// Special message to include fallback type in case fallback's GetMaxCharCount is broken
- // This happens if user has implimented an encoder fallback with a broken GetMaxCharCount
+ // This happens if user has implemented an encoder fallback with a broken GetMaxCharCount
ThrowBytesOverflow();
}
internal void ThrowCharsOverflow()
{
// Special message to include fallback type in case fallback's GetMaxCharCount is broken
- // This happens if user has implimented a decoder fallback with a broken GetMaxCharCount
+ // This happens if user has implemented a decoder fallback with a broken GetMaxCharCount
throw new ArgumentException(
SR.Format(SR.Argument_EncodingConversionOverflowChars, EncodingName, DecoderFallback.GetType()), "chars");
}
internal void ThrowCharsOverflow(DecoderNLS decoder, bool nothingDecoded)
{
- if (decoder == null || decoder.m_throwOnOverflow || nothingDecoded)
+ if (decoder == null || decoder._throwOnOverflow || nothingDecoded)
{
if (decoder != null && decoder.InternalHasFallbackBuffer)
decoder.FallbackBuffer.InternalReset();
// Special message to include fallback type in case fallback's GetMaxCharCount is broken
- // This happens if user has implimented a decoder fallback with a broken GetMaxCharCount
+ // This happens if user has implemented a decoder fallback with a broken GetMaxCharCount
ThrowCharsOverflow();
}
decoder.ClearMustFlush();
}
- internal sealed class DefaultEncoder : Encoder, IObjectReference, ISerializable
+ internal sealed class DefaultEncoder : Encoder, IObjectReference
{
- private Encoding m_encoding;
+ private Encoding _encoding;
public DefaultEncoder(Encoding encoding)
{
- m_encoding = encoding;
+ _encoding = encoding;
}
public Object GetRealObject(StreamingContext context)
throw new PlatformNotSupportedException();
}
- // ISerializable implementation, get data for this object
- void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
-
// Returns the number of bytes the next call to GetBytes will
// produce if presented with the given range of characters and the given
// value of the flush parameter. The returned value takes into
public override int GetByteCount(char[] chars, int index, int count, bool flush)
{
- return m_encoding.GetByteCount(chars, index, count);
+ return _encoding.GetByteCount(chars, index, count);
}
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public unsafe override int GetByteCount(char* chars, int count, bool flush)
{
- return m_encoding.GetByteCount(chars, count);
+ return _encoding.GetByteCount(chars, count);
}
// Encodes a range of characters in a character array into a range of bytes
public override int GetBytes(char[] chars, int charIndex, int charCount,
byte[] bytes, int byteIndex, bool flush)
{
- return m_encoding.GetBytes(chars, charIndex, charCount, bytes, byteIndex);
+ return _encoding.GetBytes(chars, charIndex, charCount, bytes, byteIndex);
}
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public unsafe override int GetBytes(char* chars, int charCount,
byte* bytes, int byteCount, bool flush)
{
- return m_encoding.GetBytes(chars, charCount, bytes, byteCount);
+ return _encoding.GetBytes(chars, charCount, bytes, byteCount);
}
}
- internal sealed class DefaultDecoder : Decoder, IObjectReference, ISerializable
+ internal sealed class DefaultDecoder : Decoder, IObjectReference
{
- private Encoding m_encoding;
+ private Encoding _encoding;
public DefaultDecoder(Encoding encoding)
{
- m_encoding = encoding;
+ _encoding = encoding;
}
public Object GetRealObject(StreamingContext context)
throw new PlatformNotSupportedException();
}
- // ISerializable implementation
- void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
-
// Returns the number of characters the next call to GetChars will
// produce if presented with the given range of bytes. The returned value
// takes into account the state in which the decoder was left following the
public override int GetCharCount(byte[] bytes, int index, int count, bool flush)
{
- return m_encoding.GetCharCount(bytes, index, count);
+ return _encoding.GetCharCount(bytes, index, count);
}
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public unsafe override int GetCharCount(byte* bytes, int count, bool flush)
{
// By default just call the encoding version, no flush by default
- return m_encoding.GetCharCount(bytes, count);
+ return _encoding.GetCharCount(bytes, count);
}
// Decodes a range of bytes in a byte array into a range of characters
public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
char[] chars, int charIndex, bool flush)
{
- return m_encoding.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
+ return _encoding.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
}
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
char* chars, int charCount, bool flush)
{
// By default just call the encoding's version
- return m_encoding.GetChars(bytes, byteCount, chars, charCount);
+ return _encoding.GetChars(bytes, byteCount, chars, charCount);
}
}
{
this.fallbackBuffer = _encoder.FallbackBuffer;
// If we're not converting we must not have data in our fallback buffer
- if (_encoder.m_throwOnOverflow && _encoder.InternalHasFallbackBuffer &&
+ if (_encoder._throwOnOverflow && _encoder.InternalHasFallbackBuffer &&
this.fallbackBuffer.Remaining > 0)
throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty,
_encoder.Encoding.EncodingName, _encoder.Fallback.GetType()));