Skip to content

Commit

Permalink
Remove unneeded casts
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcarbon committed Jan 30, 2024
1 parent cac0e2c commit cb9d2cb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions MimeKit/IO/Filters/CharsetFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions MimeKit/Tnef/TnefPropertyReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions MimeKit/Utils/CharsetUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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];

Expand Down

0 comments on commit cb9d2cb

Please sign in to comment.