algorithm.doc: mention Internet RFC 1952 and modernize a bit
[debian/gzip] / gzip.h
diff --git a/gzip.h b/gzip.h
index d7e7cc072d5cda81737d8754860099af5a1f7e6e..cacbc5b62ac0b9693660f8d469ec127f08d288d1 100644 (file)
--- a/gzip.h
+++ b/gzip.h
@@ -1,11 +1,13 @@
 /* gzip.h -- common declarations for all gzip modules
 
-   Copyright (C) 1997, 1998, 1999, 2001, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997-1999, 2001, 2006-2007, 2009-2010 Free Software
+   Foundation, Inc.
+
    Copyright (C) 1992-1993 Jean-loup Gailly.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
  * too often
  */
 #include <stdio.h>
-#include <sys/types.h> /* for off_t, time_t */
-#if defined HAVE_STRING_H || defined STDC_HEADERS
-#  include <string.h>
-#  if !defined STDC_HEADERS && defined HAVE_MEMORY_H && !defined __GNUC__
-#    include <memory.h>
-#  endif
-#  define memzero(s, n)     memset ((voidp)(s), 0, (n))
-#else
-#  include <strings.h>
-#  define strchr            index
-#  define strrchr           rindex
-#  define memcpy(d, s, n)   bcopy((s), (d), (n))
-#  define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
-#  define memzero(s, n)     bzero((s), (n))
-#endif
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
+#include <sys/types.h> /* for off_t */
+#include <time.h>
+#include <string.h>
+#define memzero(s, n) memset ((voidp)(s), 0, (n))
 
 #ifndef RETSIGTYPE
 #  define RETSIGTYPE void
@@ -105,10 +92,6 @@ extern int method;         /* compression method */
 #  else
 #    define INBUFSIZ  0x8000  /* input buffer size */
 #  endif
-#  if defined SSIZE_MAX && SSIZE_MAX < INBUFSIZ
-#    undef INBUFSIZ
-#    define INBUFSIZ SSIZE_MAX
-#  endif
 #endif
 #define INBUF_EXTRA  64     /* required by unlzw() */
 
@@ -189,7 +172,7 @@ typedef int file_t;     /* Do not use stdio */
 
 /* gzip flag byte */
 #define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
+#define HEADER_CRC   0x02 /* bit 1 set: CRC16 for the gzip header */
 #define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
 #define ORIG_NAME    0x08 /* bit 3 set: original file name present */
 #define COMMENT      0x10 /* bit 4 set: file comment present */
@@ -285,23 +268,23 @@ extern int save_orig_name; /* set if original name must be saved */
 #endif
 
 #define WARN(msg) {if (!quiet) fprintf msg ; \
-                  if (exit_code == OK) exit_code = WARNING;}
+                   if (exit_code == OK) exit_code = WARNING;}
 
-       /* in zip.c: */
+        /* in zip.c: */
 extern int zip        OF((int in, int out));
 extern int file_read  OF((char *buf,  unsigned size));
 
-       /* in unzip.c */
+        /* in unzip.c */
 extern int unzip      OF((int in, int out));
 extern int check_zipfile OF((int in));
 
-       /* in unpack.c */
+        /* in unpack.c */
 extern int unpack     OF((int in, int out));
 
-       /* in unlzh.c */
+        /* in unlzh.c */
 extern int unlzh      OF((int in, int out));
 
-       /* in gzip.c */
+        /* in gzip.c */
 void abort_gzip OF((void)) ATTRIBUTE_NORETURN;
 
         /* in deflate.c */
@@ -321,7 +304,7 @@ void     bi_windup  OF((void));
 void     copy_block OF((char *buf, unsigned len, int header));
 extern   int (*read_buf) OF((char *buf, unsigned size));
 
-       /* in util.c: */
+        /* in util.c: */
 extern int copy           OF((int in, int out));
 extern ulg  updcrc        OF((uch *s, unsigned n));
 extern void clear_bufs    OF((void));
@@ -329,21 +312,22 @@ extern int  fill_inbuf    OF((int eof_ok));
 extern void flush_outbuf  OF((void));
 extern void flush_window  OF((void));
 extern void write_buf     OF((int fd, voidp buf, unsigned cnt));
+extern int read_buffer    OF((int fd, voidp buf, unsigned int cnt));
 extern char *strlwr       OF((char *s));
 extern char *gzip_base_name OF((char *fname));
 extern int xunlink        OF((char *fname));
 extern void make_simple_name OF((char *name));
-extern char *add_envopt   OF((int *argcp, char ***argvp, char *env));
-extern void gzip_error    OF((char *m));
+extern char *add_envopt   OF((int *argcp, char ***argvp, char const *env));
+extern void gzip_error    OF((char const *m)) ATTRIBUTE_NORETURN;
 extern void xalloc_die    OF((void)) ATTRIBUTE_NORETURN;
-extern void warning       OF((char *m));
-extern void read_error    OF((void));
-extern void write_error   OF((void));
+extern void warning       OF((char const *m));
+extern void read_error    OF((void)) ATTRIBUTE_NORETURN;
+extern void write_error   OF((void)) ATTRIBUTE_NORETURN;
 extern void display_ratio OF((off_t num, off_t den, FILE *file));
 extern void fprint_off    OF((FILE *, off_t, int));
 
-       /* in inflate.c */
+        /* in inflate.c */
 extern int inflate OF((void));
 
-       /* in yesno.c */
+        /* in yesno.c */
 extern int yesno OF((void));