MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / stb_decompress

Function stb_decompress

KBotExt/imgui/imgui_draw.cpp:4091–4122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4089}
4090
4091static unsigned int stb_decompress(unsigned char* output, const unsigned char* i, unsigned int /*length*/)
4092{
4093 if (stb__in4(0) != 0x57bC0000) return 0;
4094 if (stb__in4(4) != 0) return 0; // error! stream is > 4GB
4095 const unsigned int olen = stb_decompress_length(i);
4096 stb__barrier_in_b = i;
4097 stb__barrier_out_e = output + olen;
4098 stb__barrier_out_b = output;
4099 i += 16;
4100
4101 stb__dout = output;
4102 for (;;) {
4103 const unsigned char* old_i = i;
4104 i = stb_decompress_token(i);
4105 if (i == old_i) {
4106 if (*i == 0x05 && i[1] == 0xfa) {
4107 IM_ASSERT(stb__dout == output + olen);
4108 if (stb__dout != output + olen) return 0;
4109 if (stb_adler32(1, output, olen) != (unsigned int)stb__in4(2))
4110 return 0;
4111 return olen;
4112 }
4113 else {
4114 IM_ASSERT(0); /* NOTREACHED */
4115 return 0;
4116 }
4117 }
4118 IM_ASSERT(stb__dout <= output + olen);
4119 if (stb__dout > output + olen)
4120 return 0;
4121 }
4122}
4123
4124//-----------------------------------------------------------------------------
4125// [SECTION] Default font data (ProggyClean.ttf)

Callers 1

Calls 3

stb_decompress_lengthFunction · 0.85
stb_decompress_tokenFunction · 0.85
stb_adler32Function · 0.85

Tested by

no test coverage detected