{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1752660931,
"reponame":"libwebsockets",
"desc":"libwebsockets lightweight C networking library",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"2854294aeabfe8e429fe79b2b82754cd",
"commit": {"type":"commit",
"time": 1740400877,
"time_ofs": 0,
"oid_tree": { "oid": "4f9bd26fec8514cf2c2197eb0195553dbacba8ee", "alias": []},
"oid":{ "oid": "0689fc82caafbb4d1b740c249fdc90093a70ac0e", "alias": []},
"msg": "dos2unix: win32port/zlib/inftrees.c",
"sig_commit": { "git_time": { "time": 1740400877, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },
"sig_author": { "git_time": { "time": 1740396721, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }},
"body": "dos2unix: win32port/zlib/inftrees.c\n"
,
"diff": "diff --git a/win32port/zlib/inftrees.c b/win32port/zlib/inftrees.c\nindex 9dbaec3..11e9c52 100644\n--- a/win32port/zlib/inftrees.c\n+++ b/win32port/zlib/inftrees.c\n@@ -1,330 +1,330 @@\n-/* inftrees.c -- generate Huffman trees for efficient decoding\r\n- * Copyright (C) 1995-2010 Mark Adler\r\n- * For conditions of distribution and use, see copyright notice in zlib.h\r\n- */\r\n-\r\n-#include \u0022zutil.h\u0022\r\n-#include \u0022inftrees.h\u0022\r\n-\r\n-#define MAXBITS 15\r\n-\r\n-const char inflate_copyright[] \u003d\r\n- \u0022 inflate 1.2.5 Copyright 1995-2010 Mark Adler \u0022;\r\n-/*\r\n- If you use the zlib library in a product, an acknowledgment is welcome\r\n- in the documentation of your product. If for some reason you cannot\r\n- include such an acknowledgment, I would appreciate that you keep this\r\n- copyright string in the executable of your product.\r\n- */\r\n-\r\n-/*\r\n- Build a set of tables to decode the provided canonical Huffman code.\r\n- The code lengths are lens[0..codes-1]. The result starts at *table,\r\n- whose indices are 0..2^bits-1. work is a writable array of at least\r\n- lens shorts, which is used as a work area. type is the type of code\r\n- to be generated, CODES, LENS, or DISTS. On return, zero is success,\r\n- -1 is an invalid code, and +1 means that ENOUGH isn't enough. table\r\n- on return points to the next available entry's address. bits is the\r\n- requested root table index bits, and on return it is the actual root\r\n- table index bits. It will differ if the request is greater than the\r\n- longest code or if it is less than the shortest code.\r\n- */\r\n-int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)\r\n-codetype type;\r\n-unsigned short FAR *lens;\r\n-unsigned codes;\r\n-code FAR * FAR *table;\r\n-unsigned FAR *bits;\r\n-unsigned short FAR *work;\r\n-{\r\n- unsigned len; /* a code's length in bits */\r\n- unsigned sym; /* index of code symbols */\r\n- unsigned min, max; /* minimum and maximum code lengths */\r\n- unsigned root; /* number of index bits for root table */\r\n- unsigned curr; /* number of index bits for current table */\r\n- unsigned drop; /* code bits to drop for sub-table */\r\n- int left; /* number of prefix codes available */\r\n- unsigned used; /* code entries in table used */\r\n- unsigned huff; /* Huffman code */\r\n- unsigned incr; /* for incrementing code, index */\r\n- unsigned fill; /* index for replicating entries */\r\n- unsigned low; /* low bits for current root entry */\r\n- unsigned mask; /* mask for low root bits */\r\n- code here; /* table entry for duplication */\r\n- code FAR *next; /* next available space in table */\r\n- const unsigned short FAR *base; /* base value table to use */\r\n- const unsigned short FAR *extra; /* extra bits table to use */\r\n- int end; /* use base and extra for symbol \u003e end */\r\n- unsigned short count[MAXBITS+1]; /* number of codes of each length */\r\n- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */\r\n- static const unsigned short lbase[31] \u003d { /* Length codes 257..285 base */\r\n- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\r\n- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};\r\n- static const unsigned short lext[31] \u003d { /* Length codes 257..285 extra */\r\n- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\r\n- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};\r\n- static const unsigned short dbase[32] \u003d { /* Distance codes 0..29 base */\r\n- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\r\n- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\r\n- 8193, 12289, 16385, 24577, 0, 0};\r\n- static const unsigned short dext[32] \u003d { /* Distance codes 0..29 extra */\r\n- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\r\n- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\r\n- 28, 28, 29, 29, 64, 64};\r\n-\r\n- /*\r\n- Process a set of code lengths to create a canonical Huffman code. The\r\n- code lengths are lens[0..codes-1]. Each length corresponds to the\r\n- symbols 0..codes-1. The Huffman code is generated by first sorting the\r\n- symbols by length from short to long, and retaining the symbol order\r\n- for codes with equal lengths. Then the code starts with all zero bits\r\n- for the first code of the shortest length, and the codes are integer\r\n- increments for the same length, and zeros are appended as the length\r\n- increases. For the deflate format, these bits are stored backwards\r\n- from their more natural integer increment ordering, and so when the\r\n- decoding tables are built in the large loop below, the integer codes\r\n- are incremented backwards.\r\n-\r\n- This routine assumes, but does not check, that all of the entries in\r\n- lens[] are in the range 0..MAXBITS. The caller must assure this.\r\n- 1..MAXBITS is interpreted as that code length. zero means that that\r\n- symbol does not occur in this code.\r\n-\r\n- The codes are sorted by computing a count of codes for each length,\r\n- creating from that a table of starting indices for each length in the\r\n- sorted table, and then entering the symbols in order in the sorted\r\n- table. The sorted table is work[], with that space being provided by\r\n- the caller.\r\n-\r\n- The length counts are used for other purposes as well, i.e. finding\r\n- the minimum and maximum length codes, determining if there are any\r\n- codes at all, checking for a valid set of lengths, and looking ahead\r\n- at length counts to determine sub-table sizes when building the\r\n- decoding tables.\r\n- */\r\n-\r\n- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\r\n- for (len \u003d 0; len \u003c\u003d MAXBITS; len++)\r\n- count[len] \u003d 0;\r\n- for (sym \u003d 0; sym \u003c codes; sym++)\r\n- count[lens[sym]]++;\r\n-\r\n- /* bound code lengths, force root to be within code lengths */\r\n- root \u003d *bits;\r\n- for (max \u003d MAXBITS; max \u003e\u003d 1; max--)\r\n- if (count[max] !\u003d 0) break;\r\n- if (root \u003e max) root \u003d max;\r\n- if (max \u003d\u003d 0) { /* no symbols to code at all */\r\n- here.op \u003d (unsigned char)64; /* invalid code marker */\r\n- here.bits \u003d (unsigned char)1;\r\n- here.val \u003d (unsigned short)0;\r\n- *(*table)++ \u003d here; /* make a table to force an error */\r\n- *(*table)++ \u003d here;\r\n- *bits \u003d 1;\r\n- return 0; /* no symbols, but wait for decoding to report error */\r\n- }\r\n- for (min \u003d 1; min \u003c max; min++)\r\n- if (count[min] !\u003d 0) break;\r\n- if (root \u003c min) root \u003d min;\r\n-\r\n- /* check for an over-subscribed or incomplete set of lengths */\r\n- left \u003d 1;\r\n- for (len \u003d 1; len \u003c\u003d MAXBITS; len++) {\r\n- left \u003c\u003c\u003d 1;\r\n- left -\u003d count[len];\r\n- if (left \u003c 0) return -1; /* over-subscribed */\r\n- }\r\n- if (left \u003e 0 \u0026\u0026 (type \u003d\u003d CODES || max !\u003d 1))\r\n- return -1; /* incomplete set */\r\n-\r\n- /* generate offsets into symbol table for each length for sorting */\r\n- offs[1] \u003d 0;\r\n- for (len \u003d 1; len \u003c MAXBITS; len++)\r\n- offs[len + 1] \u003d offs[len] + count[len];\r\n-\r\n- /* sort symbols by length, by symbol order within each length */\r\n- for (sym \u003d 0; sym \u003c codes; sym++)\r\n- if (lens[sym] !\u003d 0) work[offs[lens[sym]]++] \u003d (unsigned short)sym;\r\n-\r\n- /*\r\n- Create and fill in decoding tables. In this loop, the table being\r\n- filled is at next and has curr index bits. The code being used is huff\r\n- with length len. That code is converted to an index by dropping drop\r\n- bits off of the bottom. For codes where len is less than drop + curr,\r\n- those top drop + curr - len bits are incremented through all values to\r\n- fill the table with replicated entries.\r\n-\r\n- root is the number of index bits for the root table. When len exceeds\r\n- root, sub-tables are created pointed to by the root entry with an index\r\n- of the low root bits of huff. This is saved in low to check for when a\r\n- new sub-table should be started. drop is zero when the root table is\r\n- being filled, and drop is root when sub-tables are being filled.\r\n-\r\n- When a new sub-table is needed, it is necessary to look ahead in the\r\n- code lengths to determine what size sub-table is needed. The length\r\n- counts are used for this, and so count[] is decremented as codes are\r\n- entered in the tables.\r\n-\r\n- used keeps track of how many table entries have been allocated from the\r\n- provided *table space. It is checked for LENS and DIST tables against\r\n- the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\r\n- the initial root table size constants. See the comments in inftrees.h\r\n- for more information.\r\n-\r\n- sym increments through all symbols, and the loop terminates when\r\n- all codes of length max, i.e. all codes, have been processed. This\r\n- routine permits incomplete codes, so another loop after this one fills\r\n- in the rest of the decoding tables with invalid code markers.\r\n- */\r\n-\r\n- /* set up for code type */\r\n- switch (type) {\r\n- case CODES:\r\n- base \u003d extra \u003d work; /* dummy value--not used */\r\n- end \u003d 19;\r\n- break;\r\n- case LENS:\r\n- base \u003d lbase;\r\n- base -\u003d 257;\r\n- extra \u003d lext;\r\n- extra -\u003d 257;\r\n- end \u003d 256;\r\n- break;\r\n- default: /* DISTS */\r\n- base \u003d dbase;\r\n- extra \u003d dext;\r\n- end \u003d -1;\r\n- }\r\n-\r\n- /* initialize state for loop */\r\n- huff \u003d 0; /* starting code */\r\n- sym \u003d 0; /* starting code symbol */\r\n- len \u003d min; /* starting code length */\r\n- next \u003d *table; /* current table to fill in */\r\n- curr \u003d root; /* current table index bits */\r\n- drop \u003d 0; /* current bits to drop from code for index */\r\n- low \u003d (unsigned)(-1); /* trigger new sub-table when len \u003e root */\r\n- used \u003d 1U \u003c\u003c root; /* use root table entries */\r\n- mask \u003d used - 1; /* mask for comparing low */\r\n-\r\n- /* check available table space */\r\n- if ((type \u003d\u003d LENS \u0026\u0026 used \u003e\u003d ENOUGH_LENS) ||\r\n- (type \u003d\u003d DISTS \u0026\u0026 used \u003e\u003d ENOUGH_DISTS))\r\n- return 1;\r\n-\r\n- /* process all codes and make table entries */\r\n- for (;;) {\r\n- /* create table entry */\r\n- here.bits \u003d (unsigned char)(len - drop);\r\n- if ((int)(work[sym]) \u003c end) {\r\n- here.op \u003d (unsigned char)0;\r\n- here.val \u003d work[sym];\r\n- }\r\n- else if ((int)(work[sym]) \u003e end) {\r\n- here.op \u003d (unsigned char)(extra[work[sym]]);\r\n- here.val \u003d base[work[sym]];\r\n- }\r\n- else {\r\n- here.op \u003d (unsigned char)(32 + 64); /* end of block */\r\n- here.val \u003d 0;\r\n- }\r\n-\r\n- /* replicate for those indices with low len bits equal to huff */\r\n- incr \u003d 1U \u003c\u003c (len - drop);\r\n- fill \u003d 1U \u003c\u003c curr;\r\n- min \u003d fill; /* save offset to next table */\r\n- do {\r\n- fill -\u003d incr;\r\n- next[(huff \u003e\u003e drop) + fill] \u003d here;\r\n- } while (fill !\u003d 0);\r\n-\r\n- /* backwards increment the len-bit code huff */\r\n- incr \u003d 1U \u003c\u003c (len - 1);\r\n- while (huff \u0026 incr)\r\n- incr \u003e\u003e\u003d 1;\r\n- if (incr !\u003d 0) {\r\n- huff \u0026\u003d incr - 1;\r\n- huff +\u003d incr;\r\n- }\r\n- else\r\n- huff \u003d 0;\r\n-\r\n- /* go to next symbol, update count, len */\r\n- sym++;\r\n- if (--(count[len]) \u003d\u003d 0) {\r\n- if (len \u003d\u003d max) break;\r\n- len \u003d lens[work[sym]];\r\n- }\r\n-\r\n- /* create new sub-table if needed */\r\n- if (len \u003e root \u0026\u0026 (huff \u0026 mask) !\u003d low) {\r\n- /* if first time, transition to sub-tables */\r\n- if (drop \u003d\u003d 0)\r\n- drop \u003d root;\r\n-\r\n- /* increment past last table */\r\n- next +\u003d min; /* here min is 1 \u003c\u003c curr */\r\n-\r\n- /* determine length of next table */\r\n- curr \u003d len - drop;\r\n- left \u003d (int)(1 \u003c\u003c curr);\r\n- while (curr + drop \u003c max) {\r\n- left -\u003d count[curr + drop];\r\n- if (left \u003c\u003d 0) break;\r\n- curr++;\r\n- left \u003c\u003c\u003d 1;\r\n- }\r\n-\r\n- /* check for enough space */\r\n- used +\u003d 1U \u003c\u003c curr;\r\n- if ((type \u003d\u003d LENS \u0026\u0026 used \u003e\u003d ENOUGH_LENS) ||\r\n- (type \u003d\u003d DISTS \u0026\u0026 used \u003e\u003d ENOUGH_DISTS))\r\n- return 1;\r\n-\r\n- /* point entry in root table to sub-table */\r\n- low \u003d huff \u0026 mask;\r\n- (*table)[low].op \u003d (unsigned char)curr;\r\n- (*table)[low].bits \u003d (unsigned char)root;\r\n- (*table)[low].val \u003d (unsigned short)(next - *table);\r\n- }\r\n- }\r\n-\r\n- /*\r\n- Fill in rest of table for incomplete codes. This loop is similar to the\r\n- loop above in incrementing huff for table indices. It is assumed that\r\n- len is equal to curr + drop, so there is no loop needed to increment\r\n- through high index bits. When the current sub-table is filled, the loop\r\n- drops back to the root table to fill in any remaining entries there.\r\n- */\r\n- here.op \u003d (unsigned char)64; /* invalid code marker */\r\n- here.bits \u003d (unsigned char)(len - drop);\r\n- here.val \u003d (unsigned short)0;\r\n- while (huff !\u003d 0) {\r\n- /* when done with sub-table, drop back to root table */\r\n- if (drop !\u003d 0 \u0026\u0026 (huff \u0026 mask) !\u003d low) {\r\n- drop \u003d 0;\r\n- len \u003d root;\r\n- next \u003d *table;\r\n- here.bits \u003d (unsigned char)len;\r\n- }\r\n-\r\n- /* put invalid code marker in table */\r\n- next[huff \u003e\u003e drop] \u003d here;\r\n-\r\n- /* backwards increment the len-bit code huff */\r\n- incr \u003d 1U \u003c\u003c (len - 1);\r\n- while (huff \u0026 incr)\r\n- incr \u003e\u003e\u003d 1;\r\n- if (incr !\u003d 0) {\r\n- huff \u0026\u003d incr - 1;\r\n- huff +\u003d incr;\r\n- }\r\n- else\r\n- huff \u003d 0;\r\n- }\r\n-\r\n- /* set return parameters */\r\n- *table +\u003d used;\r\n- *bits \u003d root;\r\n- return 0;\r\n-}\r\n+/* inftrees.c -- generate Huffman trees for efficient decoding\n+ * Copyright (C) 1995-2010 Mark Adler\n+ * For conditions of distribution and use, see copyright notice in zlib.h\n+ */\n+\n+#include \u0022zutil.h\u0022\n+#include \u0022inftrees.h\u0022\n+\n+#define MAXBITS 15\n+\n+const char inflate_copyright[] \u003d\n+ \u0022 inflate 1.2.5 Copyright 1995-2010 Mark Adler \u0022;\n+/*\n+ If you use the zlib library in a product, an acknowledgment is welcome\n+ in the documentation of your product. If for some reason you cannot\n+ include such an acknowledgment, I would appreciate that you keep this\n+ copyright string in the executable of your product.\n+ */\n+\n+/*\n+ Build a set of tables to decode the provided canonical Huffman code.\n+ The code lengths are lens[0..codes-1]. The result starts at *table,\n+ whose indices are 0..2^bits-1. work is a writable array of at least\n+ lens shorts, which is used as a work area. type is the type of code\n+ to be generated, CODES, LENS, or DISTS. On return, zero is success,\n+ -1 is an invalid code, and +1 means that ENOUGH isn't enough. table\n+ on return points to the next available entry's address. bits is the\n+ requested root table index bits, and on return it is the actual root\n+ table index bits. It will differ if the request is greater than the\n+ longest code or if it is less than the shortest code.\n+ */\n+int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)\n+codetype type;\n+unsigned short FAR *lens;\n+unsigned codes;\n+code FAR * FAR *table;\n+unsigned FAR *bits;\n+unsigned short FAR *work;\n+{\n+ unsigned len; /* a code's length in bits */\n+ unsigned sym; /* index of code symbols */\n+ unsigned min, max; /* minimum and maximum code lengths */\n+ unsigned root; /* number of index bits for root table */\n+ unsigned curr; /* number of index bits for current table */\n+ unsigned drop; /* code bits to drop for sub-table */\n+ int left; /* number of prefix codes available */\n+ unsigned used; /* code entries in table used */\n+ unsigned huff; /* Huffman code */\n+ unsigned incr; /* for incrementing code, index */\n+ unsigned fill; /* index for replicating entries */\n+ unsigned low; /* low bits for current root entry */\n+ unsigned mask; /* mask for low root bits */\n+ code here; /* table entry for duplication */\n+ code FAR *next; /* next available space in table */\n+ const unsigned short FAR *base; /* base value table to use */\n+ const unsigned short FAR *extra; /* extra bits table to use */\n+ int end; /* use base and extra for symbol \u003e end */\n+ unsigned short count[MAXBITS+1]; /* number of codes of each length */\n+ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */\n+ static const unsigned short lbase[31] \u003d { /* Length codes 257..285 base */\n+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n+ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};\n+ static const unsigned short lext[31] \u003d { /* Length codes 257..285 extra */\n+ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};\n+ static const unsigned short dbase[32] \u003d { /* Distance codes 0..29 base */\n+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n+ 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n+ 8193, 12289, 16385, 24577, 0, 0};\n+ static const unsigned short dext[32] \u003d { /* Distance codes 0..29 extra */\n+ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n+ 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n+ 28, 28, 29, 29, 64, 64};\n+\n+ /*\n+ Process a set of code lengths to create a canonical Huffman code. The\n+ code lengths are lens[0..codes-1]. Each length corresponds to the\n+ symbols 0..codes-1. The Huffman code is generated by first sorting the\n+ symbols by length from short to long, and retaining the symbol order\n+ for codes with equal lengths. Then the code starts with all zero bits\n+ for the first code of the shortest length, and the codes are integer\n+ increments for the same length, and zeros are appended as the length\n+ increases. For the deflate format, these bits are stored backwards\n+ from their more natural integer increment ordering, and so when the\n+ decoding tables are built in the large loop below, the integer codes\n+ are incremented backwards.\n+\n+ This routine assumes, but does not check, that all of the entries in\n+ lens[] are in the range 0..MAXBITS. The caller must assure this.\n+ 1..MAXBITS is interpreted as that code length. zero means that that\n+ symbol does not occur in this code.\n+\n+ The codes are sorted by computing a count of codes for each length,\n+ creating from that a table of starting indices for each length in the\n+ sorted table, and then entering the symbols in order in the sorted\n+ table. The sorted table is work[], with that space being provided by\n+ the caller.\n+\n+ The length counts are used for other purposes as well, i.e. finding\n+ the minimum and maximum length codes, determining if there are any\n+ codes at all, checking for a valid set of lengths, and looking ahead\n+ at length counts to determine sub-table sizes when building the\n+ decoding tables.\n+ */\n+\n+ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n+ for (len \u003d 0; len \u003c\u003d MAXBITS; len++)\n+ count[len] \u003d 0;\n+ for (sym \u003d 0; sym \u003c codes; sym++)\n+ count[lens[sym]]++;\n+\n+ /* bound code lengths, force root to be within code lengths */\n+ root \u003d *bits;\n+ for (max \u003d MAXBITS; max \u003e\u003d 1; max--)\n+ if (count[max] !\u003d 0) break;\n+ if (root \u003e max) root \u003d max;\n+ if (max \u003d\u003d 0) { /* no symbols to code at all */\n+ here.op \u003d (unsigned char)64; /* invalid code marker */\n+ here.bits \u003d (unsigned char)1;\n+ here.val \u003d (unsigned short)0;\n+ *(*table)++ \u003d here; /* make a table to force an error */\n+ *(*table)++ \u003d here;\n+ *bits \u003d 1;\n+ return 0; /* no symbols, but wait for decoding to report error */\n+ }\n+ for (min \u003d 1; min \u003c max; min++)\n+ if (count[min] !\u003d 0) break;\n+ if (root \u003c min) root \u003d min;\n+\n+ /* check for an over-subscribed or incomplete set of lengths */\n+ left \u003d 1;\n+ for (len \u003d 1; len \u003c\u003d MAXBITS; len++) {\n+ left \u003c\u003c\u003d 1;\n+ left -\u003d count[len];\n+ if (left \u003c 0) return -1; /* over-subscribed */\n+ }\n+ if (left \u003e 0 \u0026\u0026 (type \u003d\u003d CODES || max !\u003d 1))\n+ return -1; /* incomplete set */\n+\n+ /* generate offsets into symbol table for each length for sorting */\n+ offs[1] \u003d 0;\n+ for (len \u003d 1; len \u003c MAXBITS; len++)\n+ offs[len + 1] \u003d offs[len] + count[len];\n+\n+ /* sort symbols by length, by symbol order within each length */\n+ for (sym \u003d 0; sym \u003c codes; sym++)\n+ if (lens[sym] !\u003d 0) work[offs[lens[sym]]++] \u003d (unsigned short)sym;\n+\n+ /*\n+ Create and fill in decoding tables. In this loop, the table being\n+ filled is at next and has curr index bits. The code being used is huff\n+ with length len. That code is converted to an index by dropping drop\n+ bits off of the bottom. For codes where len is less than drop + curr,\n+ those top drop + curr - len bits are incremented through all values to\n+ fill the table with replicated entries.\n+\n+ root is the number of index bits for the root table. When len exceeds\n+ root, sub-tables are created pointed to by the root entry with an index\n+ of the low root bits of huff. This is saved in low to check for when a\n+ new sub-table should be started. drop is zero when the root table is\n+ being filled, and drop is root when sub-tables are being filled.\n+\n+ When a new sub-table is needed, it is necessary to look ahead in the\n+ code lengths to determine what size sub-table is needed. The length\n+ counts are used for this, and so count[] is decremented as codes are\n+ entered in the tables.\n+\n+ used keeps track of how many table entries have been allocated from the\n+ provided *table space. It is checked for LENS and DIST tables against\n+ the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n+ the initial root table size constants. See the comments in inftrees.h\n+ for more information.\n+\n+ sym increments through all symbols, and the loop terminates when\n+ all codes of length max, i.e. all codes, have been processed. This\n+ routine permits incomplete codes, so another loop after this one fills\n+ in the rest of the decoding tables with invalid code markers.\n+ */\n+\n+ /* set up for code type */\n+ switch (type) {\n+ case CODES:\n+ base \u003d extra \u003d work; /* dummy value--not used */\n+ end \u003d 19;\n+ break;\n+ case LENS:\n+ base \u003d lbase;\n+ base -\u003d 257;\n+ extra \u003d lext;\n+ extra -\u003d 257;\n+ end \u003d 256;\n+ break;\n+ default: /* DISTS */\n+ base \u003d dbase;\n+ extra \u003d dext;\n+ end \u003d -1;\n+ }\n+\n+ /* initialize state for loop */\n+ huff \u003d 0; /* starting code */\n+ sym \u003d 0; /* starting code symbol */\n+ len \u003d min; /* starting code length */\n+ next \u003d *table; /* current table to fill in */\n+ curr \u003d root; /* current table index bits */\n+ drop \u003d 0; /* current bits to drop from code for index */\n+ low \u003d (unsigned)(-1); /* trigger new sub-table when len \u003e root */\n+ used \u003d 1U \u003c\u003c root; /* use root table entries */\n+ mask \u003d used - 1; /* mask for comparing low */\n+\n+ /* check available table space */\n+ if ((type \u003d\u003d LENS \u0026\u0026 used \u003e\u003d ENOUGH_LENS) ||\n+ (type \u003d\u003d DISTS \u0026\u0026 used \u003e\u003d ENOUGH_DISTS))\n+ return 1;\n+\n+ /* process all codes and make table entries */\n+ for (;;) {\n+ /* create table entry */\n+ here.bits \u003d (unsigned char)(len - drop);\n+ if ((int)(work[sym]) \u003c end) {\n+ here.op \u003d (unsigned char)0;\n+ here.val \u003d work[sym];\n+ }\n+ else if ((int)(work[sym]) \u003e end) {\n+ here.op \u003d (unsigned char)(extra[work[sym]]);\n+ here.val \u003d base[work[sym]];\n+ }\n+ else {\n+ here.op \u003d (unsigned char)(32 + 64); /* end of block */\n+ here.val \u003d 0;\n+ }\n+\n+ /* replicate for those indices with low len bits equal to huff */\n+ incr \u003d 1U \u003c\u003c (len - drop);\n+ fill \u003d 1U \u003c\u003c curr;\n+ min \u003d fill; /* save offset to next table */\n+ do {\n+ fill -\u003d incr;\n+ next[(huff \u003e\u003e drop) + fill] \u003d here;\n+ } while (fill !\u003d 0);\n+\n+ /* backwards increment the len-bit code huff */\n+ incr \u003d 1U \u003c\u003c (len - 1);\n+ while (huff \u0026 incr)\n+ incr \u003e\u003e\u003d 1;\n+ if (incr !\u003d 0) {\n+ huff \u0026\u003d incr - 1;\n+ huff +\u003d incr;\n+ }\n+ else\n+ huff \u003d 0;\n+\n+ /* go to next symbol, update count, len */\n+ sym++;\n+ if (--(count[len]) \u003d\u003d 0) {\n+ if (len \u003d\u003d max) break;\n+ len \u003d lens[work[sym]];\n+ }\n+\n+ /* create new sub-table if needed */\n+ if (len \u003e root \u0026\u0026 (huff \u0026 mask) !\u003d low) {\n+ /* if first time, transition to sub-tables */\n+ if (drop \u003d\u003d 0)\n+ drop \u003d root;\n+\n+ /* increment past last table */\n+ next +\u003d min; /* here min is 1 \u003c\u003c curr */\n+\n+ /* determine length of next table */\n+ curr \u003d len - drop;\n+ left \u003d (int)(1 \u003c\u003c curr);\n+ while (curr + drop \u003c max) {\n+ left -\u003d count[curr + drop];\n+ if (left \u003c\u003d 0) break;\n+ curr++;\n+ left \u003c\u003c\u003d 1;\n+ }\n+\n+ /* check for enough space */\n+ used +\u003d 1U \u003c\u003c curr;\n+ if ((type \u003d\u003d LENS \u0026\u0026 used \u003e\u003d ENOUGH_LENS) ||\n+ (type \u003d\u003d DISTS \u0026\u0026 used \u003e\u003d ENOUGH_DISTS))\n+ return 1;\n+\n+ /* point entry in root table to sub-table */\n+ low \u003d huff \u0026 mask;\n+ (*table)[low].op \u003d (unsigned char)curr;\n+ (*table)[low].bits \u003d (unsigned char)root;\n+ (*table)[low].val \u003d (unsigned short)(next - *table);\n+ }\n+ }\n+\n+ /*\n+ Fill in rest of table for incomplete codes. This loop is similar to the\n+ loop above in incrementing huff for table indices. It is assumed that\n+ len is equal to curr + drop, so there is no loop needed to increment\n+ through high index bits. When the current sub-table is filled, the loop\n+ drops back to the root table to fill in any remaining entries there.\n+ */\n+ here.op \u003d (unsigned char)64; /* invalid code marker */\n+ here.bits \u003d (unsigned char)(len - drop);\n+ here.val \u003d (unsigned short)0;\n+ while (huff !\u003d 0) {\n+ /* when done with sub-table, drop back to root table */\n+ if (drop !\u003d 0 \u0026\u0026 (huff \u0026 mask) !\u003d low) {\n+ drop \u003d 0;\n+ len \u003d root;\n+ next \u003d *table;\n+ here.bits \u003d (unsigned char)len;\n+ }\n+\n+ /* put invalid code marker in table */\n+ next[huff \u003e\u003e drop] \u003d here;\n+\n+ /* backwards increment the len-bit code huff */\n+ incr \u003d 1U \u003c\u003c (len - 1);\n+ while (huff \u0026 incr)\n+ incr \u003e\u003e\u003d 1;\n+ if (incr !\u003d 0) {\n+ huff \u0026\u003d incr - 1;\n+ huff +\u003d incr;\n+ }\n+ else\n+ huff \u003d 0;\n+ }\n+\n+ /* set return parameters */\n+ *table +\u003d used;\n+ *bits \u003d root;\n+ return 0;\n+}\n","s":{"c":1752660931,"u": 3121}}
],"g": 5742,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}