Skip to content

Commit c3464fd

Browse files
committed
follow the code analyzer rules
1 parent 39454cc commit c3464fd

File tree

1 file changed

+9
-7
lines changed
  • src/Smdn.Fundamental.PrintableEncoding.Base64/Smdn.Formats

1 file changed

+9
-7
lines changed

src/Smdn.Fundamental.PrintableEncoding.Base64/Smdn.Formats/Base64.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
using System.Security.Cryptography;
66
using System.Text;
77

8-
using Smdn.IO.Streams;
8+
#if !(NET472_OR_GREATER || NETSTANDARD2_0_OR_GREATER || NET5_0_OR_GREATER)
9+
using Smdn.IO.Streams; // NonClosingStream
10+
#endif
911
using Smdn.Security.Cryptography;
1012

1113
namespace Smdn.Formats {
@@ -69,9 +71,9 @@ public static byte[] Encode(byte[] bytes)
6971

7072
public static byte[] Encode(byte[] bytes, int offset, int count)
7173
{
72-
using (var transform = CreateToBase64Transform()) {
73-
return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count);
74-
}
74+
using var transform = CreateToBase64Transform();
75+
76+
return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count);
7577
}
7678

7779
public static string GetDecodedString(string str)
@@ -115,9 +117,9 @@ public static byte[] Decode(byte[] bytes)
115117

116118
public static byte[] Decode(byte[] bytes, int offset, int count)
117119
{
118-
using (var transform = CreateFromBase64Transform(ignoreWhiteSpaces: true)) {
119-
return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count);
120-
}
120+
using var transform = CreateFromBase64Transform(ignoreWhiteSpaces: true);
121+
122+
return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count);
121123
}
122124

123125
public static Stream CreateEncodingStream(Stream stream, bool leaveStreamOpen = false)

0 commit comments

Comments
 (0)