Skip to content

Commit a0b3f78

Browse files
committed
Change ZipInputStream to use entry.CompressionMethod instead of duplicating the property locally
1 parent 84a7a45 commit a0b3f78

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/ICSharpCode.SharpZipLib/Zip/ZipInputStream.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public class ZipInputStream : InflaterInputStream
7373
private ZipEntry entry;
7474

7575
private long size;
76-
private CompressionMethod method;
7776
private int flags;
7877
private string password;
7978

@@ -191,7 +190,7 @@ public ZipEntry GetNextEntry()
191190
var versionRequiredToExtract = (short)inputBuffer.ReadLeShort();
192191

193192
flags = inputBuffer.ReadLeShort();
194-
method = (CompressionMethod)inputBuffer.ReadLeShort();
193+
var method = (CompressionMethod)inputBuffer.ReadLeShort();
195194
var dostime = (uint)inputBuffer.ReadLeInt();
196195
int crc2 = inputBuffer.ReadLeInt();
197196
csize = inputBuffer.ReadLeInt();
@@ -332,7 +331,7 @@ private void CompleteCloseEntry(bool testCrc)
332331

333332
crc.Reset();
334333

335-
if (method == CompressionMethod.Deflated)
334+
if (entry.CompressionMethod == CompressionMethod.Deflated)
336335
{
337336
inf.Reset();
338337
}
@@ -360,7 +359,7 @@ public void CloseEntry()
360359
return;
361360
}
362361

363-
if (method == CompressionMethod.Deflated)
362+
if (entry.CompressionMethod == CompressionMethod.Deflated)
364363
{
365364
if ((flags & 8) != 0)
366365
{
@@ -530,7 +529,7 @@ private int InitialRead(byte[] destination, int offset, int count)
530529

531530
if ((csize > 0) || ((flags & (int)GeneralBitFlags.Descriptor) != 0))
532531
{
533-
if ((method == CompressionMethod.Deflated) && (inputBuffer.Available > 0))
532+
if ((entry.CompressionMethod == CompressionMethod.Deflated) && (inputBuffer.Available > 0))
534533
{
535534
inputBuffer.SetInflaterInput(inf);
536535
}
@@ -612,7 +611,7 @@ private int BodyRead(byte[] buffer, int offset, int count)
612611

613612
bool finished = false;
614613

615-
switch (method)
614+
switch (entry.CompressionMethod)
616615
{
617616
case CompressionMethod.Deflated:
618617
count = base.Read(buffer, offset, count);

0 commit comments

Comments
 (0)