IMG_gif.c
changeset 586 19beb4a1bb54
parent 575 36e9e2255178
child 638 e3e9d7430674
equal deleted inserted replaced
585:170d7d32e4a8 586:19beb4a1bb54
   315     case 0xff:          /* Application Extension */
   315     case 0xff:          /* Application Extension */
   316     str = "Application Extension";
   316     str = "Application Extension";
   317     break;
   317     break;
   318     case 0xfe:          /* Comment Extension */
   318     case 0xfe:          /* Comment Extension */
   319     str = "Comment Extension";
   319     str = "Comment Extension";
   320     while (GetDataBlock(src, (unsigned char *) buf) != 0)
   320     while (GetDataBlock(src, (unsigned char *) buf) > 0)
   321         ;
   321         ;
   322     return FALSE;
   322     return FALSE;
   323     case 0xf9:          /* Graphic Control Extension */
   323     case 0xf9:          /* Graphic Control Extension */
   324     str = "Graphic Control Extension";
   324     str = "Graphic Control Extension";
   325     (void) GetDataBlock(src, (unsigned char *) buf);
   325     (void) GetDataBlock(src, (unsigned char *) buf);
   327     Gif89.inputFlag = (buf[0] >> 1) & 0x1;
   327     Gif89.inputFlag = (buf[0] >> 1) & 0x1;
   328     Gif89.delayTime = LM_to_uint(buf[1], buf[2]);
   328     Gif89.delayTime = LM_to_uint(buf[1], buf[2]);
   329     if ((buf[0] & 0x1) != 0)
   329     if ((buf[0] & 0x1) != 0)
   330         Gif89.transparent = buf[3];
   330         Gif89.transparent = buf[3];
   331 
   331 
   332     while (GetDataBlock(src, (unsigned char *) buf) != 0)
   332     while (GetDataBlock(src, (unsigned char *) buf) > 0)
   333         ;
   333         ;
   334     return FALSE;
   334     return FALSE;
   335     default:
   335     default:
   336     str = (char *)buf;
   336     str = (char *)buf;
   337     SDL_snprintf(str, 256, "UNKNOWN (0x%02x)", label);
   337     SDL_snprintf(str, 256, "UNKNOWN (0x%02x)", label);
   338     break;
   338     break;
   339     }
   339     }
   340 
   340 
   341     while (GetDataBlock(src, (unsigned char *) buf) != 0)
   341     while (GetDataBlock(src, (unsigned char *) buf) > 0)
   342     ;
   342     ;
   343 
   343 
   344     return FALSE;
   344     return FALSE;
   345 }
   345 }
   346 
   346 
   385         return -1;
   385         return -1;
   386     }
   386     }
   387     buf[0] = buf[last_byte - 2];
   387     buf[0] = buf[last_byte - 2];
   388     buf[1] = buf[last_byte - 1];
   388     buf[1] = buf[last_byte - 1];
   389 
   389 
   390     if ((count = GetDataBlock(src, &buf[2])) == 0)
   390     if ((count = GetDataBlock(src, &buf[2])) <= 0)
   391         done = TRUE;
   391         done = TRUE;
   392 
   392 
   393     last_byte = 2 + count;
   393     last_byte = 2 + count;
   394     curbit = (curbit - lastbit) + 16;
   394     curbit = (curbit - lastbit) + 16;
   395     lastbit = (2 + count) * 8;
   395     lastbit = (2 + count) * 8;