Parse the frame's extensions.
901{
902 enum {
903 GIF_EXT_INTRODUCER = 0x21,
904 GIF_EXT_GRAPHIC_CONTROL = 0xf9,
905 GIF_EXT_COMMENT = 0xfe,
906 GIF_EXT_PLAIN_TEXT = 0x01,
907 GIF_EXT_APPLICATION = 0xff,
908 };
911 int nsgif_bytes = nsgif_end - nsgif_data;
912
913
914 while (nsgif_bytes > 0 && nsgif_data[0] == GIF_EXT_INTRODUCER) {
915 bool block_step = true;
917
918 nsgif_data++;
919 nsgif_bytes--;
920
921 if (nsgif_bytes == 0) {
923 }
924
925
926 switch (nsgif_data[0]) {
927 case GIF_EXT_GRAPHIC_CONTROL:
928 if (decode) {
930 frame,
931 nsgif_data,
932 nsgif_bytes);
934 return ret;
935 }
936 }
937 break;
938
939 case GIF_EXT_APPLICATION:
940 if (decode) {
942 gif, nsgif_data, nsgif_bytes);
944 return ret;
945 }
946 }
947 break;
948
949 case GIF_EXT_COMMENT:
950
951
952 ++nsgif_data;
953 block_step = false;
954 break;
955
956 default:
957 break;
958 }
959
960 if (block_step) {
961
962
963
964
965 if (nsgif_bytes < 2) {
967 }
968 nsgif_data += 2 + nsgif_data[1];
969 }
970
971
972
974 nsgif_data += nsgif_data[0] + 1;
975 if (nsgif_data >= nsgif_end) {
977 }
978 }
979 nsgif_data++;
980 nsgif_bytes = nsgif_end - nsgif_data;
981 }
982
983 if (nsgif_data > nsgif_end) {
984 nsgif_data = nsgif_end;
985 }
986
987
990}
nsgif_error
LibNSGIF return codes.
@ NSGIF_ERR_END_OF_DATA
Unexpected end of GIF source data.
static nsgif_error nsgif__parse_extension_graphic_control(struct nsgif_frame *frame, const fl::u8 *data, fl::size len) FL_NOEXCEPT
Parse the graphic control extension.
static nsgif_error nsgif__parse_extension_application(struct nsgif *gif, const fl::u8 *data, fl::size len) FL_NOEXCEPT
Parse the application extension.
fl::size buf_len
total number of bytes of GIF data available
const fl::u8 * buf
pointer to GIF data
#define NSGIF_BLOCK_TERMINATOR