Lines Matching +defs:token +defs:code
20 - decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)
47 rewrite stbi_info and load_file variations to share file handling code
139 // would silently load as BGR, except the existing code should have just
810 // Common code used by all image loaders
1115 uint16 code[256];
1163 int i,j,k=0,code;
1171 code = 0;
1174 // compute delta to add to code to compute symbol id
1175 h->delta[j] = k - code;
1178 h->code[k++] = (uint16) (code++);
1179 if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG");
1181 // compute largest code + 1 for this size, preshifted as needed later
1182 h->maxcode[j] = code << (16-j);
1183 code <<= 1;
1192 int c = h->code[i] << (FAST_BITS-s);
1231 // if the code is <= FAST_BITS
1254 // error! code not found
1262 // convert the huffman code to the symbol id
1264 assert((((j->code_buffer) >> (32 - h->size[c])) & bmask[h->size[c]]) == h->code[c]);
1321 if (t < 0) return e("bad huffman code","Corrupt JPEG");
1336 if (rs < 0) return e("bad huffman code","Corrupt JPEG");
2189 // (jpegs packs from left, zlib from right, so can't share code)
2220 int code, next_code[16], sizes[17];
2230 code = 0;
2232 next_code[i] = code;
2233 z->firstcode[i] = (uint16) code;
2235 code = (code + sizes[i]);
2237 if (code-1 >= (1 << i)) return e("bad codelengths","Corrupt JPEG");
2238 z->maxcode[i] = code << (16-i); // preshift for inner loop
2239 code <<= 1;
2325 if (s == 16) return -1; // invalid code!
2326 // code size is s, so:
2370 if (z < 0) return e("bad huffman code","Corrupt PNG"); // error in huffman codes
2381 if (z < 0) return e("bad huffman code","Corrupt PNG");
2511 // use fixed code lengths
4422 static void stbi_out_gif_code(stbi_gif *g, uint16 code)
4428 if (g->codes[code].prefix >= 0)
4429 stbi_out_gif_code(g, g->codes[code].prefix);
4434 c = &g->color_table[g->codes[code].suffix * 4];
4459 int32 len, code;
4471 for (code = 0; code < clear; code++) {
4472 g->codes[code].prefix = -1;
4473 g->codes[code].first = (uint8) code;
4474 g->codes[code].suffix = (uint8) code;
4477 // support no starting clear code
4493 code = bits & codemask;
4497 if (code == clear) { // clear code
4503 } else if (code == clear + 1) { // end of stream code
4508 } else if (code <= avail) {
4509 if (first) return epuc("no clear code", "Corrupt GIF");
4516 p->suffix = (code == avail) ? p->first : g->codes[code].first;
4517 } else if (code == avail)
4518 return epuc("illegal code in raster", "Corrupt GIF");
4520 stbi_out_gif_code(g, (uint16) code);
4527 oldcode = code;
4529 return epuc("illegal code in raster", "Corrupt GIF");
4641 case 0x3B: // gif stream termination code
4645 return epuc("unknown code", "Corrupt GIF");
4830 char *token;
4846 token = hdr_gettoken(s,buffer);
4847 if (token[0] == 0) break;
4848 if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
4855 token = hdr_gettoken(s,buffer);
4856 if (strncmp(token, "-Y ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
4857 token += 3;
4858 height = strtol(token, &token, 10);
4859 while (*token == ' ') ++token;
4860 if (strncmp(token, "+X ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
4861 token += 3;
4862 width = strtol(token, NULL, 10);
5047 1.09 Fix format-conversion for PSD code (bad global variables!)
5048 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz