mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-20 14:11:02 +10:00
Project Maintenance
This commit is contained in:
+21
-9
@@ -4,13 +4,13 @@ namespace SevenZip.Buffer
|
||||
{
|
||||
public class InBuffer
|
||||
{
|
||||
byte[] m_Buffer;
|
||||
uint m_Pos;
|
||||
uint m_Limit;
|
||||
uint m_BufferSize;
|
||||
System.IO.Stream m_Stream;
|
||||
bool m_StreamWasExhausted;
|
||||
ulong m_ProcessedSize;
|
||||
private readonly byte[] m_Buffer;
|
||||
private uint m_Pos;
|
||||
private uint m_Limit;
|
||||
private readonly uint m_BufferSize;
|
||||
private System.IO.Stream m_Stream;
|
||||
private bool m_StreamWasExhausted;
|
||||
private ulong m_ProcessedSize;
|
||||
|
||||
public InBuffer(uint bufferSize)
|
||||
{
|
||||
@@ -30,16 +30,18 @@ namespace SevenZip.Buffer
|
||||
public bool ReadBlock()
|
||||
{
|
||||
if (m_StreamWasExhausted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ProcessedSize += m_Pos;
|
||||
int aNumProcessedBytes = m_Stream.Read(m_Buffer, 0, (int)m_BufferSize);
|
||||
m_Pos = 0;
|
||||
m_Limit = (uint)aNumProcessedBytes;
|
||||
m_StreamWasExhausted = (aNumProcessedBytes == 0);
|
||||
return (!m_StreamWasExhausted);
|
||||
return !m_StreamWasExhausted;
|
||||
}
|
||||
|
||||
|
||||
public void ReleaseStream()
|
||||
{
|
||||
// m_Stream.Close();
|
||||
@@ -49,8 +51,13 @@ namespace SevenZip.Buffer
|
||||
public bool ReadByte(byte b) // check it
|
||||
{
|
||||
if (m_Pos >= m_Limit)
|
||||
{
|
||||
if (!ReadBlock())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
b = m_Buffer[m_Pos++];
|
||||
return true;
|
||||
}
|
||||
@@ -59,8 +66,13 @@ namespace SevenZip.Buffer
|
||||
{
|
||||
// return (byte)m_Stream.ReadByte();
|
||||
if (m_Pos >= m_Limit)
|
||||
{
|
||||
if (!ReadBlock())
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
return m_Buffer[m_Pos++];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user