]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 23 Sep 2011 14:40:37 +0000 (14:40 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 23 Sep 2011 14:40:37 +0000 (14:40 +0000)
18 files changed:
MagickCore/blob.c
MagickCore/cache.c
MagickCore/delegate.c
MagickCore/display.c
MagickCore/log.c
MagickCore/random.c
MagickCore/resource.c
MagickCore/string.c
MagickCore/utility-private.h
MagickCore/utility.c
MagickCore/utility.h
MagickWand/convert.c
MagickWand/mogrify.c
coders/cut.c
coders/mat.c
coders/mpeg.c
coders/sfw.c
coders/wpg.c

index d6923d11e696fa370a0a2865d9f390de0f26e984..d5ceec4b7561dcbb6c3bafce56686bde4caf8276 100644 (file)
@@ -251,7 +251,7 @@ MagickExport MagickBooleanType BlobToFile(char *filename,const void *blob,
   if (*filename == '\0')
     file=AcquireUniqueFileResource(filename);
   else
-    file=open(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);
+    file=open_utf8(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);
   if (file == -1)
     {
       ThrowFileException(exception,BlobError,"UnableToWriteBlob",filename);
@@ -921,7 +921,7 @@ MagickExport unsigned char *FileToBlob(const char *filename,const size_t extent,
   *length=0;
   file=fileno(stdin);
   if (LocaleCompare(filename,"-") != 0)
-    file=open(filename,O_RDONLY | O_BINARY);
+    file=open_utf8(filename,O_RDONLY | O_BINARY,0);
   if (file == -1)
     {
       ThrowFileException(exception,BlobError,"UnableToOpenFile",filename);
@@ -1110,7 +1110,7 @@ MagickExport MagickBooleanType FileToImage(Image *image,const char *filename)
   assert(image->signature == MagickSignature);
   assert(filename != (const char *) NULL);
   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
-  file=open(filename,O_RDONLY | O_BINARY);
+  file=open_utf8(filename,O_RDONLY | O_BINARY,0);
   if (file == -1)
     {
       ThrowFileException(&image->exception,BlobError,"UnableToOpenBlob",
@@ -1617,7 +1617,7 @@ MagickExport MagickBooleanType ImageToFile(Image *image,char *filename,
     if (LocaleCompare(filename,"-") == 0)
       file=fileno(stdout);
     else
-      file=open(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);
+      file=open_utf8(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);
   if (file == -1)
     {
       ThrowFileException(exception,BlobError,"UnableToWriteBlob",filename);
@@ -1926,7 +1926,7 @@ MagickExport MagickBooleanType InjectImageBlob(const ImageInfo *image_info,
   /*
     Inject into image stream.
   */
-  file=open(filename,O_RDONLY | O_BINARY);
+  file=open_utf8(filename,O_RDONLY | O_BINARY,0);
   if (file == -1)
     {
       (void) RelinquishUniqueFileResource(filename);
@@ -2391,7 +2391,7 @@ MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,
 #endif
       *mode=(*type);
       mode[1]='\0';
-      image->blob->file=(FILE *) popen(filename+1,mode);
+      image->blob->file=(FILE *) popen_utf8(filename+1,mode);
       if (image->blob->file == (FILE *) NULL)
         {
           ThrowFileException(exception,BlobError,"UnableToOpenBlob",filename);
@@ -2406,7 +2406,7 @@ MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,
 #if defined(S_ISFIFO)
   if ((status == MagickTrue) && S_ISFIFO(image->blob->properties.st_mode))
     {
-      image->blob->file=(FILE *) OpenMagickStream(filename,type);
+      image->blob->file=(FILE *) fopen_utf8(filename,type);
       if (image->blob->file == (FILE *) NULL)
         {
           ThrowFileException(exception,BlobError,"UnableToOpenBlob",filename);
@@ -2459,7 +2459,7 @@ MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,
   else
     if (*type == 'r')
       {
-        image->blob->file=(FILE *) OpenMagickStream(filename,type);
+        image->blob->file=(FILE *) fopen_utf8(filename,type);
         if (image->blob->file != (FILE *) NULL)
           {
             size_t
@@ -2567,7 +2567,7 @@ MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,
           else
 #endif
             {
-              image->blob->file=(FILE *) OpenMagickStream(filename,type);
+              image->blob->file=(FILE *) fopen_utf8(filename,type);
               if (image->blob->file != (FILE *) NULL)
                 {
                   image->blob->type=FileStream;
index 2cb73ff50d188bf57ba57a6e7a2ba374bf967464..8f02a6dca3785f573879d1fe8bbe914442db5c2f 100644 (file)
@@ -642,24 +642,24 @@ static MagickBooleanType OpenPixelCacheOnDisk(CacheInfo *cache_info,
     {
       case ReadMode:
       {
-        file=open(cache_info->cache_filename,O_RDONLY | O_BINARY);
+        file=open_utf8(cache_info->cache_filename,O_RDONLY | O_BINARY,0);
         break;
       }
       case WriteMode:
       {
-        file=open(cache_info->cache_filename,O_WRONLY | O_CREAT | O_BINARY |
-          O_EXCL,S_MODE);
+        file=open_utf8(cache_info->cache_filename,O_WRONLY | O_CREAT |
+          O_BINARY | O_EXCL,S_MODE);
         if (file == -1)
-          file=open(cache_info->cache_filename,O_WRONLY | O_BINARY,S_MODE);
+          file=open_utf8(cache_info->cache_filename,O_WRONLY | O_BINARY,S_MODE);
         break;
       }
       case IOMode:
       default:
       {
-        file=open(cache_info->cache_filename,O_RDWR | O_CREAT | O_BINARY |
+        file=open_utf8(cache_info->cache_filename,O_RDWR | O_CREAT | O_BINARY |
           O_EXCL,S_MODE);
         if (file == -1)
-          file=open(cache_info->cache_filename,O_RDWR | O_BINARY,S_MODE);
+          file=open_utf8(cache_info->cache_filename,O_RDWR | O_BINARY,S_MODE);
         break;
       }
     }
index a775a60b9baad0043d4f28ad4c1279f43d51db6a..92f68a45dfd8ba1b504d1777c799cd25161f1018 100644 (file)
@@ -793,10 +793,10 @@ static MagickBooleanType CopyDelegateFile(const char *source,
   /*
     Copy source file to destination.
   */
-  destination_file=open(destination,O_WRONLY | O_BINARY | O_CREAT,S_MODE);
+  destination_file=open_utf8(destination,O_WRONLY | O_BINARY | O_CREAT,S_MODE);
   if (destination_file == -1)
     return(MagickFalse);
-  source_file=open(source,O_RDONLY | O_BINARY);
+  source_file=open_utf8(source,O_RDONLY | O_BINARY,0);
   if (source_file == -1)
     {
       (void) close(destination_file);
index 1837e734ace9c78af22c1b4b4d7bac543a53a9e6..ac6a95313d2ab187f55cb6431cec8ee3a6f1218f 100644 (file)
@@ -7252,7 +7252,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XFileBrowserWidget(display,windows,"Delete",filename);
       if (*filename == '\0')
         break;
-      status=remove(filename) != 0 ? MagickTrue : MagickFalse;
+      status=remove_utf8(filename) != 0 ? MagickTrue : MagickFalse;
       if (status != MagickFalse)
         XNoticeWidget(display,windows,"Unable to delete image file:",filename);
       break;
@@ -13187,7 +13187,7 @@ static Image *XTileImage(Display *display,XResourceInfo *resource_info,
       status=XConfirmWidget(display,windows,"Really delete tile",filename);
       if (status <= 0)
         break;
-      status=remove(filename) != 0 ? MagickTrue : MagickFalse;
+      status=remove_utf8(filename) != 0 ? MagickTrue : MagickFalse;
       if (status != MagickFalse)
         {
           XNoticeWidget(display,windows,"Unable to delete image file:",
index f5f2cb96d603fda03380ab4bc7fb41047519ed51..9e259ee1eceab579cec9fa4dc961deecbae0da9a 100644 (file)
@@ -1199,7 +1199,7 @@ MagickBooleanType LogMagickEventList(const LogEventType type,const char *module,
               return(MagickFalse);
             }
           log_info->append=IsPathAccessible(filename);
-          log_info->file=OpenMagickStream(filename,"ab");
+          log_info->file=fopen_utf8(filename,"ab");
           filename=(char  *) RelinquishMagickMemory(filename);
           if (log_info->file == (FILE *) NULL)
             {
index f518bb1933bed122e26a99463b7a868fd0e96569..81f52bc141b45e4927634389cef978b0b369f2a4 100644 (file)
@@ -60,6 +60,7 @@
 #include "MagickCore/thread_.h"
 #include "MagickCore/thread-private.h"
 #include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
 /*
   Define declarations.
 */
@@ -455,7 +456,7 @@ static StringInfo *GenerateEntropicChaos(RandomInfo *random_info)
 #endif
     if (file != -1)
       (void) close(file);
-    (void) remove(filename);
+    (void) remove_utf8(filename);
     SetStringInfoLength(chaos,strlen(filename));
     SetStringInfoDatum(chaos,(unsigned char *) filename);
     ConcatenateStringInfo(entropy,chaos);
@@ -528,7 +529,7 @@ static StringInfo *GenerateEntropicChaos(RandomInfo *random_info)
     filename=AcquireString("/dev/urandom");
     device=StringToStringInfo(filename);
     device=DestroyStringInfo(device);
-    file=open(filename,O_RDONLY | O_BINARY);
+    file=open_utf8(filename,O_RDONLY | O_BINARY,0);
     filename=DestroyString(filename);
     if (file != -1)
       {
@@ -546,14 +547,14 @@ static StringInfo *GenerateEntropicChaos(RandomInfo *random_info)
         filename=AcquireString("/dev/random");
         device=StringToStringInfo(filename);
         device=DestroyStringInfo(device);
-        file=open(filename,O_RDONLY | O_BINARY);
+        file=open_utf8(filename,O_RDONLY | O_BINARY,0);
         filename=DestroyString(filename);
         if (file == -1)
           {
             filename=AcquireString("/dev/srandom");
             device=StringToStringInfo(filename);
             device=DestroyStringInfo(device);
-            file=open(filename,O_RDONLY | O_BINARY);
+            file=open_utf8(filename,O_RDONLY | O_BINARY,0);
           }
         if (file != -1)
           {
index 278d7e9262976b6a29384780cc9ffc33d764e8e1..982936ef24edd2247057d1bc26594d34c553db3b 100644 (file)
@@ -301,7 +301,7 @@ MagickPrivate void AsynchronousResourceComponentTerminus(void)
   path=(const char *) GetNextKeyInSplayTree(temporary_resources);
   while (path != (const char *) NULL)
   {
-    (void) remove(path);
+    (void) remove_utf8(path);
     path=(const char *) GetNextKeyInSplayTree(temporary_resources);
   }
 }
@@ -333,7 +333,7 @@ MagickPrivate void AsynchronousResourceComponentTerminus(void)
 
 static void *DestroyTemporaryResources(void *temporary_resource)
 {
-  (void) remove((char *) temporary_resource);
+  (void) remove_utf8((char *) temporary_resource);
   temporary_resource=DestroyString((char *) temporary_resource);
   return((void *) NULL);
 }
@@ -474,7 +474,7 @@ MagickExport int AcquireUniqueFileResource(char *path)
       *p++=portable_filename[c];
     }
     key=DestroyStringInfo(key);
-    file=open(path,O_RDWR | O_CREAT | O_EXCL | O_BINARY | O_NOFOLLOW,S_MODE);
+    file=open_utf8(path,O_RDWR | O_CREAT | O_EXCL | O_BINARY | O_NOFOLLOW,S_MODE);
     if ((file >= 0) || (errno != EEXIST))
       break;
   }
@@ -863,8 +863,8 @@ MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
     }
   (void) CopyMagickString(cache_path,path,MaxTextExtent);
   AppendImageFormat("cache",cache_path);
-  (void) remove(cache_path);
-  return(remove(path) == 0 ? MagickTrue : MagickFalse);
+  (void) remove_utf8(cache_path);
+  return(remove_utf8(path) == 0 ? MagickTrue : MagickFalse);
 }
 \f
 /*
index 4bf2925cd8aabe5e4d4a92b2e3f9cfc0898063a1..3cf6d42ca13e777c8dc5d4f88ac7f33a685f4a99 100644 (file)
@@ -52,6 +52,7 @@
 #include "MagickCore/resource_.h"
 #include "MagickCore/signature-private.h"
 #include "MagickCore/string_.h"
+#include "MagickCore/utility-private.h"
 \f
 /*
   Static declarations.
@@ -584,7 +585,7 @@ MagickPrivate StringInfo *ConfigureFileToStringInfo(const char *filename)
     *map;
 
   assert(filename != (const char *) NULL);
-  file=open(filename,O_RDONLY | O_BINARY);
+  file=open_utf8(filename,O_RDONLY | O_BINARY,0);
   if (file == -1)
     return((StringInfo *) NULL);
   offset=(MagickOffsetType) lseek(file,0,SEEK_END);
index 2848fb1ce2dd2b416154cbcf87ff06a30d52d9e4..5f5886fe0134596aed79ad148a8c857ce0eac66d 100644 (file)
@@ -125,6 +125,42 @@ static inline int open_utf8(const char *path,int flags,int mode)
 #endif
 }
 
+static inline FILE *popen_utf8(const char *command,const char *type)
+{
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
+  return(fopen(command,type));
+#else
+   FILE
+     *file;
+
+   int
+     status;
+
+   WCHAR
+     *type_wide,
+     *command_wide;
+
+   command_wide=(WCHAR *) NULL;
+   count=MultiByteToWideChar(CP_UTF8,0,command,-1,NULL,0);
+   command_wide=(WCHAR *) AcquireQuantumMemory(count,sizeof(*command_wide));
+   if (command_wide == (WCHAR *) NULL)
+     return(-1);
+   count=MultiByteToWideChar(CP_UTF8,0,command,-1,command_wide,count);
+   count=MultiByteToWideChar(CP_UTF8,0,type,-1,NULL,0);
+   type_wide=(WCHAR *) AcquireQuantumMemory(count,sizeof(*type_wide));
+   if (type_wide == (WCHAR *) NULL)
+     {
+       command_wide=RelinquishMagickMemory(command_wide);
+       return(-1);
+     }
+   count=MultiByteToWideChar(CP_UTF8,0,type,-1,type_wide,count);
+   file=_wpopen(path_wide,type_width);
+   type_wide=RelinquishMagickMemory(type_wide);
+   path_wide=RelinquishMagickMemory(path_wide);
+   return(file);
+#endif
+}
+
 static inline int remove_utf8(const char *path)
 {
 #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
index db38e3498ee39b30aff671854fde5158f796b78b..44594bdf36e4e206b8f5fae0e5804308c6862278 100644 (file)
@@ -200,7 +200,7 @@ MagickExport MagickBooleanType AcquireUniqueSymbolicLink(const char *source,
   destination_file=AcquireUniqueFileResource(destination);
   if (destination_file == -1)
     return(MagickFalse);
-  source_file=open(source,O_RDONLY | O_BINARY);
+  source_file=open_utf8(source,O_RDONLY | O_BINARY,0);
   if (source_file == -1)
     {
       (void) close(destination_file);
@@ -1106,124 +1106,6 @@ MagickPrivate ssize_t GetMagickPageSize(void)
 %   o  attributes: the path attributes are returned here.
 %
 */
-
-#if defined(MAGICKCORE_HAVE__WFOPEN)
-static size_t UTF8ToUTF16(const unsigned char *utf8,wchar_t *utf16)
-{
-  register const unsigned char
-    *p;
-
-  if (utf16 != (wchar_t *) NULL)
-    {
-      register wchar_t
-        *q;
-
-      wchar_t
-        c;
-
-      /*
-        Convert UTF-8 to UTF-16.
-      */
-      q=utf16;
-      for (p=utf8; *p != '\0'; p++)
-      {
-        if ((*p & 0x80) == 0)
-          *q=(*p);
-        else
-          if ((*p & 0xE0) == 0xC0)
-            {
-              c=(*p);
-              *q=(c & 0x1F) << 6;
-              p++;
-              if ((*p & 0xC0) != 0x80)
-                return(0);
-              *q|=(*p & 0x3F);
-            }
-          else
-            if ((*p & 0xF0) == 0xE0)
-              {
-                c=(*p);
-                *q=c << 12;
-                p++;
-                if ((*p & 0xC0) != 0x80)
-                  return(0);
-                c=(*p);
-                *q|=(c & 0x3F) << 6;
-                p++;
-                if ((*p & 0xC0) != 0x80)
-                  return(0);
-                *q|=(*p & 0x3F);
-              }
-            else
-              return(0);
-        q++;
-      }
-      *q++='\0';
-      return(q-utf16);
-    }
-  /*
-    Compute UTF-16 string length.
-  */
-  for (p=utf8; *p != '\0'; p++)
-  {
-    if ((*p & 0x80) == 0)
-      ;
-    else
-      if ((*p & 0xE0) == 0xC0)
-        {
-          p++;
-          if ((*p & 0xC0) != 0x80)
-            return(0);
-        }
-      else
-        if ((*p & 0xF0) == 0xE0)
-          {
-            p++;
-            if ((*p & 0xC0) != 0x80)
-              return(0);
-            p++;
-            if ((*p & 0xC0) != 0x80)
-              return(0);
-         }
-       else
-         return(0);
-  }
-  return(p-utf8);
-}
-
-static wchar_t *ConvertUTF8ToUTF16(const unsigned char *source)
-{
-  size_t
-    length;
-
-  wchar_t
-    *utf16;
-
-  length=UTF8ToUTF16(source,(wchar_t *) NULL);
-  if (length == 0)
-    {
-      register ssize_t
-        i;
-
-      /*
-        Not UTF-8, just copy.
-      */
-      length=strlen((const char *) source);
-      utf16=(wchar_t *) AcquireQuantumMemory(length+1,sizeof(*utf16));
-      if (utf16 == (wchar_t *) NULL)
-        return((wchar_t *) NULL);
-      for (i=0; i <= (ssize_t) length; i++)
-        utf16[i]=source[i];
-      return(utf16);
-    }
-  utf16=(wchar_t *) AcquireQuantumMemory(length+1,sizeof(*utf16));
-  if (utf16 == (wchar_t *) NULL)
-    return((wchar_t *) NULL);
-  length=UTF8ToUTF16(source,utf16);
-  return(utf16);
-}
-#endif
-
 MagickExport MagickBooleanType GetPathAttributes(const char *path,
   void *attributes)
 {
@@ -1235,21 +1117,8 @@ MagickExport MagickBooleanType GetPathAttributes(const char *path,
       errno=EINVAL;
       return(MagickFalse);
     }
-#if !defined(MAGICKCORE_HAVE__WSTAT)
-  status=stat(path,(struct stat *) attributes) == 0 ? MagickTrue : MagickFalse;
-#else
-  {
-    wchar_t
-      *unicode_path;
-
-    unicode_path=ConvertUTF8ToUTF16((const unsigned char *) path);
-    if (unicode_path == (wchar_t *) NULL)
-      return(MagickFalse);
-    status=wstat(unicode_path,(struct stat *) attributes) == 0 ? MagickTrue :
-      MagickFalse;
-    unicode_path=(wchar_t *) RelinquishMagickMemory(unicode_path);
-  }
-#endif
+  status=stat_utf8(path,(struct stat *) attributes) == 0 ? MagickTrue :
+    MagickFalse;
   return(status);
 }
 \f
@@ -1532,7 +1401,7 @@ MagickExport MagickBooleanType IsPathAccessible(const char *path)
     return(status);
   if (S_ISREG(attributes.st_mode) == 0)
     return(MagickFalse);
-  if (access(path,F_OK) != 0)
+  if (access_utf8(path,F_OK) != 0)
     return(MagickFalse);
   return(MagickTrue);
 }
@@ -1894,67 +1763,6 @@ MagickExport size_t MultilineCensus(const char *label)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   O p e n M a g i c k S t r e a m                                           %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  OpenMagickStream() opens the file at the specified path and return the
-%  associated stream.
-%
-%  The path of the OpenMagickStream method is:
-%
-%      FILE *OpenMagickStream(const char *path,const char *mode)
-%
-%  A description of each parameter follows.
-%
-%   o  path: the file path.
-%
-%   o  mode: the file mode.
-%
-*/
-MagickExport FILE *OpenMagickStream(const char *path,const char *mode)
-{
-  FILE
-    *file;
-
-  if ((path == (const char *) NULL) || (mode == (const char *) NULL))
-    {
-      errno=EINVAL;
-      return((FILE *) NULL);
-    }
-  file=(FILE *) NULL;
-#if defined(MAGICKCORE_HAVE__WFOPEN)
-  {
-    wchar_t
-      *unicode_mode,
-      *unicode_path;
-
-    unicode_path=ConvertUTF8ToUTF16((const unsigned char *) path);
-    if (unicode_path == (wchar_t *) NULL)
-      return((FILE *) NULL);
-    unicode_mode=ConvertUTF8ToUTF16((const unsigned char *) mode);
-    if (unicode_mode == (wchar_t *) NULL)
-      {
-        unicode_path=(wchar_t *) RelinquishMagickMemory(unicode_path);
-        return((FILE *) NULL);
-      }
-    file=_wfopen(unicode_path,unicode_mode);
-    unicode_mode=(wchar_t *) RelinquishMagickMemory(unicode_mode);
-    unicode_path=(wchar_t *) RelinquishMagickMemory(unicode_path);
-  }
-#endif
-  if (file == (FILE *) NULL)
-    file=fopen(path,mode);
-  return(file);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
 %   S y s t e m C o m m a n d                                                 %
 %                                                                             %
 %                                                                             %
index e22a721ccb22754c689896418eb0ab231ede4408..7b102d8d0e9b0e669e866f73a7c000b2e8b1427a 100644 (file)
@@ -38,9 +38,6 @@ typedef enum
 extern MagickExport char
   *Base64Encode(const unsigned char *,const size_t,size_t *);
 
-extern MagickExport FILE
-  *OpenMagickStream(const char *,const char *);
-
 extern MagickExport int
   SystemCommand(const MagickBooleanType,const MagickBooleanType,const char *,
     ExceptionInfo *);
index 8f5c9a974b133075aeee6b69a1fab435c5fa18dd..44655487b37449193668c863b4dd402e88648980 100644 (file)
@@ -46,6 +46,7 @@
 #include "MagickWand/MagickWand.h"
 #include "MagickWand/mogrify-private.h"
 #include "MagickCore/string-private.h"
+#include "MagickCore/utility-private.h"
 /*
   Define declarations.
 */
@@ -110,7 +111,7 @@ static MagickBooleanType ConcatenateImages(int argc,char **argv,
   /*
     Open output file.
   */
-  output=OpenMagickStream(argv[argc-1],"wb");
+  output=fopen_utf8(argv[argc-1],"wb");
   if (output == (FILE *) NULL)
     {
       ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
@@ -119,13 +120,13 @@ static MagickBooleanType ConcatenateImages(int argc,char **argv,
     }
   for (i=2; i < (ssize_t) (argc-1); i++)
   {
-    input=OpenMagickStream(argv[i],"rb");
+    input=fopen_utf8(argv[i],"rb");
     if (input == (FILE *) NULL)
       ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[i]);
     for (c=fgetc(input); c != EOF; c=fgetc(input))
       (void) fputc((char) c,output);
     (void) fclose(input);
-    (void) remove(argv[i]);
+    (void) remove_utf8(argv[i]);
   }
   (void) fclose(output);
   return(MagickTrue);
index 5ed3161a8680ca8891699ad4042182c92ef36f8d..0167c379053f8375c9a5fc5b6d29c34fa698689e 100644 (file)
@@ -53,6 +53,7 @@
 #include "MagickCore/monitor-private.h"
 #include "MagickCore/thread-private.h"
 #include "MagickCore/string-private.h"
+#include "MagickCore/utility-private.h"
 \f
 /*
  Constant declaration.
@@ -334,7 +335,7 @@ static MagickBooleanType IsPathWritable(const char *path)
 {
   if (IsPathAccessible(path) == MagickFalse)
     return(MagickFalse);
-  if (access(path,W_OK) != 0)
+  if (access_utf8(path,W_OK) != 0)
     return(MagickFalse);
   return(MagickTrue);
 }
@@ -3744,7 +3745,7 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info,
         image_info->synchronize=MagickTrue;
         status&=WriteImages(image_info,image,image->filename,exception);
         if ((status == MagickFalse) && (*backup_filename != '\0'))
-          (void) remove(backup_filename);
+          (void) remove_utf8(backup_filename);
         RemoveAllImageStack();
         continue;
       }
index 046766b8ff994aefdbbfcc392e1c8b185c11b769..2b7b93474e3adbd68ac013ba0c90987494dc36a7 100644 (file)
@@ -69,6 +69,7 @@
 #include "MagickCore/string_.h"
 #include "MagickCore/module.h"
 #include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
 \f
 typedef struct
 {
@@ -400,14 +401,14 @@ static Image *ReadCUTImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
   (void) CopyMagickString(clone_info->filename+i,".PAL",(size_t)
     (MaxTextExtent-i));
-  if((clone_info->file=OpenMagickStream(clone_info->filename,"rb"))==NULL)
+  if((clone_info->file=fopen_utf8(clone_info->filename,"rb"))==NULL)
     {
       (void) CopyMagickString(clone_info->filename+i,".pal",(size_t)
         (MaxTextExtent-i));
-      if((clone_info->file=OpenMagickStream(clone_info->filename,"rb"))==NULL)
+      if((clone_info->file=fopen_utf8(clone_info->filename,"rb"))==NULL)
         {
           clone_info->filename[i]='\0';
-          if((clone_info->file=OpenMagickStream(clone_info->filename,"rb"))==NULL)
+          if((clone_info->file=fopen_utf8(clone_info->filename,"rb"))==NULL)
             {
               clone_info=DestroyImageInfo(clone_info);
               clone_info=NULL;
index 46fcf626dd1c5298cfc08f7ce9bdf3ca96166528..65559927290764f14c0248dd6253b72d267aa44b 100644 (file)
@@ -74,6 +74,7 @@
 #include "MagickCore/string_.h"
 #include "MagickCore/module.h"
 #include "MagickCore/transform.h"
+#include "MagickCore/utility-private.h"
 #if defined(MAGICKCORE_ZLIB_DELEGATE)
  #include "zlib.h"
 #endif
@@ -494,7 +495,7 @@ int status;
   {
     fclose(clone_info->file);
     clone_info->file = NULL;
-    (void) unlink(clone_info->filename);
+    (void) remove_utf8(clone_info->filename);
   }
 
   CacheBlock = AcquireQuantumMemory((size_t)((Size<16384)?Size:16384),sizeof(unsigned char *));
@@ -558,7 +559,7 @@ EraseFile:
     fclose(clone_info->file);
     clone_info->file = NULL;
 UnlinkFile:
-    (void) unlink(clone_info->filename);
+    (void) remove_utf8(clone_info->filename);
     return NULL; 
   }
 
@@ -998,7 +999,7 @@ done_reading:
     {
             fclose(clone_info->file);
             clone_info->file = NULL;
-            (void) unlink(clone_info->filename);
+            (void) remove_utf8(clone_info->filename);
     }
         }    
       }
@@ -1054,7 +1055,7 @@ done_reading:
     {
       fclose(clone_info->file);
       clone_info->file = NULL;
-      (void) unlink(clone_info->filename);
+      (void) remove_utf8(clone_info->filename);
     }
     DestroyImageInfo(clone_info);
     clone_info = NULL;
index 1f347685b246809ed274853e915fab4daf836714..be44a923cafa395466aa0de4af59078d88bdeb62 100644 (file)
@@ -60,6 +60,7 @@
 #include "MagickCore/module.h"
 #include "MagickCore/transform.h"
 #include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
 \f
 /*
   Forward declarations.
@@ -417,10 +418,10 @@ static MagickBooleanType CopyDelegateFile(const char *source,
   /*
     Copy source file to destination.
   */
-  destination_file=open(destination,O_WRONLY | O_BINARY | O_CREAT,S_MODE);
+  destination_file=open_utf8(destination,O_WRONLY | O_BINARY | O_CREAT,S_MODE);
   if (destination_file == -1)
     return(MagickFalse);
-  source_file=open(source,O_RDONLY | O_BINARY);
+  source_file=open_utf8(source,O_RDONLY | O_BINARY,0);
   if (source_file == -1)
     {
       (void) close(destination_file);
index 46e6b6b998ce0f4d969f66d003f8435640f92dda..9db762bea9884fe400fa3e9f52ca895ec5fae358 100644 (file)
@@ -57,6 +57,7 @@
 #include "MagickCore/module.h"
 #include "MagickCore/transform.h"
 #include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -301,7 +302,7 @@ static Image *ReadSFWImage(const ImageInfo *image_info,ExceptionInfo *exception)
   file=(FILE *) NULL;
   unique_file=AcquireUniqueFileResource(read_info->filename);
   if (unique_file != -1)
-    file=OpenMagickStream(read_info->filename,"wb");
+    file=fopen_utf8(read_info->filename,"wb");
   if ((unique_file == -1) || (file == (FILE *) NULL))
     {
       buffer=(unsigned char *) RelinquishMagickMemory(buffer);
@@ -325,7 +326,7 @@ static Image *ReadSFWImage(const ImageInfo *image_info,ExceptionInfo *exception)
       char
         *message;
 
-      (void) remove(read_info->filename);
+      (void) remove_utf8(read_info->filename);
       read_info=DestroyImageInfo(read_info);
       message=GetExceptionMessage(errno);
       (void) ThrowMagickException(&image->exception,GetMagickModule(),
index 322702e5fb25394bc7c7194d12687cad118d3b5c..5fde906dd9a0c21652ade7139dc4a8ce14330ef3 100644 (file)
@@ -63,6 +63,7 @@
 #include "MagickCore/module.h"
 #include "MagickCore/transform.h"
 #include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
 \f
 typedef struct
    {
@@ -743,7 +744,7 @@ static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,
 
   /* Obtain temporary file */
   AcquireUniqueFilename(postscript_file);
-  ps_file=OpenMagickStream(postscript_file,"wb");
+  ps_file=fopen_utf8(postscript_file,"wb");
   if (ps_file == (FILE *) NULL)
     goto FINISH;