MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__gif_header

Function stbi__gif_header

Source/Utils/stb_image.h:6605–6634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6603}
6604
6605static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info)
6606{
6607 stbi_uc version;
6608 if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8')
6609 return stbi__err("not GIF", "Corrupt GIF");
6610
6611 version = stbi__get8(s);
6612 if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF");
6613 if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF");
6614
6615 stbi__g_failure_reason = "";
6616 g->w = stbi__get16le(s);
6617 g->h = stbi__get16le(s);
6618 g->flags = stbi__get8(s);
6619 g->bgindex = stbi__get8(s);
6620 g->ratio = stbi__get8(s);
6621 g->transparent = -1;
6622
6623 if (g->w > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)");
6624 if (g->h > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)");
6625
6626 if (comp != 0) *comp = 4; // can't actually tell whether it's 3 or 4 until we parse the comments
6627
6628 if (is_info) return 1;
6629
6630 if (g->flags & 0x80)
6631 stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1);
6632
6633 return 1;
6634}
6635
6636static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp)
6637{

Callers 2

stbi__gif_info_rawFunction · 0.85
stbi__gif_load_nextFunction · 0.85

Calls 4

stbi__get8Function · 0.85
stbi__errFunction · 0.85
stbi__get16leFunction · 0.85

Tested by

no test coverage detected