// copy as much as possible from the sliding window to the output area internal ZLibStatus inflate_flush(ZStream z, ZLibStatus r) { int n; int p; int q; // local copies of source and destination pointers p = z.next_out_index; q = read; // compute number of bytes to copy as far as end of window n = (int)((q <= write ? write : end) - q); if (n > z.avail_out) { n = z.avail_out; } if (n != 0 && r == ZLibStatus.Z_BUF_ERROR) { r = ZLibStatus.Z_OK; } // update counters z.avail_out -= n; z.total_out += n; // update check information if (checkfn != null) { z.adler = check = Adler32.adler32(check, window, q, n); } // copy as far as end of window System.Array.Copy(window, q, z.next_out, p, n); p += n; q += n; // see if more to copy at beginning of window if (q == end) { // wrap pointers q = 0; if (write == end) { write = 0; } // compute bytes to copy n = write - q; if (n > z.avail_out) { n = z.avail_out; } if (n != 0 && r == ZLibStatus.Z_BUF_ERROR) { r = ZLibStatus.Z_OK; } // update counters z.avail_out -= n; z.total_out += n; // update check information if (checkfn != null) { z.adler = check = Adler32.adler32(check, window, q, n); } // copy System.Array.Copy(window, q, z.next_out, p, n); p += n; q += n; } // update pointers z.next_out_index = p; read = q; // done return(r); }
public void free(){ next_in=null; next_out=null; msg=null; _adler=null; }