MCPcopy Create free account
hub / github.com/DentonW/DevIL / get_next_code

Function get_next_code

DevIL/src-IL/src/il_gif.cpp:466–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464
465
466ILint get_next_code(void) {
467 ILint i, t;
468 ILuint ret;
469
470 //20050102: Tests for IL_EOF were added because this function
471 //crashed sometimes if igetc() returned IL_EOF
472 //(for example "table-add-column-before-active.gif" included in the
473 //mozilla source package)
474
475 if (!nbits_left) {
476 if (navail_bytes <= 0) {
477 pbytes = byte_buff;
478 navail_bytes = igetc();
479
480 if(navail_bytes == IL_EOF) {
481 success = IL_FALSE;
482 return ending;
483 }
484
485 if (navail_bytes) {
486 for (i = 0; i < navail_bytes; i++) {
487 if((t = igetc()) == IL_EOF) {
488 success = IL_FALSE;
489 return ending;
490 }
491 byte_buff[i] = t;
492 }
493 }
494 }
495 b1 = *pbytes++;
496 nbits_left = 8;
497 navail_bytes--;
498 }
499
500 ret = b1 >> (8 - nbits_left);
501 while (curr_size > nbits_left) {
502 if (navail_bytes <= 0) {
503 pbytes = byte_buff;
504 navail_bytes = igetc();
505
506 if(navail_bytes == IL_EOF) {
507 success = IL_FALSE;
508 return ending;
509 }
510
511 if (navail_bytes) {
512 for (i = 0; i < navail_bytes; i++) {
513 if((t = igetc()) == IL_EOF) {
514 success = IL_FALSE;
515 return ending;
516 }
517 byte_buff[i] = t;
518 }
519 }
520 }
521 b1 = *pbytes++;
522 ret |= b1 << nbits_left;
523 nbits_left += 8;

Callers 1

GifGetDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected