comparison zlib/contrib/dotzlib/DotZLib/Deflater.cs @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents ae3a4bfb450b
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // 1 //
2 // © Copyright Henrik Ravn 2004 2 // © Copyright Henrik Ravn 2004
3 // 3 //
4 // Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4 // Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // 6 //
7 7
8 using System; 8 using System;
9 using System.Diagnostics; 9 using System.Diagnostics;
54 public override void Add(byte[] data, int offset, int count) 54 public override void Add(byte[] data, int offset, int count)
55 { 55 {
56 if (data == null) throw new ArgumentNullException(); 56 if (data == null) throw new ArgumentNullException();
57 if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); 57 if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
58 if ((offset+count) > data.Length) throw new ArgumentException(); 58 if ((offset+count) > data.Length) throw new ArgumentException();
59 59
60 int total = count; 60 int total = count;
61 int inputIndex = offset; 61 int inputIndex = offset;
62 int err = 0; 62 int err = 0;
63 63
64 while (err >= 0 && inputIndex < total) 64 while (err >= 0 && inputIndex < total)
84 /// Finishes up any pending data that needs to be processed and handled. 84 /// Finishes up any pending data that needs to be processed and handled.
85 /// </summary> 85 /// </summary>
86 public override void Finish() 86 public override void Finish()
87 { 87 {
88 int err; 88 int err;
89 do 89 do
90 { 90 {
91 err = deflate(ref _ztream, (int)FlushTypes.Finish); 91 err = deflate(ref _ztream, (int)FlushTypes.Finish);
92 OnDataAvailable(); 92 OnDataAvailable();
93 } 93 }
94 while (err == 0); 94 while (err == 0);