| [597] | 1 | // DeflaterConstants.cs
|
|---|
| 2 | //
|
|---|
| 3 | // Copyright (C) 2001 Mike Krueger
|
|---|
| 4 | // Copyright (C) 2004 John Reilly
|
|---|
| 5 | //
|
|---|
| 6 | // This file was translated from java, it was part of the GNU Classpath
|
|---|
| 7 | // Copyright (C) 2001 Free Software Foundation, Inc.
|
|---|
| 8 | //
|
|---|
| 9 | // This program is free software; you can redistribute it and/or
|
|---|
| 10 | // modify it under the terms of the GNU General Public License
|
|---|
| 11 | // as published by the Free Software Foundation; either version 2
|
|---|
| 12 | // of the License, or (at your option) any later version.
|
|---|
| 13 | //
|
|---|
| 14 | // This program is distributed in the hope that it will be useful,
|
|---|
| 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | // GNU General Public License for more details.
|
|---|
| 18 | //
|
|---|
| 19 | // You should have received a copy of the GNU General Public License
|
|---|
| 20 | // along with this program; if not, write to the Free Software
|
|---|
| 21 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 22 | //
|
|---|
| 23 | // Linking this library statically or dynamically with other modules is
|
|---|
| 24 | // making a combined work based on this library. Thus, the terms and
|
|---|
| 25 | // conditions of the GNU General Public License cover the whole
|
|---|
| 26 | // combination.
|
|---|
| 27 | //
|
|---|
| 28 | // As a special exception, the copyright holders of this library give you
|
|---|
| 29 | // permission to link this library with independent modules to produce an
|
|---|
| 30 | // executable, regardless of the license terms of these independent
|
|---|
| 31 | // modules, and to copy and distribute the resulting executable under
|
|---|
| 32 | // terms of your choice, provided that you also meet, for each linked
|
|---|
| 33 | // independent module, the terms and conditions of the license of that
|
|---|
| 34 | // module. An independent module is a module which is not derived from
|
|---|
| 35 | // or based on this library. If you modify this library, you may extend
|
|---|
| 36 | // this exception to your version of the library, but you are not
|
|---|
| 37 | // obligated to do so. If you do not wish to do so, delete this
|
|---|
| 38 | // exception statement from your version.
|
|---|
| 39 |
|
|---|
| 40 | using System;
|
|---|
| 41 |
|
|---|
| 42 | namespace ICSharpCode.SharpZipLib.Zip.Compression
|
|---|
| 43 | {
|
|---|
| 44 |
|
|---|
| 45 | /// <summary>
|
|---|
| 46 | /// This class contains constants used for deflation.
|
|---|
| 47 | /// </summary>
|
|---|
| 48 | public class DeflaterConstants
|
|---|
| 49 | {
|
|---|
| 50 | /// <summary>
|
|---|
| 51 | /// Set to true to enable debugging
|
|---|
| 52 | /// </summary>
|
|---|
| 53 | public const bool DEBUGGING = false;
|
|---|
| 54 |
|
|---|
| 55 | /// <summary>
|
|---|
| 56 | /// Written to Zip file to identify a stored block
|
|---|
| 57 | /// </summary>
|
|---|
| 58 | public const int STORED_BLOCK = 0;
|
|---|
| 59 |
|
|---|
| 60 | /// <summary>
|
|---|
| 61 | /// Identifies static tree in Zip file
|
|---|
| 62 | /// </summary>
|
|---|
| 63 | public const int STATIC_TREES = 1;
|
|---|
| 64 |
|
|---|
| 65 | /// <summary>
|
|---|
| 66 | /// Identifies dynamic tree in Zip file
|
|---|
| 67 | /// </summary>
|
|---|
| 68 | public const int DYN_TREES = 2;
|
|---|
| 69 |
|
|---|
| 70 | /// <summary>
|
|---|
| 71 | /// Header flag indicating a preset dictionary for deflation
|
|---|
| 72 | /// </summary>
|
|---|
| 73 | public const int PRESET_DICT = 0x20;
|
|---|
| 74 |
|
|---|
| 75 | /// <summary>
|
|---|
| 76 | /// Sets internal buffer sizes for Huffman encoding
|
|---|
| 77 | /// </summary>
|
|---|
| 78 | public const int DEFAULT_MEM_LEVEL = 8;
|
|---|
| 79 |
|
|---|
| 80 | /// <summary>
|
|---|
| 81 | /// Internal compression engine constant
|
|---|
| 82 | /// </summary>
|
|---|
| 83 | public const int MAX_MATCH = 258;
|
|---|
| 84 |
|
|---|
| 85 | /// <summary>
|
|---|
| 86 | /// Internal compression engine constant
|
|---|
| 87 | /// </summary>
|
|---|
| 88 | public const int MIN_MATCH = 3;
|
|---|
| 89 |
|
|---|
| 90 | /// <summary>
|
|---|
| 91 | /// Internal compression engine constant
|
|---|
| 92 | /// </summary>
|
|---|
| 93 | public const int MAX_WBITS = 15;
|
|---|
| 94 |
|
|---|
| 95 | /// <summary>
|
|---|
| 96 | /// Internal compression engine constant
|
|---|
| 97 | /// </summary>
|
|---|
| 98 | public const int WSIZE = 1 << MAX_WBITS;
|
|---|
| 99 |
|
|---|
| 100 | /// <summary>
|
|---|
| 101 | /// Internal compression engine constant
|
|---|
| 102 | /// </summary>
|
|---|
| 103 | public const int WMASK = WSIZE - 1;
|
|---|
| 104 |
|
|---|
| 105 | /// <summary>
|
|---|
| 106 | /// Internal compression engine constant
|
|---|
| 107 | /// </summary>
|
|---|
| 108 | public const int HASH_BITS = DEFAULT_MEM_LEVEL + 7;
|
|---|
| 109 |
|
|---|
| 110 | /// <summary>
|
|---|
| 111 | /// Internal compression engine constant
|
|---|
| 112 | /// </summary>
|
|---|
| 113 | public const int HASH_SIZE = 1 << HASH_BITS;
|
|---|
| 114 |
|
|---|
| 115 | /// <summary>
|
|---|
| 116 | /// Internal compression engine constant
|
|---|
| 117 | /// </summary>
|
|---|
| 118 | public const int HASH_MASK = HASH_SIZE - 1;
|
|---|
| 119 |
|
|---|
| 120 | /// <summary>
|
|---|
| 121 | /// Internal compression engine constant
|
|---|
| 122 | /// </summary>
|
|---|
| 123 | public const int HASH_SHIFT = (HASH_BITS + MIN_MATCH - 1) / MIN_MATCH;
|
|---|
| 124 |
|
|---|
| 125 | /// <summary>
|
|---|
| 126 | /// Internal compression engine constant
|
|---|
| 127 | /// </summary>
|
|---|
| 128 | public const int MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;
|
|---|
| 129 |
|
|---|
| 130 | /// <summary>
|
|---|
| 131 | /// Internal compression engine constant
|
|---|
| 132 | /// </summary>
|
|---|
| 133 | public const int MAX_DIST = WSIZE - MIN_LOOKAHEAD;
|
|---|
| 134 |
|
|---|
| 135 | /// <summary>
|
|---|
| 136 | /// Internal compression engine constant
|
|---|
| 137 | /// </summary>
|
|---|
| 138 | public const int PENDING_BUF_SIZE = 1 << (DEFAULT_MEM_LEVEL + 8);
|
|---|
| 139 |
|
|---|
| 140 | /// <summary>
|
|---|
| 141 | /// Internal compression engine constant
|
|---|
| 142 | /// </summary>
|
|---|
| 143 | public static int MAX_BLOCK_SIZE = Math.Min(65535, PENDING_BUF_SIZE - 5);
|
|---|
| 144 |
|
|---|
| 145 | /// <summary>
|
|---|
| 146 | /// Internal compression engine constant
|
|---|
| 147 | /// </summary>
|
|---|
| 148 | public const int DEFLATE_STORED = 0;
|
|---|
| 149 |
|
|---|
| 150 | /// <summary>
|
|---|
| 151 | /// Internal compression engine constant
|
|---|
| 152 | /// </summary>
|
|---|
| 153 | public const int DEFLATE_FAST = 1;
|
|---|
| 154 |
|
|---|
| 155 | /// <summary>
|
|---|
| 156 | /// Internal compression engine constant
|
|---|
| 157 | /// </summary>
|
|---|
| 158 | public const int DEFLATE_SLOW = 2;
|
|---|
| 159 |
|
|---|
| 160 | /// <summary>
|
|---|
| 161 | /// Internal compression engine constant
|
|---|
| 162 | /// </summary>
|
|---|
| 163 | public static int[] GOOD_LENGTH = { 0, 4, 4, 4, 4, 8, 8, 8, 32, 32 };
|
|---|
| 164 |
|
|---|
| 165 | /// <summary>
|
|---|
| 166 | /// Internal compression engine constant
|
|---|
| 167 | /// </summary>
|
|---|
| 168 | public static int[] MAX_LAZY = { 0, 4, 5, 6, 4, 16, 16, 32, 128, 258 };
|
|---|
| 169 |
|
|---|
| 170 | /// <summary>
|
|---|
| 171 | /// Internal compression engine constant
|
|---|
| 172 | /// </summary>
|
|---|
| 173 | public static int[] NICE_LENGTH = { 0, 8, 16, 32, 16, 32, 128, 128, 258, 258 };
|
|---|
| 174 |
|
|---|
| 175 | /// <summary>
|
|---|
| 176 | /// Internal compression engine constant
|
|---|
| 177 | /// </summary>
|
|---|
| 178 | public static int[] MAX_CHAIN = { 0, 4, 8, 32, 16, 32, 128, 256, 1024, 4096 };
|
|---|
| 179 |
|
|---|
| 180 | /// <summary>
|
|---|
| 181 | /// Internal compression engine constant
|
|---|
| 182 | /// </summary>
|
|---|
| 183 | public static int[] COMPR_FUNC = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2 };
|
|---|
| 184 |
|
|---|
| 185 | }
|
|---|
| 186 | }
|
|---|