MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__hdr_info

Function stbi__hdr_info

include/stb/stb_image.h:7289–7331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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