| 7978 | } |
| 7979 | |
| 7980 | static int stbi__hdr_info(stbi__context* s, int* x, int* y, int* comp) { |
| 7981 | char buffer[STBI__HDR_BUFLEN]; |
| 7982 | char* token; |
| 7983 | int valid = 0; |
| 7984 | int dummy; |
| 7985 | |
| 7986 | if (!x) |
| 7987 | x = &dummy; |
| 7988 | if (!y) |
| 7989 | y = &dummy; |
| 7990 | if (!comp) |
| 7991 | comp = &dummy; |
| 7992 | |
| 7993 | if (stbi__hdr_test(s) == 0) { |
| 7994 | stbi__rewind(s); |
| 7995 | return 0; |
| 7996 | } |
| 7997 | |
| 7998 | for (;;) { |
| 7999 | token = stbi__hdr_gettoken(s, buffer); |
| 8000 | if (token[0] == 0) |
| 8001 | break; |
| 8002 | if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) |
| 8003 | valid = 1; |
| 8004 | } |
| 8005 | |
| 8006 | if (!valid) { |
| 8007 | stbi__rewind(s); |
| 8008 | return 0; |
| 8009 | } |
| 8010 | token = stbi__hdr_gettoken(s, buffer); |
| 8011 | if (strncmp(token, "-Y ", 3)) { |
| 8012 | stbi__rewind(s); |
| 8013 | return 0; |
| 8014 | } |
| 8015 | token += 3; |
| 8016 | *y = (int)strtol(token, &token, 10); |
| 8017 | while (*token == ' ') |
| 8018 | ++token; |
| 8019 | if (strncmp(token, "+X ", 3)) { |
| 8020 | stbi__rewind(s); |
| 8021 | return 0; |
| 8022 | } |
| 8023 | token += 3; |
| 8024 | *x = (int)strtol(token, NULL, 10); |
| 8025 | *comp = 3; |
| 8026 | return 1; |
| 8027 | } |
| 8028 | #endif // STBI_NO_HDR |
| 8029 | |
| 8030 | #ifndef STBI_NO_BMP |
no test coverage detected