Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
pictos committed Jun 12, 2024
1 parent b90b106 commit 3b3ab91
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
15 changes: 7 additions & 8 deletions LiteDB/Engine/Disk/Serializer/BufferReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Buffers;
using System.Collections.Generic;
using System.IO;
using System.Text;
using static LiteDB.Constants;

namespace LiteDB.Engine
Expand All @@ -21,7 +20,7 @@ internal class BufferReader : IDisposable

private bool _isEOF = false;

static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;
private static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

/// <summary>
/// Current global cursor position
Expand Down Expand Up @@ -105,10 +104,10 @@ public int Read(byte[] buffer, int offset, int count)
// fill buffer
if (buffer != null)
{
Buffer.BlockCopy(_current.Array,
_current.Offset + _currentPosition,
buffer,
offset + bufferPosition,
Buffer.BlockCopy(_current.Array,
_current.Offset + _currentPosition,
buffer,
offset + bufferPosition,
bytesToCopy);
}

Expand Down Expand Up @@ -254,7 +253,7 @@ private T ReadNumber<T>(Func<byte[], int, T> convert, int size)
}
else
{
var buffer = bufferPool.Rent(size);
var buffer = bufferPool.Rent(size);

this.Read(buffer, 0, size);

Expand Down Expand Up @@ -396,7 +395,7 @@ public BsonValue ReadIndexKey()
case BsonType.Int64: return this.ReadInt64();
case BsonType.Double: return this.ReadDouble();
case BsonType.Decimal: return this.ReadDecimal();

// Use +1 byte only for length
case BsonType.String: return this.ReadString(this.ReadByte());

Expand Down
2 changes: 1 addition & 1 deletion LiteDB/Engine/Disk/Serializer/BufferWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class BufferWriter : IDisposable

private bool _isEOF = false;

static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;
private static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

/// <summary>
/// Current global cursor position
Expand Down
2 changes: 1 addition & 1 deletion LiteDB/Engine/Disk/Streams/AesStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class AesStream : Stream

private static readonly byte[] _emptyContent = new byte[PAGE_SIZE - 1 - 16]; // 1 for aes indicator + 16 for salt

static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;
private static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

public byte[] Salt { get; }

Expand Down
2 changes: 1 addition & 1 deletion LiteDB/Engine/Engine/Upgrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace LiteDB.Engine
public partial class LiteEngine
{

static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;
private static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

/// <summary>
/// If Upgrade=true, run this before open Disk service
Expand Down
4 changes: 2 additions & 2 deletions LiteDB/Engine/Sort/SortContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ internal class SortContainer : IDisposable
private int _readPosition = 0;

private BufferReader _reader = null;
static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

private static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

/// <summary>
/// Returns if current container has no more items to read
Expand Down
4 changes: 2 additions & 2 deletions LiteDB/Engine/Sort/SortService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ internal class SortService : IDisposable
private readonly EnginePragmas _pragmas;
private readonly BufferSlice _buffer;
private readonly Lazy<Stream> _reader;
static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

private static readonly ArrayPool<byte> bufferPool = ArrayPool<byte>.Shared;

/// <summary>
/// Get how many documents was inserted by Insert method
Expand Down

0 comments on commit 3b3ab91

Please sign in to comment.