Mercurial > hg > xemacs-beta
comparison src/dgif_lib.c @ 114:8619ce7e4c50 r20-1b9
Import from CVS: tag r20-1b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:21:54 +0200 |
parents | 54cc21c15cbb |
children | e292c9648bb9 |
comparison
equal
deleted
inserted
replaced
113:2ec2fe4a4c89 | 114:8619ce7e4c50 |
---|---|
913 int ImageSize; | 913 int ImageSize; |
914 GifRecordType RecordType; | 914 GifRecordType RecordType; |
915 SavedImage *sp; | 915 SavedImage *sp; |
916 ExtensionBlock *ep; | 916 ExtensionBlock *ep; |
917 GifByteType *ExtData; | 917 GifByteType *ExtData; |
918 int ExtCode; | |
918 | 919 |
919 /* Some versions of malloc dislike 0-length requests */ | 920 /* Some versions of malloc dislike 0-length requests */ |
920 GifFile->SavedImages = (SavedImage *)xmalloc(sizeof(SavedImage)); | 921 GifFile->SavedImages = (SavedImage *)xmalloc(sizeof(SavedImage)); |
921 | 922 |
922 do { | 923 do { |
939 return(GIF_ERROR); | 940 return(GIF_ERROR); |
940 | 941 |
941 break; | 942 break; |
942 | 943 |
943 case EXTENSION_RECORD_TYPE: | 944 case EXTENSION_RECORD_TYPE: |
944 | 945 /* This code fails if no image_desc record has been read |
946 yet. I don't know if that's legal, but I've seen GIFs | |
947 that start with an extension record. XEmacs doesn't use | |
948 the extension records anyway, so we'll just ignore them. | |
949 - dkindred@cs.cmu.edu */ | |
950 #if 0 | |
945 if (DGifGetExtension(GifFile,&sp->Function,&ExtData)==GIF_ERROR) | 951 if (DGifGetExtension(GifFile,&sp->Function,&ExtData)==GIF_ERROR) |
946 return(GIF_ERROR); | 952 return(GIF_ERROR); |
947 else | 953 else |
948 { | 954 { |
949 ep = &sp->ExtensionBlocks[sp->ExtensionBlockCount++]; | 955 ep = &sp->ExtensionBlocks[sp->ExtensionBlockCount++]; |
963 ep->ByteCount = ExtData[0]; | 969 ep->ByteCount = ExtData[0]; |
964 ep->Bytes = (GifByteType *)xmalloc(ep->ByteCount * sizeof(GifByteType)); | 970 ep->Bytes = (GifByteType *)xmalloc(ep->ByteCount * sizeof(GifByteType)); |
965 memcpy(ep->Bytes,ExtData,ep->ByteCount * sizeof(char)); | 971 memcpy(ep->Bytes,ExtData,ep->ByteCount * sizeof(char)); |
966 } | 972 } |
967 } | 973 } |
974 #else | |
975 /* Skip any extension blocks in the file. */ | |
976 if (DGifGetExtension (GifFile, &ExtCode, &ExtData) | |
977 == GIF_ERROR) | |
978 return GIF_ERROR; | |
979 | |
980 while (ExtData != NULL) { | |
981 if (DGifGetExtensionNext (GifFile, &ExtData) == GIF_ERROR) | |
982 return GIF_ERROR; | |
983 } | |
984 #endif | |
968 break; | 985 break; |
969 | 986 |
970 case TERMINATE_RECORD_TYPE: | 987 case TERMINATE_RECORD_TYPE: |
971 break; | 988 break; |
972 | 989 |