Skip to content

Commit 43a9ebe

Browse files
committed
Suppress warnings CA2022 and S2674 for BOM reading in EncodingTools due to expected dynamic length read operation
1 parent 339304f commit 43a9ebe

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

MagicFileEncoding/Tools/EncodingTools.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,11 @@ private static bool IsCharsetNameRange(int taster, byte[] bytes, int n)
271271

272272
var bom = new byte[4];
273273
fileStream.Position = 0;
274-
275-
// ReSharper disable once MustUseReturnValue
274+
275+
// read the BOM with dynamical length
276+
#pragma warning disable CA2022, S2674
276277
fileStream.Read(bom, 0, 4);
278+
#pragma warning restore CA2022
277279

278280
return GetEncodingByBom(bom, fallbackEncoding, out _, false);
279281
}

0 commit comments

Comments
 (0)