diff --git a/build.cmd b/build.cmd index a60c68b..74d4cb1 100644 --- a/build.cmd +++ b/build.cmd @@ -2,7 +2,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -set CL=/nologo /errorReport:none /Gm- /GF /GS- /MT /W4 +set CL=/nologo /errorReport:none /Gm- /GF /GS- /MT /W4 /wd4324 set LINK=/errorReport:none /INCREMENTAL:NO set CL=%CL% /Ox diff --git a/puff.c b/puff.c index 4ebc6ac..56e99f2 100644 --- a/puff.c +++ b/puff.c @@ -174,7 +174,7 @@ local int construct(struct huffman *h, const short *length, int n) */ for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) - h->symbol[offs[length[symbol]]++] = symbol; + h->symbol[offs[length[symbol]]++] = (short)symbol; /* return zero for complete set, positive for incomplete set */ return left; @@ -212,7 +212,7 @@ local int codes(struct state *s, if (s->out != NIL) { if (s->outcnt == s->outlen) return 1; - s->out[s->outcnt] = symbol; + s->out[s->outcnt] = (unsigned char)symbol; } s->outcnt++; } @@ -325,7 +325,7 @@ local int dynamic(struct state *s) /* read code length code lengths (really), missing lengths are zero */ for (index = 0; index < ncode; index++) - lengths[order[index]] = bits(s, 3); + lengths[order[index]] = (short)bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; @@ -344,7 +344,7 @@ local int dynamic(struct state *s) if (symbol < 0) return symbol; /* invalid symbol */ if (symbol < 16) /* length in 0..15 */ - lengths[index++] = symbol; + lengths[index++] = (short)symbol; else { /* repeat instruction */ len = 0; /* assume repeating zeros */ if (symbol == 16) { /* repeat last length 3..6 times */ @@ -360,7 +360,7 @@ local int dynamic(struct state *s) if (index + symbol > nlen + ndist) return -6; /* too many lengths! */ while (symbol--) /* repeat last or zero symbol times */ - lengths[index++] = len; + lengths[index++] = (short)len; } }