1
0
Fork 0
mirror of https://gitlab.com/bztsrc/bootboot.git synced 2023-02-13 20:54:32 -05:00

Recompiled mkbootimg for Win

This commit is contained in:
bzt 2020-09-21 21:45:39 +02:00
parent 11a0a755f4
commit 646329e952
3 changed files with 33 additions and 35 deletions

Binary file not shown.

View file

@ -3514,13 +3514,13 @@ local void gen_trees_header OF((void));
#endif
#ifndef ZLIB_DEBUG
# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
# define send_code(s, c, tree) send_bits(s, tree[c].fc.code, tree[c].dl.len)
/* Send a code of the given tree. c and tree must not have side effects */
#else /* !ZLIB_DEBUG */
# define send_code(s, c, tree) \
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
send_bits(s, tree[c].Code, tree[c].Len); }
send_bits(s, tree[c].fc.code, tree[c].dl.len); }
#endif
/* ===========================================================================
@ -3644,10 +3644,10 @@ local void tr_static_init()
/* Construct the codes of the static literal tree */
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
n = 0;
while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
while (n <= 143) static_ltree[n++].dl.len = 8, bl_count[8]++;
while (n <= 255) static_ltree[n++].dl.len = 9, bl_count[9]++;
while (n <= 279) static_ltree[n++].dl.len = 7, bl_count[7]++;
while (n <= 287) static_ltree[n++].dl.len = 8, bl_count[8]++;
/* Codes 286 and 287 do not exist, but we must include them in the
* tree construction to get a canonical Huffman tree (longest code
* all ones)
@ -3656,8 +3656,8 @@ local void tr_static_init()
/* The static distance tree is trivial: */
for (n = 0; n < D_CODES; n++) {
static_dtree[n].Len = 5;
static_dtree[n].Code = bi_reverse((unsigned)n, 5);
static_dtree[n].dl.len = 5;
static_dtree[n].fc.code = bi_reverse((unsigned)n, 5);
}
static_init_done = 1;
@ -3690,14 +3690,14 @@ void gen_trees_header()
fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
for (i = 0; i < L_CODES+2; i++) {
fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].fc.code,
static_ltree[i].dl.len, SEPARATOR(i, L_CODES+1, 5));
}
fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
for (i = 0; i < D_CODES; i++) {
fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].fc.code,
static_dtree[i].dl.len, SEPARATOR(i, D_CODES-1, 5));
}
fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
@ -3861,13 +3861,13 @@ local void gen_bitlen(s, desc)
/* In a first pass, compute the optimal bit lengths (which may
* overflow in the case of the bit length tree).
*/
tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
tree[s->heap[s->heap_max]].dl.len = 0; /* root of the heap */
for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
n = s->heap[h];
bits = tree[tree[n].Dad].Len + 1;
bits = tree[tree[n].Dad].dl.len + 1;
if (bits > max_length) bits = max_length, overflow++;
tree[n].Len = (ush)bits;
tree[n].dl.len = (ush)bits;
/* We overwrite tree[n].Dad which is no longer needed */
if (n > max_code) continue; /* not a leaf node */
@ -3877,7 +3877,7 @@ local void gen_bitlen(s, desc)
if (n >= base) xbits = extra[n-base];
f = tree[n].Freq;
s->opt_len += (ulg)f * (unsigned)(bits + xbits);
if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].dl.len + xbits);
}
if (overflow == 0) return;
@ -3907,10 +3907,10 @@ local void gen_bitlen(s, desc)
while (n != 0) {
m = s->heap[--h];
if (m > max_code) continue;
if ((unsigned) tree[m].Len != (unsigned) bits) {
Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq;
tree[m].Len = (ush)bits;
if ((unsigned) tree[m].dl.len != (unsigned) bits) {
Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].dl.len, bits));
s->opt_len += ((ulg)bits - tree[m].dl.len) * tree[m].Freq;
tree[m].dl.len = (ush)bits;
}
n--;
}
@ -3950,13 +3950,13 @@ local void gen_codes (tree, max_code, bl_count)
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
for (n = 0; n <= max_code; n++) {
int len = tree[n].Len;
int len = tree[n].dl.len;
if (len == 0) continue;
/* Now reverse the bits */
tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
tree[n].fc.code = (ush)bi_reverse(next_code[len]++, len);
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
n, (isgraph(n) ? n : ' '), len, tree[n].fc.code, next_code[len]-1));
}
}
@ -3990,7 +3990,7 @@ local void build_tree(s, desc)
s->heap[++(s->heap_len)] = max_code = n;
s->depth[n] = 0;
} else {
tree[n].Len = 0;
tree[n].dl.len = 0;
}
}
@ -4003,7 +4003,7 @@ local void build_tree(s, desc)
node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
tree[node].Freq = 1;
s->depth[node] = 0;
s->opt_len--; if (stree) s->static_len -= stree[node].Len;
s->opt_len--; if (stree) s->static_len -= stree[node].dl.len;
/* node is 0 or 1 so it does not have extra bits */
}
desc->max_code = max_code;
@ -4064,16 +4064,16 @@ local void scan_tree (s, tree, max_code)
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
int nextlen = tree[0].Len; /* length of next code */
int nextlen = tree[0].dl.len; /* length of next code */
int count = 0; /* repeat count of the current code */
int max_count = 7; /* max repeat count */
int min_count = 4; /* min repeat count */
if (nextlen == 0) max_count = 138, min_count = 3;
tree[max_code+1].Len = (ush)0xffff; /* guard */
tree[max_code+1].dl.len = (ush)0xffff; /* guard */
for (n = 0; n <= max_code; n++) {
curlen = nextlen; nextlen = tree[n+1].Len;
curlen = nextlen; nextlen = tree[n+1].dl.len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
@ -4109,16 +4109,16 @@ local void send_tree (s, tree, max_code)
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
int nextlen = tree[0].Len; /* length of next code */
int nextlen = tree[0].dl.len; /* length of next code */
int count = 0; /* repeat count of the current code */
int max_count = 7; /* max repeat count */
int min_count = 4; /* min repeat count */
/* tree[max_code+1].Len = -1; */ /* guard already set */
/* tree[max_code+1].dl.len = -1; */ /* guard already set */
if (nextlen == 0) max_count = 138, min_count = 3;
for (n = 0; n <= max_code; n++) {
curlen = nextlen; nextlen = tree[n+1].Len;
curlen = nextlen; nextlen = tree[n+1].dl.len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
@ -4172,7 +4172,7 @@ local int build_bl_tree(s)
* 3 but the actual value used is 4.)
*/
for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
if (s->bl_tree[bl_order[max_blindex]].dl.len != 0) break;
}
/* Update opt_len to include the bit length tree and counts */
s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4;
@ -4202,7 +4202,7 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
for (rank = 0; rank < blcodes; rank++) {
Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
send_bits(s, s->bl_tree[bl_order[rank]].dl.len, 3);
}
Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));

View file

@ -2789,9 +2789,7 @@ typedef struct ct_data_s {
} FAR ct_data;
#define Freq fc.freq
#define Code fc.code
#define Dad dl.dad
#define Len dl.len
typedef struct static_tree_desc_s static_tree_desc;