diff --git a/mkDistribution.bat b/mkDistribution.bat
index 8ee8c1a9c..cd1c0f6a6 100644
--- a/mkDistribution.bat
+++ b/mkDistribution.bat
@@ -1,4 +1,4 @@
-@echo mkDistribution v1.0"
+@echo "mkDistribution v1.1"
if exist current (
rmdir /s /q current
@@ -19,7 +19,17 @@ mkdir current\net-20
nant -t:net-2.0 -D:build.output.dir=current\net-20 -buildfile:sharpZLib.build build
@echo todo generate documentation and the rest of the distribution image.
-samples\cs\bin\sz -rc SharpZipLib.zip current\*.dll
+samples\cs\bin\sz -rc current\SharpZipLib.zip current\*.dll
+
+mkdir current\source
+copy doc\readme.rtf current\source
+copy doc\Changes.txt current\source
+copy doc\Copying.txt current\source
+rem copy doc\SharpZipLib.chm current\source
+copy *.bat current\source
+copy *.build current\source
+
+
REM Compress source to SharpZipLib_SourceSamples.zip
REM Build CHM file
REM Build Bin Zip files
\ No newline at end of file
diff --git a/src/Zip/ZipEntry.cs b/src/Zip/ZipEntry.cs
index 3d80d493b..764a8e1a8 100644
--- a/src/Zip/ZipEntry.cs
+++ b/src/Zip/ZipEntry.cs
@@ -878,8 +878,8 @@ internal void ProcessExtraData(bool localHeader)
else {
if (
((versionToExtract & 0xff) >= ZipConstants.VersionZip64) &&
- ( (size == uint.MaxValue) ||
- (compressedSize == uint.MaxValue) )) {
+ ((size == uint.MaxValue) || (compressedSize == uint.MaxValue))
+ ) {
throw new ZipException("Zip64 Extended information required but is missing.");
}
}
diff --git a/src/Zip/ZipFile.cs b/src/Zip/ZipFile.cs
index c86e64774..6a94f5bbf 100644
--- a/src/Zip/ZipFile.cs
+++ b/src/Zip/ZipFile.cs
@@ -1805,14 +1805,14 @@ int WriteCentralDirectoryHeader(ZipEntry entry)
WriteLEInt((int)entry.Crc);
}
- if ( entry.CompressedSize >= 0xffffffff ) {
+ if ( (entry.IsZip64Forced()) || (entry.CompressedSize >= 0xffffffff) ) {
WriteLEInt(-1);
}
else {
WriteLEInt((int)(entry.CompressedSize & 0xffffffff));
}
- if ( entry.Size >= 0xffffffff ) {
+ if ( (entry.IsZip64Forced()) || (entry.Size >= 0xffffffff) ) {
WriteLEInt(-1);
}
else {
@@ -2422,6 +2422,8 @@ void RunUpdates()
else
{
workFile = ZipFile.Create(archiveStorage_.GetTemporaryOutput());
+ workFile.UseZip64 = UseZip64;
+
if (key != null) {
workFile.key = (byte[])key.Clone();
}
diff --git a/src/Zip/ZipNameTransform.cs b/src/Zip/ZipNameTransform.cs
index 42d270820..f6c1bf958 100644
--- a/src/Zip/ZipNameTransform.cs
+++ b/src/Zip/ZipNameTransform.cs
@@ -62,9 +62,7 @@ public ZipNameTransform()
/// The string to trim from front of paths if found.
public ZipNameTransform(string trimPrefix)
{
- if ( trimPrefix != null ) {
- trimPrefix_ = trimPrefix.ToLower();
- }
+ TrimPrefix = trimPrefix;
}
#endregion
@@ -116,7 +114,7 @@ public string TransformDirectory(string name)
}
///
- /// Transform a file name according to the Zip file naming conventions.
+ /// Transform a windows file name according to the Zip file naming conventions.
///
/// The file name to transform.
/// The transformed name.
@@ -127,7 +125,8 @@ public string TransformFile(string name)
if ( (trimPrefix_ != null) && (lowerName.IndexOf(trimPrefix_) == 0) ) {
name = name.Substring(trimPrefix_.Length);
}
-
+
+ // The following can throw exceptions when the name contains invalid characters
if (Path.IsPathRooted(name) == true) {
// NOTE:
// for UNC names... \\machine\share\zoom\beet.txt gives \zoom\beet.txt
@@ -149,10 +148,17 @@ public string TransformFile(string name)
///
/// Get/set the path prefix to be trimmed from paths if present.
///
+ /// The prefix is trimmed before any conversion from
+ /// a windows path is done.
public string TrimPrefix
{
get { return trimPrefix_; }
- set { trimPrefix_ = value; }
+ set {
+ trimPrefix_ = value;
+ if (trimPrefix_ != null) {
+ trimPrefix_ = trimPrefix_.ToLower();
+ }
+ }
}
///
diff --git a/tests/Base/InflaterDeflaterTests.cs b/tests/Base/InflaterDeflaterTests.cs
index 015856639..641fbdcd7 100644
--- a/tests/Base/InflaterDeflaterTests.cs
+++ b/tests/Base/InflaterDeflaterTests.cs
@@ -165,6 +165,7 @@ public void SmallBlocks()
}
[Test]
+ [Explicit]
[Category("Base")]
[Category("ExcludeFromAutoBuild")]
public void FindBug()
diff --git a/tests/Zip/ZipTests.cs b/tests/Zip/ZipTests.cs
index d96306a45..f2076f307 100644
--- a/tests/Zip/ZipTests.cs
+++ b/tests/Zip/ZipTests.cs
@@ -451,7 +451,7 @@ public class ExerciseZipEntry : ZipBase
{
void PiecewiseCompare(ZipEntry lhs, ZipEntry rhs)
{
- // Introspection might be better here?
+ // Introspection would be better here of course
Assert.AreEqual(lhs.Name, rhs.Name, "Cloned name mismatch" );
Assert.AreEqual(lhs.Crc, rhs.Crc, "Cloned crc mismatch" );
Assert.AreEqual(lhs.Comment, rhs.Comment, "Cloned comment mismatch" );
@@ -2039,15 +2039,31 @@ public void ReadOverrunShort()
[TestFixture]
public class ExerciseZipNameTransform : ZipBase
{
+ void TestFile(ZipNameTransform t, string original, string expected)
+ {
+ string transformed = t.TransformFile(original);
+ Assert.AreEqual(expected, transformed, "Should be equal");
+ }
+
[Test]
[Category("Zip")]
public void Exercise()
{
- ZipNameTransform nt = new ZipNameTransform();
+ ZipNameTransform t = new ZipNameTransform();
+
+ TestFile(t, "abcdef", "abcdef");
+ TestFile(t, @"\\uncpath\d1\file1", "file1");
+ TestFile(t, @"C:\absolute\file2", "absolute/file2");
+
+ // This is ignored but could be converted to 'file3'
+ TestFile(t, @"./file3", "./file3");
- string original = "abcdefghijklmnopqrstuvwxyz";
- string transformed = nt.TransformFile(original);
- Assert.AreEqual(original, transformed, "Should be equal");
+ // The following relative paths cant be handled and are ignored
+ TestFile(t, @"../file3", "../file3");
+ TestFile(t, @".../file3", ".../file3");
+
+ // Trick filenames.
+ TestFile(t, @".....file3", ".....file3");
}
}
[TestFixture]
@@ -2348,6 +2364,15 @@ public void Zip64Useage()
}
}
+ [Test]
+ [Category("Zip")]
+ [Explicit]
+ public void Zip64Offset()
+ {
+ // TODO: Test to check that a zip64 offset value is loaded correctly.
+ // Changes in ZipEntry to CentralHeaderRequiresZip64 and LocalHeaderRequiresZip64
+ // were not quite correct...
+ }
[Test]
[Category("Zip")]