diff --git a/coders/xbm.c b/coders/xbm.c index 7d15e7cc0..da1958ac4 100644 --- a/coders/xbm.c +++ b/coders/xbm.c @@ -266,14 +266,15 @@ static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception) { if (sscanf(buffer,"static short %1024s = {",name) == 1) version=10; + else if (sscanf(buffer,"static unsigned char %s = {",name) == 1) + version=11; + else if (sscanf(buffer,"static char %1024s = {",name) == 1) + version=11; else - if (sscanf(buffer,"static unsigned char %s = {",name) == 1) - version=11; - else - if (sscanf(buffer,"static char %1024s = {",name) == 1) - version=11; - else - continue; + { + offset=TellBlob(image); + continue; + } p=(unsigned char *) strrchr(name,'_'); if (p == (unsigned char *) NULL) p=(unsigned char *) name; @@ -281,10 +282,7 @@ static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception) p++; if (LocaleCompare("bits[]",(char *) p) == 0) break; - offset=TellBlob(image); } - if (strchr(buffer,'{') != (char *) NULL) - (void) SeekBlob(image,offset+(strchr(buffer,'{')-buffer)+1,SEEK_SET); /* Initialize image structure. */ @@ -310,6 +308,9 @@ static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception) InheritException(exception,&image->exception); return(DestroyImageList(image)); } + p=(unsigned char *) strrchr(buffer,'{'); + if (p != (unsigned char *) NULL) + (void) SeekBlob(image,offset+((char *) p-buffer)+1,SEEK_SET); /* Initialize hex values. */