Skip to content

Commit 2a98d0a

Browse files
committed
Fixes, supresses a few warnings
1 parent f326ae7 commit 2a98d0a

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

LiteDB.Tests/Internals/Aes_Tests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ public void Encrypt_Decrypt_Stream()
4141

4242
// read encrypted data
4343
media.Position = 0;
44-
media.Read(output0, 0, 8192);
45-
media.Read(output1, 0, 8192);
46-
media.Read(output2, 0, 8192);
44+
media.ReadExactly(output0, 0, 8192);
45+
media.ReadExactly(output1, 0, 8192);
46+
media.ReadExactly(output2, 0, 8192);
4747

4848
output0.All(x => x == 100).Should().BeFalse();
4949
output1.All(x => x == 101).Should().BeFalse();
5050
output2.All(x => x == 102).Should().BeFalse();
5151

5252
// read decrypted data
5353
crypto.Position = 0 * 8192;
54-
crypto.Read(output0, 0, 8192);
54+
crypto.ReadExactly(output0, 0, 8192);
5555

5656
crypto.Position = 2 * 8192;
57-
crypto.Read(output2, 0, 8192);
57+
crypto.ReadExactly(output2, 0, 8192);
5858

5959
crypto.Position = 1 * 8192;
60-
crypto.Read(output1, 0, 8192);
60+
crypto.ReadExactly(output1, 0, 8192);
6161

6262
output0.All(x => x == 100).Should().BeTrue();
6363
output1.All(x => x == 101).Should().BeTrue();
@@ -137,7 +137,7 @@ public void AesStream_Invalid_Password()
137137
.GetValue(crypto) as CryptoStream;
138138

139139
memoryStream.Position = 32;
140-
cryptoReader.Read(checkBytes, 0, checkBytes.Length);
140+
cryptoReader.ReadExactly(checkBytes, 0, checkBytes.Length);
141141
Assert.All(checkBytes, b => Assert.Equal(1, b));
142142
}
143143
}

LiteDB.Tests/Internals/CacheAsync_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace LiteDB.Internals
1111
public class CacheAsync_Tests
1212
{
1313
[Fact]
14-
public void CacheAsync_Thread_ShareCounter()
14+
public async Task CacheAsync_Thread_ShareCounterAsync()
1515
{
1616
// Set() - Seta true - Se estiver bloqueado, vai liberar
1717
// Reset() - Seta false - Quando chegar no proximo Wait() vai aguardar
@@ -83,7 +83,7 @@ void serialize(ManualResetEventSlim toBlock, ManualResetEventSlim toFree)
8383
ta.Start();
8484
tb.Start();
8585

86-
Task.WaitAll(ta, tb);
86+
await Task.WhenAll(ta, tb);
8787
}
8888
}
8989
}

LiteDB.Tests/Issues/Issue2265_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void Test()
3434
using (var db = new LiteDatabase(":memory:"))
3535
{
3636
var c = db.GetCollection<Weights>("weights");
37-
Weights? w = c.FindOne(x => true);
37+
Weights w = c.FindOne(x => true);
3838
if (w == null)
3939
{
4040
w = new Weights();

LiteDB/Document/DataReader/BsonDataReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public bool Read()
108108
catch (Exception ex)
109109
{
110110
_state.Handle(ex);
111-
throw ex;
111+
throw;
112112
}
113113
}
114114
else

LiteDB/Engine/Disk/Streams/AesStream.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ public AesStream(string password, Stream stream)
9090
_aes.Padding = PaddingMode.None;
9191
_aes.Mode = CipherMode.ECB;
9292

93+
#pragma warning disable SYSLIB0041
9394
var pdb = new Rfc2898DeriveBytes(password, this.Salt);
95+
#pragma warning restore SYSLIB0041
9496

9597
using (pdb as IDisposable)
9698
{

LiteDB/Engine/FileReader/Legacy/AesEncryption.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public AesEncryption(string password, byte[] salt)
1818
_aes = Aes.Create();
1919
_aes.Padding = PaddingMode.Zeros;
2020

21+
#pragma warning disable SYSLIB0041
2122
var pdb = new Rfc2898DeriveBytes(password, salt);
23+
#pragma warning restore SYSLIB0041
2224

2325
using (pdb as IDisposable)
2426
{

LiteDB/Engine/Query/QueryExecutor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ IEnumerable<BsonDocument> RunQuery()
136136
catch (Exception ex)
137137
{
138138
_state.Handle(ex);
139-
throw ex;
139+
throw;
140140
}
141141

142142
while (read)
@@ -157,7 +157,7 @@ IEnumerable<BsonDocument> RunQuery()
157157
catch (Exception ex)
158158
{
159159
_state.Handle(ex);
160-
throw ex;
160+
throw;
161161
}
162162
}
163163
}

0 commit comments

Comments
 (0)