Page 1 of 1

loop never executes

Posted: 2010-02-20T12:19:58-07:00
by el_supremo
While trying to figure out how delegates work, I ran across this code in image.c/SetImageInfo():

Code: Select all

      /*
        Look for explicit image formats.
      */
      format_type=UndefinedFormatType;
      i=0;
      while ((format_type != UndefinedFormatType) &&
             (format_type_formats[i] != (char *) NULL))
      {
        if ((*magic == *format_type_formats[i]) &&
            (LocaleCompare(magic,format_type_formats[i]) == 0))
          format_type=ExplicitFormatType;
        i++;
      }
Since format_type is initialized to UndefinedFormatType, the first test in the while statement will immediately fail and the loop will never be executed.
I presume the first line of the while statement should be:

Code: Select all

      while ((format_type == UndefinedFormatType) &&
Pete

Re: loop never executes

Posted: 2010-02-20T12:26:09-07:00
by magick
We can reproduce the problem you reported and have a patch in ImageMagick 6.5.9-9 by sometime tomorrow. Thanks.