Skip to content

Commit 8c094d6

Browse files
committed
Minimize Travis CI, Using CodeAnalysis Recommend Fixes Again
1 parent ae5668a commit 8c094d6

35 files changed

+223
-434
lines changed

.travis.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,30 @@ solution: ICSharpCode.SharpZipLib.sln
88
# env: NETCORE=1
99
# dotnet: 2.1
1010
mono: none
11-
dotnet: 2.1
11+
dotnet: 5.0
1212
os: linux
13+
1314
install:
1415
- dotnet restore
1516
# - nuget restore ICSharpCode.SharpZipLib.sln
1617
# - nuget install NUnit.Console -Version 3.8.0 -OutputDirectory _testRunner
18+
1719
script:
18-
- dotnet build -f netstandard2 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
19-
- dotnet run -c Debug -f netcoreapp2 -p test/ICSharpCode.SharpZipLib.TestBootstrapper/ICSharpCode.SharpZipLib.TestBootstrapper.csproj -- --where "class !~ WindowsNameTransformHandling & test !~ ZipEntryFactoryHandling.CreatedValues & test !~ ZipNameTransformHandling.FilenameCleaning" --result=docs/nunit3-test-results-debug.xml
20-
- dotnet run -c Release -f netcoreapp2 -p test/ICSharpCode.SharpZipLib.TestBootstrapper/ICSharpCode.SharpZipLib.TestBootstrapper.csproj -- --where "class !~ WindowsNameTransformHandling & test !~ ZipEntryFactoryHandling.CreatedValues & test !~ ZipNameTransformHandling.FilenameCleaning" --result=docs\nunit3-test-results-release.xml
20+
- dotnet build -C Release src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
21+
# - dotnet run -c Debug -f netcoreapp2 -p test/ICSharpCode.SharpZipLib.TestBootstrapper/ICSharpCode.SharpZipLib.TestBootstrapper.csproj -- --where "class !~ WindowsNameTransformHandling & test !~ ZipEntryFactoryHandling.CreatedValues & test !~ ZipNameTransformHandling.FilenameCleaning" --result=docs/nunit3-test-results-debug.xml
22+
# - dotnet run -c Release -f netcoreapp2 -p test/ICSharpCode.SharpZipLib.TestBootstrapper/ICSharpCode.SharpZipLib.TestBootstrapper.csproj -- --where "class !~ WindowsNameTransformHandling & test !~ ZipEntryFactoryHandling.CreatedValues & test !~ ZipNameTransformHandling.FilenameCleaning" --result=docs\nunit3-test-results-release.xml
2123
# - dotnet test test/ICSharpCode.SharpZipLib.Tests/ICSharpCode.SharpZipLib.Tests.csproj
2224
# - xbuild /p:Configuration=Release ICSharpCode.SharpZipLib.sln
2325
# - mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe --framework=mono-4.0 --labels=All --result=./Documentation/nunit3-test-results-travis.xml ./bin/Release/ICSharpCode.SharpZipLib.Tests.dll
24-
after_script:
25-
- dotnet pack -f netstandard2 -o _dist/ src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
26+
27+
#after_script:
28+
# - dotnet pack -f netstandard2 -o _dist/ src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
29+
2630
#cache:
2731
# directories:
2832
# - bin
2933
# - Documentation
34+
3035
#deploy:
3136
# provider: releases
3237
# api_key: "GITHUB OAUTH TOKEN"

