Compare commits

...

7 Commits

Author SHA1 Message Date
Adam Hathcock
bec2662d23 Update version 2015-12-28 18:40:35 +00:00
Adam Hathcock
dd35052de9 Merge pull request #105 from benshoof/fix-tests-release-build
Fix Release build of Tests
2015-12-17 08:54:31 +00:00
Adam Hathcock
2a630e04b2 Merge pull request #107 from benshoof/fix-nonzip-perf-regression
Fixed serious performance regression (revert 0f12a073af)
2015-12-15 16:33:06 +00:00
benshoof
231b78e096 Revert 0f12a073af
Revert commit that caused all non-zip files to be read entirely upon
opening.
IsZipArchive() would read and process the entire file looking for a zip
header.
2015-12-15 07:28:50 -09:00
Adam Hathcock
ce6e1d26f4 Merge pull request #104 from benshoof/fix-vs2013-build
Fix VS2013 compiler warnings (errors)
2015-12-15 09:10:49 +00:00
benshoof
69a25cd142 Fix Release build of Tests
Fixes release builds of SharpCompress.Test and
SharpCompress.Test.Portable. The UNSIGNED symbol was missing from the
Release configurations of SharpCompress.Unsigned and
SharpCompress.PortableTest
2015-12-14 15:32:49 -09:00
benshoof
cc2ad7d8d5 Fix VS2013 compiler warnings (errors)
Fixes broken build in VS2013 introduced by
18bd810228. That commit attempted to fix a
compiler warning from VS2015, but this turns out to be a compiler bug:
https://github.com/dotnet/roslyn/issues/4027 . That commit added code
which VS2013 correctly treats as a compiler warning, breaking the VS2013
build.
I have reverted this unnecessary change to the deflate code, fixing the
VS2013 build, and disabled warning CS0675 on send_bits() which will
satisfy VS2015.
2015-12-14 15:24:33 -09:00
8 changed files with 24 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>sharpcompress</id>
<version>0.11.2</version>
<version>0.11.3</version>
<title>SharpCompress - Pure C# Decompression/Compression</title>
<authors>Adam Hathcock</authors>
<owners>Adam Hathcock</owners>

View File

@@ -116,7 +116,7 @@ namespace SharpCompress.Archive.Zip
try
{
ZipHeader header =
headerFactory.ReadStreamHeader(stream).FirstOrDefault(x => x != null && x.ZipHeaderType != ZipHeaderType.Split);
headerFactory.ReadStreamHeader(stream).FirstOrDefault(x => x.ZipHeaderType != ZipHeaderType.Split);
if (header == null)
{
return false;

View File

@@ -45,17 +45,18 @@ namespace SharpCompress.Common.Zip
lastEntryHeader = null;
uint headerBytes = reader.ReadUInt32();
header = ReadHeader(headerBytes, reader);
if (header != null) {
// entry could be zero bytes so we need to know that.
if(header.ZipHeaderType == ZipHeaderType.LocalEntry) {
bool isRecording = rewindableStream.IsRecording;
if (!isRecording) {
rewindableStream.StartRecording();
}
uint nextHeaderBytes = reader.ReadUInt32();
header.HasData = !IsHeader(nextHeaderBytes);
rewindableStream.Rewind(!isRecording);
//entry could be zero bytes so we need to know that.
if (header.ZipHeaderType == ZipHeaderType.LocalEntry)
{
bool isRecording = rewindableStream.IsRecording;
if (!isRecording)
{
rewindableStream.StartRecording();
}
uint nextHeaderBytes = reader.ReadUInt32();
header.HasData = !IsHeader(nextHeaderBytes);
rewindableStream.Rewind(!isRecording);
}
yield return header;
}

View File

@@ -87,7 +87,7 @@ namespace SharpCompress.Common.Zip
return entry;
}
default:
return null;
throw new NotSupportedException("Unknown header: " + headerBytes);
}
}

View File

@@ -670,6 +670,7 @@ namespace SharpCompress.Compressor.Deflate
send_bits((tree[c2] & 0xffff), (tree[c2 + 1] & 0xffff));
}
#pragma warning disable 675 // workaround for Visual Studio 2015 compiler bug: https://github.com/dotnet/roslyn/issues/4027
internal void send_bits(int value, int length)
{
int len = length;
@@ -677,10 +678,10 @@ namespace SharpCompress.Compressor.Deflate
{
if (bi_valid > (int) Buf_size - len)
{
//int val = value;
// bi_buf |= (val << bi_valid);
int x = (value << bi_valid) & 0xffff;
bi_buf = (short)((int)bi_buf | x);
bi_buf |= (short)((value << bi_valid) & 0xffff);
//put_short(bi_buf);
pending[pendingCount++] = (byte) bi_buf;
pending[pendingCount++] = (byte) (bi_buf >> 8);
@@ -691,14 +692,13 @@ namespace SharpCompress.Compressor.Deflate
}
else
{
// bi_buf |= (val << bi_valid);
int x = (value << bi_valid) & 0xffff;
bi_buf = (short)((int)bi_buf | x);
// bi_buf |= (value) << bi_valid;
bi_buf |= (short)((value << bi_valid) & 0xffff);
bi_valid += len;
}
}
}
#pragma warning restore 675
// Send one empty static block to give enough lookahead for inflate.
// This takes 10 bits, of which 7 may remain in the bit buffer.

View File

@@ -63,7 +63,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;UNSIGNED</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

View File

@@ -65,7 +65,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;UNSIGNED</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

View File

@@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © Adam Hathcock")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.11.2.0")]
[assembly: AssemblyFileVersion("0.11.2.0")]
[assembly: AssemblyVersion("0.11.3.0")]
[assembly: AssemblyFileVersion("0.11.3.0")]