Page 1 of 1

Re: Unicode bug on Windows

Posted: 2008-09-13T07:22:37-07:00
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);
}