Beispiel #1
0
            public static int SetAvailOut(ZStream/*!*/ self, int size)
            {
                long newBufferSize;
                var zst = self.GetStream();
                if (size < 0 || (newBufferSize = zst.next_out_index + size) > Int32.MaxValue) {
                    throw RubyExceptions.CreateArgumentError("negative string size (or size too big)");
                }

                int old = zst.avail_out;

                // Make sure we have enough space in the buffer.
                // We could keep the buffer larger but since users are calling
                // this API explicitly they probably want to resize the buffer.
                var output = zst.next_out;
                Array.Resize(ref output, (int)newBufferSize);
                zst.next_out = output;
                zst.avail_out = size;
                return old;
            }
Beispiel #2
0
 public static object TotalOut(ZStream/*!*/ self)
 {
     return Protocols.Normalize(self.GetStream().total_out);
 }
Beispiel #3
0
 public static void Reset(ZStream/*!*/ self)
 {
     var zst = self.GetStream();
     if (zst.IsInitialized) {
         int err = zst.reset();
         Debug.Assert(err == Z_OK);
     }
 }
Beispiel #4
0
 public static int GetAvailOut(ZStream/*!*/ self)
 {
     return self.GetStream().avail_out;
 }
Beispiel #5
0
 public static int DataType(ZStream/*!*/ self)
 {
     return (int)self.GetStream().Data_type;
 }
Beispiel #6
0
 public static int AvailIn(ZStream/*!*/ self)
 {
     return self.GetStream().avail_in;
 }
Beispiel #7
0
 public static object Adler(ZStream/*!*/ self)
 {
     return Protocols.Normalize(self.GetStream().adler);
 }