ZlibConstants.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // ZlibConstants.cs
  2. // ------------------------------------------------------------------
  3. //
  4. // Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
  5. // All rights reserved.
  6. //
  7. // This code module is part of DotNetZip, a zipfile class library.
  8. //
  9. // ------------------------------------------------------------------
  10. //
  11. // This code is licensed under the Microsoft Public License.
  12. // See the file License.txt for the license details.
  13. // More info on: http://dotnetzip.codeplex.com
  14. //
  15. // ------------------------------------------------------------------
  16. //
  17. // last saved (in emacs):
  18. // Time-stamp: <2009-November-03 18:50:19>
  19. //
  20. // ------------------------------------------------------------------
  21. //
  22. // This module defines constants used by the zlib class library. This
  23. // code is derived from the jzlib implementation of zlib, but
  24. // significantly modified. In keeping with the license for jzlib, the
  25. // copyright to that code is included here.
  26. //
  27. // ------------------------------------------------------------------
  28. //
  29. // Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
  30. //
  31. // Redistribution and use in source and binary forms, with or without
  32. // modification, are permitted provided that the following conditions are met:
  33. //
  34. // 1. Redistributions of source code must retain the above copyright notice,
  35. // this list of conditions and the following disclaimer.
  36. //
  37. // 2. Redistributions in binary form must reproduce the above copyright
  38. // notice, this list of conditions and the following disclaimer in
  39. // the documentation and/or other materials provided with the distribution.
  40. //
  41. // 3. The names of the authors may not be used to endorse or promote products
  42. // derived from this software without specific prior written permission.
  43. //
  44. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  45. // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  46. // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  47. // INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  48. // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  49. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  50. // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  51. // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  52. // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  53. // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. //
  55. // -----------------------------------------------------------------------
  56. //
  57. // This program is based on zlib-1.1.3; credit to authors
  58. // Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
  59. // and contributors of zlib.
  60. //
  61. // -----------------------------------------------------------------------
  62. using System;
  63. namespace BestHTTP.Decompression.Zlib
  64. {
  65. /// <summary>
  66. /// A bunch of constants used in the Zlib interface.
  67. /// </summary>
  68. public static class ZlibConstants
  69. {
  70. /// <summary>
  71. /// The maximum number of window bits for the Deflate algorithm.
  72. /// </summary>
  73. public const int WindowBitsMax = 15; // 32K LZ77 window
  74. /// <summary>
  75. /// The default number of window bits for the Deflate algorithm.
  76. /// </summary>
  77. public const int WindowBitsDefault = WindowBitsMax;
  78. /// <summary>
  79. /// indicates everything is A-OK
  80. /// </summary>
  81. public const int Z_OK = 0;
  82. /// <summary>
  83. /// Indicates that the last operation reached the end of the stream.
  84. /// </summary>
  85. public const int Z_STREAM_END = 1;
  86. /// <summary>
  87. /// The operation ended in need of a dictionary.
  88. /// </summary>
  89. public const int Z_NEED_DICT = 2;
  90. /// <summary>
  91. /// There was an error with the stream - not enough data, not open and readable, etc.
  92. /// </summary>
  93. public const int Z_STREAM_ERROR = -2;
  94. /// <summary>
  95. /// There was an error with the data - not enough data, bad data, etc.
  96. /// </summary>
  97. public const int Z_DATA_ERROR = -3;
  98. /// <summary>
  99. /// There was an error with the working buffer.
  100. /// </summary>
  101. public const int Z_BUF_ERROR = -5;
  102. /// <summary>
  103. /// The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes.
  104. /// </summary>
  105. #if NETCF
  106. public const int WorkingBufferSizeDefault = 8192;
  107. #else
  108. public const int WorkingBufferSizeDefault = 16384;
  109. #endif
  110. /// <summary>
  111. /// The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes.
  112. /// </summary>
  113. public const int WorkingBufferSizeMin = 1024;
  114. }
  115. }