Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13127,11 +13127,10 @@ internal TdsOperationStatus TryReadPlpUnicodeCharsWithContinue(TdsParserStateObj

if (canContinue)
{
if (isContinuing || isStarting)
{
temp = stateObj.TryTakeSnapshotStorage() as char[];
Debug.Assert(temp == null || length == int.MaxValue || temp.Length == length, "stored buffer length must be null or must have been created with the correct length");
}
temp = stateObj.TryTakeSnapshotStorage() as char[];
Debug.Assert(temp != null || !isContinuing, "if continuing stored buffer must be present to contain previous data to continue from");
Debug.Assert(temp == null || length == int.MaxValue || temp.Length == length, "stored buffer length must be null or must have been created with the correct length");

if (temp != null)
{
startOffset = stateObj.GetSnapshotTotalSize();
Expand All @@ -13147,7 +13146,7 @@ internal TdsOperationStatus TryReadPlpUnicodeCharsWithContinue(TdsParserStateObj
supportRentedBuff: !canContinue, // do not use the arraypool if we are going to keep the buffer in the snapshot
rentedBuff: ref buffIsRented,
startOffset,
isStarting || isContinuing
canContinue
);

if (result == TdsOperationStatus.Done)
Expand All @@ -13174,7 +13173,7 @@ internal TdsOperationStatus TryReadPlpUnicodeCharsWithContinue(TdsParserStateObj
}
else if (result == TdsOperationStatus.NeedMoreData)
{
if (isStarting || isContinuing)
if (canContinue)
{
stateObj.SetSnapshotStorage(temp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13317,11 +13317,10 @@ internal TdsOperationStatus TryReadPlpUnicodeCharsWithContinue(TdsParserStateObj

if (canContinue)
{
if (isContinuing || isStarting)
{
temp = stateObj.TryTakeSnapshotStorage() as char[];
Debug.Assert(temp == null || length == int.MaxValue || temp.Length == length, "stored buffer length must be null or must have been created with the correct length");
}
temp = stateObj.TryTakeSnapshotStorage() as char[];
Debug.Assert(temp != null || !isContinuing, "if continuing stored buffer must be present to contain previous data to continue from");
Debug.Assert(temp == null || length == int.MaxValue || temp.Length == length, "stored buffer length must be null or must have been created with the correct length");

if (temp != null)
{
startOffset = stateObj.GetSnapshotTotalSize();
Expand All @@ -13336,8 +13335,8 @@ internal TdsOperationStatus TryReadPlpUnicodeCharsWithContinue(TdsParserStateObj
out length,
supportRentedBuff: !canContinue, // do not use the arraypool if we are going to keep the buffer in the snapshot
rentedBuff: ref buffIsRented,
startOffset,
isStarting || isContinuing
startOffset,
canContinue
);

if (result == TdsOperationStatus.Done)
Expand All @@ -13364,7 +13363,7 @@ internal TdsOperationStatus TryReadPlpUnicodeCharsWithContinue(TdsParserStateObj
}
else if (result == TdsOperationStatus.NeedMoreData)
{
if (isStarting || isContinuing)
if (canContinue)
{
stateObj.SetSnapshotStorage(temp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1529,11 +1529,10 @@ public TdsOperationStatus TryReadByteArrayWithContinue(int length, out byte[] by
(bool canContinue, bool isStarting, bool isContinuing) = GetSnapshotStatuses();
if (canContinue)
{
if (isContinuing || isStarting)
{
temp = TryTakeSnapshotStorage() as byte[];
Debug.Assert(bytes == null || bytes.Length == length, "stored buffer length must be null or must have been created with the correct length");
}
temp = TryTakeSnapshotStorage() as byte[];
Debug.Assert(temp != null || !isContinuing, "if continuing stored buffer must be present to contain previous data to continue from");
Debug.Assert(bytes == null || bytes.Length == length, "stored buffer length must be null or must have been created with the correct length");

if (temp != null)
{
offset = GetSnapshotTotalSize();
Expand All @@ -1554,7 +1553,7 @@ public TdsOperationStatus TryReadByteArrayWithContinue(int length, out byte[] by
}
else if (result == TdsOperationStatus.NeedMoreData)
{
if (isStarting || isContinuing)
if (canContinue)
{
SetSnapshotStorage(temp);
}
Expand Down Expand Up @@ -1983,11 +1982,10 @@ internal TdsOperationStatus TryReadStringWithEncoding(int length, System.Text.En
int startOffset = 0;
if (canContinue)
{
if (isContinuing || isStarting)
{
buf = TryTakeSnapshotStorage() as byte[];
Debug.Assert(buf == null || buf.Length == length, "stored buffer length must be null or must have been created with the correct length");
}
buf = TryTakeSnapshotStorage() as byte[];
Debug.Assert(buf != null || !isContinuing, "if continuing stored buffer must be present to contain previous data to continue from");
Debug.Assert(buf == null || buf.Length == length, "stored buffer length must be null or must have been created with the correct length");

if (buf != null)
{
startOffset = GetSnapshotTotalSize();
Expand All @@ -2005,7 +2003,7 @@ internal TdsOperationStatus TryReadStringWithEncoding(int length, System.Text.En
{
if (result == TdsOperationStatus.NeedMoreData)
{
if (isStarting || isContinuing)
if (canContinue)
{
SetSnapshotStorage(buf);
}
Expand Down

Large diffs are not rendered by default.