Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) #ifndef INFLATE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #define INFLATE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) /* inflate.h -- internal inflate state definition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 1995-2004 Mark Adler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * For conditions of distribution and use, see copyright notice in zlib.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) /* WARNING: this file should *not* be used by applications. It is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)    part of the implementation of the compression library and is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)    subject to change. Applications should only use zlib.h.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "inftrees.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /* Possible inflate modes between inflate() calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) typedef enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)     HEAD,       /* i: waiting for magic header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)     FLAGS,      /* i: waiting for method and flags (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)     TIME,       /* i: waiting for modification time (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)     OS,         /* i: waiting for extra flags and operating system (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)     EXLEN,      /* i: waiting for extra length (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)     EXTRA,      /* i: waiting for extra bytes (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)     NAME,       /* i: waiting for end of file name (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)     COMMENT,    /* i: waiting for end of comment (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)     HCRC,       /* i: waiting for header crc (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)     DICTID,     /* i: waiting for dictionary check value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)     DICT,       /* waiting for inflateSetDictionary() call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)         TYPE,       /* i: waiting for type bits, including last-flag bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)         TYPEDO,     /* i: same, but skip check to exit inflate on new block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)         STORED,     /* i: waiting for stored size (length and complement) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)         COPY,       /* i/o: waiting for input or output to copy stored block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)         TABLE,      /* i: waiting for dynamic block table lengths */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)         LENLENS,    /* i: waiting for code length code lengths */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)         CODELENS,   /* i: waiting for length/lit and distance code lengths */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)             LEN,        /* i: waiting for length/lit code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)             LENEXT,     /* i: waiting for length extra bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)             DIST,       /* i: waiting for distance code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)             DISTEXT,    /* i: waiting for distance extra bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)             MATCH,      /* o: waiting for output space to copy string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)             LIT,        /* o: waiting for output space to write literal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)     CHECK,      /* i: waiting for 32-bit check value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)     LENGTH,     /* i: waiting for 32-bit length (gzip) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)     DONE,       /* finished check, done -- remain here until reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)     BAD,        /* got a data error -- remain here until reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)     MEM,        /* got an inflate() memory error -- remain here until reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)     SYNC        /* looking for synchronization bytes to restart inflate() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) } inflate_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)     State transitions between above modes -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)     (most modes can go to the BAD or MEM mode -- not shown for clarity)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)     Process header:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)         HEAD -> (gzip) or (zlib)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)         (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)         NAME -> COMMENT -> HCRC -> TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)         (zlib) -> DICTID or TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)         DICTID -> DICT -> TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)     Read deflate blocks:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)             TYPE -> STORED or TABLE or LEN or CHECK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)             STORED -> COPY -> TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)             TABLE -> LENLENS -> CODELENS -> LEN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)     Read deflate codes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)                 LEN -> LENEXT or LIT or TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)                 LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)                 LIT -> LEN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)     Process trailer:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)         CHECK -> LENGTH -> DONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) /* state maintained between inflate() calls.  Approximately 7K bytes. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) struct inflate_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)     inflate_mode mode;          /* current inflate mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)     int last;                   /* true if processing last block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)     int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)     int havedict;               /* true if dictionary provided */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)     int flags;                  /* gzip header method and flags (0 if zlib) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)     unsigned dmax;              /* zlib header max distance (INFLATE_STRICT) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)     unsigned long check;        /* protected copy of check value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)     unsigned long total;        /* protected copy of output count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  /*   gz_headerp head; */           /* where to save gzip header information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)         /* sliding window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)     unsigned wbits;             /* log base 2 of requested window size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)     unsigned wsize;             /* window size or zero if not using window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)     unsigned whave;             /* valid bytes in the window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)     unsigned write;             /* window write index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)     unsigned char *window;  /* allocated sliding window, if needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)         /* bit accumulator */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)     unsigned long hold;         /* input bit accumulator */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)     unsigned bits;              /* number of bits in "in" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)         /* for string and stored block copying */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)     unsigned length;            /* literal or length of data to copy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)     unsigned offset;            /* distance back to copy string from */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)         /* for table and code decoding */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)     unsigned extra;             /* extra bits needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)         /* fixed and dynamic code tables */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)     code const *lencode;    /* starting table for length/literal codes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)     code const *distcode;   /* starting table for distance codes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)     unsigned lenbits;           /* index bits for lencode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)     unsigned distbits;          /* index bits for distcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)         /* dynamic table building */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)     unsigned ncode;             /* number of code length code lengths */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)     unsigned nlen;              /* number of length code lengths */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)     unsigned ndist;             /* number of distance code lengths */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)     unsigned have;              /* number of code lengths in lens[] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)     code *next;             /* next available space in codes[] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)     unsigned short lens[320];   /* temporary storage for code lengths */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)     unsigned short work[288];   /* work area for code table building */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)     code codes[ENOUGH];         /* space for code tables */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /* Reverse the bytes in a 32-bit value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define REVERSE(q) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)     ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)      (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #endif