mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Misc: Fix font compressor utility warnings. (#5359)
This commit is contained in:
parent
f58bd817e2
commit
74f7ac04a1
@ -66,7 +66,7 @@ int main(int argc, char** argv)
|
|||||||
char Encode85Byte(unsigned int x)
|
char Encode85Byte(unsigned int x)
|
||||||
{
|
{
|
||||||
x = (x % 85) + 35;
|
x = (x % 85) + 35;
|
||||||
return (x >= '\\') ? x + 1 : x;
|
return (char)((x >= '\\') ? x + 1 : x);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_base85_encoding, bool use_compression, bool use_static)
|
bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_base85_encoding, bool use_compression, bool use_static)
|
||||||
@ -263,17 +263,17 @@ static int stb_compress_chunk(stb_uchar *history,
|
|||||||
int best = 2, dist=0;
|
int best = 2, dist=0;
|
||||||
|
|
||||||
if (q+65536 > end)
|
if (q+65536 > end)
|
||||||
match_max = end-q;
|
match_max = (stb_uint)(end-q);
|
||||||
else
|
else
|
||||||
match_max = 65536;
|
match_max = 65536;
|
||||||
|
|
||||||
#define stb__nc(b,d) ((d) <= window && ((b) > 9 || stb_not_crap(b,d)))
|
#define stb__nc(b,d) ((d) <= window && ((b) > 9 || stb_not_crap((int)(b),(int)(d))))
|
||||||
|
|
||||||
#define STB__TRY(t,p) /* avoid retrying a match we already tried */ \
|
#define STB__TRY(t,p) /* avoid retrying a match we already tried */ \
|
||||||
if (p ? dist != q-t : 1) \
|
if (p ? dist != (int)(q-t) : 1) \
|
||||||
if ((m = stb_matchlen(t, q, match_max)) > best) \
|
if ((m = stb_matchlen(t, q, match_max)) > best) \
|
||||||
if (stb__nc(m,q-(t))) \
|
if (stb__nc(m,q-(t))) \
|
||||||
best = m, dist = q - (t)
|
best = m, dist = (int)(q - (t))
|
||||||
|
|
||||||
// rather than search for all matches, only try 4 candidate locations,
|
// rather than search for all matches, only try 4 candidate locations,
|
||||||
// chosen based on 4 different hash functions of different lengths.
|
// chosen based on 4 different hash functions of different lengths.
|
||||||
@ -299,24 +299,24 @@ static int stb_compress_chunk(stb_uchar *history,
|
|||||||
if (best < 3) { // fast path literals
|
if (best < 3) { // fast path literals
|
||||||
++q;
|
++q;
|
||||||
} else if (best > 2 && best <= 0x80 && dist <= 0x100) {
|
} else if (best > 2 && best <= 0x80 && dist <= 0x100) {
|
||||||
outliterals(lit_start, q-lit_start); lit_start = (q += best);
|
outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
|
||||||
stb_out(0x80 + best-1);
|
stb_out(0x80 + best-1);
|
||||||
stb_out(dist-1);
|
stb_out(dist-1);
|
||||||
} else if (best > 5 && best <= 0x100 && dist <= 0x4000) {
|
} else if (best > 5 && best <= 0x100 && dist <= 0x4000) {
|
||||||
outliterals(lit_start, q-lit_start); lit_start = (q += best);
|
outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
|
||||||
stb_out2(0x4000 + dist-1);
|
stb_out2(0x4000 + dist-1);
|
||||||
stb_out(best-1);
|
stb_out(best-1);
|
||||||
} else if (best > 7 && best <= 0x100 && dist <= 0x80000) {
|
} else if (best > 7 && best <= 0x100 && dist <= 0x80000) {
|
||||||
outliterals(lit_start, q-lit_start); lit_start = (q += best);
|
outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
|
||||||
stb_out3(0x180000 + dist-1);
|
stb_out3(0x180000 + dist-1);
|
||||||
stb_out(best-1);
|
stb_out(best-1);
|
||||||
} else if (best > 8 && best <= 0x10000 && dist <= 0x80000) {
|
} else if (best > 8 && best <= 0x10000 && dist <= 0x80000) {
|
||||||
outliterals(lit_start, q-lit_start); lit_start = (q += best);
|
outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
|
||||||
stb_out3(0x100000 + dist-1);
|
stb_out3(0x100000 + dist-1);
|
||||||
stb_out2(best-1);
|
stb_out2(best-1);
|
||||||
} else if (best > 9 && dist <= 0x1000000) {
|
} else if (best > 9 && dist <= 0x1000000) {
|
||||||
if (best > 65536) best = 65536;
|
if (best > 65536) best = 65536;
|
||||||
outliterals(lit_start, q-lit_start); lit_start = (q += best);
|
outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
|
||||||
if (best <= 0x100) {
|
if (best <= 0x100) {
|
||||||
stb_out(0x06);
|
stb_out(0x06);
|
||||||
stb_out3(dist-1);
|
stb_out3(dist-1);
|
||||||
@ -336,10 +336,10 @@ static int stb_compress_chunk(stb_uchar *history,
|
|||||||
q = start+length;
|
q = start+length;
|
||||||
|
|
||||||
// the literals are everything from lit_start to q
|
// the literals are everything from lit_start to q
|
||||||
*pending_literals = (q - lit_start);
|
*pending_literals = (int)(q - lit_start);
|
||||||
|
|
||||||
stb__running_adler = stb_adler32(stb__running_adler, start, q - start);
|
stb__running_adler = stb_adler32(stb__running_adler, start, (stb_uint)(q - start));
|
||||||
return q - start;
|
return (int)(q - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stb_compress_inner(stb_uchar *input, stb_uint length)
|
static int stb_compress_inner(stb_uchar *input, stb_uint length)
|
||||||
@ -384,5 +384,5 @@ stb_uint stb_compress(stb_uchar *out, stb_uchar *input, stb_uint length)
|
|||||||
|
|
||||||
stb_compress_inner(input, length);
|
stb_compress_inner(input, length);
|
||||||
|
|
||||||
return stb__out - out;
|
return (stb_uint)(stb__out - out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user