1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 15:26:00 +02:00

Merge pull request #1839 from disarray2077/patch-4

Fix ReadBuffer
This commit is contained in:
Brian Fiete 2023-05-05 06:24:26 -07:00 committed by GitHub
commit 1bff9e97fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -441,7 +441,7 @@ namespace System.IO
bytePos = byteLen = 0;*/
}
return mCharLen;
return mCharLen - mCharPos;
}
mByteLen += len;
@ -461,7 +461,7 @@ namespace System.IO
//Contract.Assert(byteLen >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (mByteLen == 0) // We're at EOF
return mCharLen;
return mCharLen - mCharPos;
}
// _isBlocked == whether we read fewer bytes than we asked for.
@ -501,16 +501,16 @@ namespace System.IO
}
}
if ((mPendingNewlineCheck) && (mCharPos < mCharLen))
if (mPendingNewlineCheck)
{
if (mCharBuffer[mCharPos] == '\n') mCharPos++;
if (mCharPos == 0 && mCharBuffer[mCharPos] == '\n') mCharPos++;
mPendingNewlineCheck = false;
}
}
while (mCharLen == mCharPos);
//Console.WriteLine("ReadBuffer called. chars: "+char8Len);
return mCharLen;
return mCharLen - mCharPos;
}
int GetChars(uint8[] byteBuffer, int byteOffset, int byteLength, char8[] char8Buffer, int char8Offset)