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

Function stbi__hdr_info

Source/Utils/stb_image.h:7286–7328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7284}
7285
7286static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp)
7287{
7288 char buffer[STBI__HDR_BUFLEN];
7289 char *token;
7290 int valid = 0;
7291 int dummy;
7292
7293 if (!x) x = &dummy;
7294 if (!y) y = &dummy;
7295 if (!comp) comp = &dummy;
7296
7297 if (stbi__hdr_test(s) == 0) {
7298 stbi__rewind( s );
7299 return 0;
7300 }
7301
7302 for(;;) {
7303 token = stbi__hdr_gettoken(s,buffer);
7304 if (token[0] == 0) break;
7305 if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
7306 }
7307
7308 if (!valid) {
7309 stbi__rewind( s );
7310 return 0;
7311 }
7312 token = stbi__hdr_gettoken(s,buffer);
7313 if (strncmp(token, "-Y ", 3)) {
7314 stbi__rewind( s );
7315 return 0;
7316 }
7317 token += 3;
7318 *y = (int) strtol(token, &token, 10);
7319 while (*token == ' ') ++token;
7320 if (strncmp(token, "+X ", 3)) {
7321 stbi__rewind( s );
7322 return 0;
7323 }
7324 token += 3;
7325 *x = (int) strtol(token, NULL, 10);
7326 *comp = 3;
7327 return 1;
7328}
7329#endif // STBI_NO_HDR
7330
7331#ifndef STBI_NO_BMP

Callers 1

stbi__info_mainFunction · 0.85

Calls 3

stbi__hdr_testFunction · 0.85
stbi__rewindFunction · 0.85
stbi__hdr_gettokenFunction · 0.85

Tested by

no test coverage detected