Unicode bug on Windows

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unicode bug on Windows

Post by magick »

The stat() method returns file path attributes without opening the file. We added a robust method to ImageMagick 6.4.2-7 beta to resolve this problem. Inside magick/utility.c we include:

Code: Select all

MagickExport MagickBooleanType MagickStreamStatus(const char *path,
  struct stat *attributes)
{
  MagickBooleanType
    status;

  if (path == (const char *) NULL)
    {
      errno=EINVAL;
      return(MagickFalse);
    }
#if !defined(MAGICKCORE_HAVE__WFOPEN)
  status=stat(path,attributes) == 0 ? MagickTrue : MagickFalse;
#else
  {
    wchar_t
      *unicode_path;

    unicode_path=ConvertUTF8ToUTF16(path);
    if (unicode_path == (wchar_t *) NULL)
      return((FILE *) NULL);
    status=stat(unicode_path,attributes)== 0 ? MagickTrue : MagickFalse;
    unicode_path=(wchar_t *) RelinquishMagickMemory(unicode_path);
  }
#endif  return(status);
}
Post Reply