From cb9d2cb309cf6c3a0d0484d368ca66fd369891ae Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Tue, 30 Jan 2024 12:28:41 -0800 Subject: [PATCH] Remove unneeded casts --- MimeKit/IO/Filters/CharsetFilter.cs | 4 ++-- MimeKit/Tnef/TnefPropertyReader.cs | 4 ++-- MimeKit/Utils/CharsetUtils.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MimeKit/IO/Filters/CharsetFilter.cs b/MimeKit/IO/Filters/CharsetFilter.cs index bc13909f62..a9ca036fa5 100644 --- a/MimeKit/IO/Filters/CharsetFilter.cs +++ b/MimeKit/IO/Filters/CharsetFilter.cs @@ -125,8 +125,8 @@ public CharsetFilter (Encoding sourceEncoding, Encoding targetEncoding) SourceEncoding = sourceEncoding; TargetEncoding = targetEncoding; - decoder = (Decoder) SourceEncoding.GetDecoder (); - encoder = (Encoder) TargetEncoding.GetEncoder (); + decoder = SourceEncoding.GetDecoder (); + encoder = TargetEncoding.GetEncoder (); } /// diff --git a/MimeKit/Tnef/TnefPropertyReader.cs b/MimeKit/Tnef/TnefPropertyReader.cs index 0c72bfb63f..53cc056f13 100644 --- a/MimeKit/Tnef/TnefPropertyReader.cs +++ b/MimeKit/Tnef/TnefPropertyReader.cs @@ -747,13 +747,13 @@ public int ReadTextValue (char[] buffer, int offset, int count) switch (propertyTag.ValueTnefType) { case TnefPropertyType.Unicode: ReadInt32 (); - decoder = (Decoder) Encoding.Unicode.GetDecoder (); + decoder = Encoding.Unicode.GetDecoder (); break; case TnefPropertyType.String8: case TnefPropertyType.Binary: case TnefPropertyType.Object: ReadInt32 (); - decoder = (Decoder) GetMessageEncoding ().GetDecoder (); + decoder = GetMessageEncoding ().GetDecoder (); break; } } diff --git a/MimeKit/Utils/CharsetUtils.cs b/MimeKit/Utils/CharsetUtils.cs index 5058062c46..54f4de97ec 100644 --- a/MimeKit/Utils/CharsetUtils.cs +++ b/MimeKit/Utils/CharsetUtils.cs @@ -489,7 +489,7 @@ internal static char[] ConvertToUnicode (ParserOptions options, byte[] input, in for (int i = 0; i < codepages.Length; i++) { encoding = Encoding.GetEncoding (codepages[i], new EncoderReplacementFallback ("?"), invalid); - decoder = (Decoder) encoding.GetDecoder (); + decoder = encoding.GetDecoder (); count = decoder.GetCharCount (input, startIndex, length, true); if (invalid.InvalidByteCount < min) { @@ -505,7 +505,7 @@ internal static char[] ConvertToUnicode (ParserOptions options, byte[] input, in } encoding = GetEncoding (best, "?"); - decoder = (Decoder) encoding.GetDecoder (); + decoder = encoding.GetDecoder (); var output = new char[bestCharCount];