src/ICSharpCode.SharpZipLib/BZip2/BZip2.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ public static void Decompress(Stream inStream, Stream outStream, bool isStreamOw
2525

2626
try
2727
{
28-
using BZip2InputStream bzipInput = new BZip2InputStream(inStream);
29-
bzipInput.IsStreamOwner = isStreamOwner;
28+
using BZip2InputStream bzipInput = new BZip2InputStream(inStream)
29+
{
30+
IsStreamOwner = isStreamOwner
31+
};
3032
Core.StreamUtils.Copy(bzipInput, outStream, new byte[4096]);
3133
}
3234
finally
@@ -58,8 +60,10 @@ public static void Compress(Stream inStream, Stream outStream, bool isStreamOwne
5860

5961
try
6062
{
61-
using BZip2OutputStream bzipOutput = new BZip2OutputStream(outStream, level);
62-
bzipOutput.IsStreamOwner = isStreamOwner;
63+
using BZip2OutputStream bzipOutput = new BZip2OutputStream(outStream, level)
64+
{
65+
IsStreamOwner = isStreamOwner
66+
};
6367
Core.StreamUtils.Copy(inStream, bzipOutput, new byte[4096]);
6468
}
6569
finally

src/ICSharpCode.SharpZipLib/BZip2/BZip2OutputStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The current block size is 100000 * this number.
9898
private int workDone;
9999
private int workLimit;
100100
private bool firstAttempt;
101-
private int nBlocksRandomised;
101+
//private int nBlocksRandomised;
102102

103103
private int currentChar = -1;
104104
private int runLength;
@@ -448,7 +448,7 @@ public override void Flush()
448448
private void Initialize()
449449
{
450450
bytesOut = 0;
451-
nBlocksRandomised = 0;
451+
//nBlocksRandomised = 0;
452452

453453
/*--- Write header `magic' bytes indicating file-format == huffmanised,
454454
followed by a digit indicating blockSize100k.
@@ -521,7 +521,7 @@ damaged files.
521521
if (blockRandomised)
522522
{
523523
BsW(1, 1);
524-
nBlocksRandomised++;
524+
//nBlocksRandomised++;
525525
}
526526
else
527527
{

src/ICSharpCode.SharpZipLib/Checksum/BZip2Crc.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public long Value
138138
//return (long)(~checkValue ^ crcXor);
139139
// but x ^ 0 = x, so there is no point in adding
140140
// the XOR operation
141-
return (long)(~checkValue);
141+
return ~checkValue;
142142
}
143143
}
144144

src/ICSharpCode.SharpZipLib/Checksum/Crc32.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public sealed class Crc32 : IChecksum
100100

101101
internal static uint ComputeCrc32(uint oldCrc, byte bval)
102102
{
103-
return (uint)(Crc32.crcTable[(oldCrc ^ bval) & 0xFF] ^ (oldCrc >> 8));
103+
return Crc32.crcTable[(oldCrc ^ bval) & 0xFF] ^ (oldCrc >> 8);
104104
}
105105

106106
/// <summary>
@@ -127,7 +127,7 @@ public long Value
127127
{
128128
get
129129
{
130-
return (long)(checkValue ^ crcXor);
130+
return checkValue ^ crcXor;
131131
}
132132
}
133133

src/ICSharpCode.SharpZipLib/Core/FileSystemScanner.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public float PercentComplete
101101
}
102102
else
103103
{
104-
result = ((float)processed_ / (float)target_) * 100.0f;
104+
result = (processed_ / (float)target_) * 100.0f;
105105
}
106106
return result;
107107
}
@@ -399,22 +399,6 @@ private void OnProcessFile(string file)
399399
}
400400
}
401401

402-
/// <summary>
403-
/// Raise the complete file event
404-
/// </summary>
405-
/// <param name="file">The file name</param>
406-
private void OnCompleteFile(string file)
407-
{
408-
CompletedFileHandler handler = CompletedFile;
409-
410-
if (handler != null)
411-
{
412-
var args = new ScanEventArgs(file);
413-
handler(this, args);
414-
alive_ = args.ContinueRunning;
415-
}
416-
}
417-
418402
/// <summary>
419403
/// Raise the ProcessDirectory event.
420404
/// </summary>

src/ICSharpCode.SharpZipLib/Encryption/ZipAESTransform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int input
163163
{
164164
throw new NotImplementedException("TransformFinalBlock is not implemented and inputCount is greater than 0");
165165
}
166-
return new byte[0];
166+
return Array.Empty<byte>();
167167
}
168168

169169
/// <summary>

src/ICSharpCode.SharpZipLib/GZip/GZip.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ public static void Decompress(Stream inStream, Stream outStream, bool isStreamOw
2828

2929
try
3030
{
31-
using GZipInputStream gzipInput = new GZipInputStream(inStream);
32-
gzipInput.IsStreamOwner = isStreamOwner;
31+
using GZipInputStream gzipInput = new GZipInputStream(inStream)
32+
{
33+
IsStreamOwner = isStreamOwner
34+
};
3335
Core.StreamUtils.Copy(gzipInput, outStream, new byte[4096]);
3436
}
3537
finally

src/ICSharpCode.SharpZipLib/GZip/GzipInputStream.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ private void ReadFooter()
368368

369369
// NOTE The total here is the original total modulo 2 ^ 32.
370370
uint total =
371-
(uint)((uint)footer[4] & 0xff) |
372-
(uint)(((uint)footer[5] & 0xff) << 8) |
373-
(uint)(((uint)footer[6] & 0xff) << 16) |
374-
(uint)((uint)footer[7] << 24);
371+
(uint)footer[4] & 0xff |
372+
((uint)footer[5] & 0xff) << 8 |
373+
((uint)footer[6] & 0xff) << 16 |
374+
(uint)footer[7] << 24;
375375

376376
if (bytesRead != total)
377377
{

src/ICSharpCode.SharpZipLib/GZip/GzipOutputStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ private void WriteHeader()
227227
var mod_time = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000L); // Ticks give back 100ns intervals
228228
byte[] gzipHeader = {
229229
// The two magic bytes
230-
(byte) (GZipConstants.GZIP_MAGIC >> 8), (byte) (GZipConstants.GZIP_MAGIC & 0xff),
230+
GZipConstants.GZIP_MAGIC >> 8, GZipConstants.GZIP_MAGIC & 0xff,
231231

232232
// The compression type
233-
(byte) Deflater.DEFLATED,
233+
Deflater.DEFLATED,
234234

235235
// The flags (not set)
236236
0,
@@ -243,7 +243,7 @@ private void WriteHeader()
243243
0,
244244

245245
// The OS type (unknown)
246-
(byte) 255
246+
255
247247
};
248248
baseOutputStream_.Write(gzipHeader, 0, gzipHeader.Length);
249249
}

0 commit comments

Comments
 (0)