MCPcopy Create free account
hub / github.com/RenderKit/embree / stb_decompress

Function stb_decompress

tutorials/common/imgui/imgui_draw.cpp:4031–4061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4029}
4030
4031static unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int /*length*/)
4032{
4033 if (stb__in4(0) != 0x57bC0000) return 0;
4034 if (stb__in4(4) != 0) return 0; // error! stream is > 4GB
4035 const unsigned int olen = stb_decompress_length(i);
4036 stb__barrier_in_b = i;
4037 stb__barrier_out_e = output + olen;
4038 stb__barrier_out_b = output;
4039 i += 16;
4040
4041 stb__dout = output;
4042 for (;;) {
4043 const unsigned char *old_i = i;
4044 i = stb_decompress_token(i);
4045 if (i == old_i) {
4046 if (*i == 0x05 && i[1] == 0xfa) {
4047 IM_ASSERT(stb__dout == output + olen);
4048 if (stb__dout != output + olen) return 0;
4049 if (stb_adler32(1, output, olen) != (unsigned int) stb__in4(2))
4050 return 0;
4051 return olen;
4052 } else {
4053 IM_ASSERT(0); /* NOTREACHED */
4054 return 0;
4055 }
4056 }
4057 IM_ASSERT(stb__dout <= output + olen);
4058 if (stb__dout > output + olen)
4059 return 0;
4060 }
4061}
4062
4063//-----------------------------------------------------------------------------
4064// [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