| 100 | } |
| 101 | |
| 102 | static void |
| 103 | DoExtension(FILE *fd, int label) |
| 104 | { |
| 105 | static char buf[256]; |
| 106 | const char *str; |
| 107 | |
| 108 | switch (label) { |
| 109 | case 0x01: /* Plain Text Extension */ |
| 110 | str = "Plain Text Extension"; |
| 111 | #ifdef notdef |
| 112 | if (GetDataBlock(fd, (unsigned char *) buf) == 0) |
| 113 | ; |
| 114 | |
| 115 | lpos = LM_to_uint(buf[0], buf[1]); |
| 116 | tpos = LM_to_uint(buf[2], buf[3]); |
| 117 | width = LM_to_uint(buf[4], buf[5]); |
| 118 | height = LM_to_uint(buf[6], buf[7]); |
| 119 | cellw = buf[8]; |
| 120 | cellh = buf[9]; |
| 121 | foreground = buf[10]; |
| 122 | background = buf[11]; |
| 123 | |
| 124 | while (GetDataBlock(fd, (unsigned char *) buf) != 0) { |
| 125 | PPM_ASSIGN(image[ypos][xpos], cmap[CM_RED][v], cmap[CM_GREEN][v], |
| 126 | cmap[CM_BLUE][v]); |
| 127 | ++index; |
| 128 | } |
| 129 | |
| 130 | return; |
| 131 | #else |
| 132 | break; |
| 133 | #endif |
| 134 | case 0xff: /* Application Extension */ |
| 135 | str = "Application Extension"; |
| 136 | break; |
| 137 | case 0xfe: /* Comment Extension */ |
| 138 | str = "Comment Extension"; |
| 139 | while (GetDataBlock(fd, (unsigned char *) buf) != 0) { |
| 140 | Fprintf(stderr, "gif comment: %s\n", buf); |
| 141 | } |
| 142 | return; |
| 143 | case 0xf9: /* Graphic Control Extension */ |
| 144 | str = "Graphic Control Extension"; |
| 145 | (void) GetDataBlock(fd, (unsigned char *) buf); |
| 146 | Gif89.disposal = (buf[0] >> 2) & 0x7; |
| 147 | Gif89.inputFlag = (buf[0] >> 1) & 0x1; |
| 148 | Gif89.delayTime = LM_to_uint(buf[1], buf[2]); |
| 149 | if ((buf[0] & 0x1) != 0) |
| 150 | Gif89.transparent = buf[3]; |
| 151 | |
| 152 | while (GetDataBlock(fd, (unsigned char *) buf) != 0) |
| 153 | ; |
| 154 | return; |
| 155 | default: |
| 156 | str = buf; |
| 157 | Sprintf(buf, "UNKNOWN (0x%02x)", label); |
| 158 | break; |
| 159 | } |
no test coverage detected