From d875ec305e4d556366305a25ec691757a58f4ccd Mon Sep 17 00:00:00 2001 From: James Ko Date: Mon, 4 Jul 2016 15:41:17 -0400 Subject: [PATCH] [ASCIIEncoding] Remove unncessary comments Commit migrated from https://github.com/dotnet/coreclr/commit/77fa0fb69c9113909fbbe3f896779eab26d9e250 --- .../src/mscorlib/src/System/Text/ASCIIEncoding.cs | 78 +++++----------------- 1 file changed, 16 insertions(+), 62 deletions(-) diff --git a/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs index ba3f583..1b499a6 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs @@ -36,24 +36,26 @@ namespace System.Text this.decoderFallback = DecoderFallback.ReplacementFallback; } - // // WARNING: GetByteCount(string chars), GetBytes(string chars,...), and GetString(byte[] byteIndex...) // WARNING: have different variable names than EncodingNLS.cs, so this can't just be cut & pasted, // WARNING: or it'll break VB's way of calling these. - // - // The following methods are copied from EncodingNLS.cs. - // Unfortunately EncodingNLS.cs is internal and we're public, so we have to reimpliment them here. - // These should be kept in sync for the following classes: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - // + // NOTE: Many methods in this class forward to EncodingForwarder for + // validating arguments/wrapping the unsafe methods in this class + // which do the actual work. That class contains + // shared logic for doing this which is used by + // ASCIIEncoding, EncodingNLS, UnicodeEncoding, UTF32Encoding, + // UTF7Encoding, and UTF8Encoding. + // The reason the code is separated out into a static class, rather + // than a base class which overrides all of these methods for us + // (which is what EncodingNLS is for internal Encodings) is because + // that's really more of an implementation detail so it's internal. + // At the same time, C# doesn't allow a public class subclassing an + // internal/private one, so we end up having to re-override these + // methods in all of the public Encodings + EncodingNLS. + // Returns the number of bytes required to encode a range of characters in // a character array. - // - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - // parent method is safe [System.Security.SecuritySafeCritical] // auto-generated public override int GetByteCount(char[] chars, int index, int count) @@ -61,11 +63,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, chars, index, count); } - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - // parent method is safe - [System.Security.SecuritySafeCritical] // auto-generated public override int GetByteCount(String chars) { @@ -74,10 +71,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, chars); } - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] @@ -86,11 +79,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, chars, count); } - // Parent method is safe. - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - [System.Security.SecuritySafeCritical] // auto-generated public override int GetBytes(String chars, int charIndex, int charCount, byte[] bytes, int byteIndex) @@ -107,11 +95,6 @@ namespace System.Text // Alternatively, the GetMaxByteCount method can be used to // determine the maximum number of bytes that will be produced for a given // number of characters, regardless of the actual character values. - // - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - // parent method is safe [System.Security.SecuritySafeCritical] // auto-generated public override int GetBytes(char[] chars, int charIndex, int charCount, @@ -120,10 +103,6 @@ namespace System.Text return EncodingForwarder.GetBytes(this, chars, charIndex, charCount, bytes, byteIndex); } - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] @@ -134,11 +113,6 @@ namespace System.Text // Returns the number of characters produced by decoding a range of bytes // in a byte array. - // - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - // parent method is safe [System.Security.SecuritySafeCritical] // auto-generated public override int GetCharCount(byte[] bytes, int index, int count) @@ -146,10 +120,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, index, count); } - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] @@ -158,11 +128,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, count); } - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - // parent method is safe - [System.Security.SecuritySafeCritical] // auto-generated public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) @@ -170,10 +135,6 @@ namespace System.Text return EncodingForwarder.GetChars(this, bytes, byteIndex, byteCount, chars, charIndex); } - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] @@ -184,11 +145,6 @@ namespace System.Text // Returns a string containing the decoded representation of a range of // bytes in a byte array. - // - // All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS) - // So if you fix this, fix the others. Currently those include: - // EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding - // parent method is safe [System.Security.SecuritySafeCritical] // auto-generated public override String GetString(byte[] bytes, int byteIndex, int byteCount) @@ -197,10 +153,8 @@ namespace System.Text // throw an ArgumentOutOfRange for "index" or "count" instead of those names. return EncodingForwarder.GetString(this, bytes, byteIndex, byteCount); } - - // - // End of standard methods copied from EncodingNLS.cs - // + + // End of overriden methods which use EncodingForwarder // GetByteCount // Note: We start by assuming that the output will be the same as count. Having -- 2.7.4