/*
Usurp existing persistent pixel cache.
*/
- status=rename(cache_info->cache_filename,filename);
+ status=rename_utf8(cache_info->cache_filename,filename);
if (status == 0)
{
(void) CopyMagickString(cache_info->cache_filename,filename,
FILE
*file;
- int
- status;
-
WCHAR
*mode_wide,
*path_wide;
FILE
*file;
- int
- status;
-
WCHAR
*type_wide,
*command_wide;
#endif
}
+static inline int rename_utf8(const char *source,const char *destination)
+{
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
+ return(rename(source,destination));
+#else
+ FILE
+ *file;
+
+ int
+ status;
+
+ WCHAR
+ *destination_wide,
+ *source_wide;
+
+ source_wide=(WCHAR *) NULL;
+ count=MultiByteToWideChar(CP_UTF8,0,source,-1,NULL,0);
+ source_wide=(WCHAR *) AcquireQuantumMemory(count,sizeof(*source_wide));
+ if (source_wide == (WCHAR *) NULL)
+ return(-1);
+ count=MultiByteToWideChar(CP_UTF8,0,source,-1,source_wide,count);
+ count=MultiByteToWideChar(CP_UTF8,0,destination,-1,NULL,0);
+ destination_wide=(WCHAR *) AcquireQuantumMemory(count,
+ sizeof(*destination_wide));
+ if (destination_wide == (WCHAR *) NULL)
+ {
+ source_wide=RelinquishMagickMemory(source_wide);
+ return(-1);
+ }
+ count=MultiByteToWideChar(CP_UTF8,0,destination,-1,destination_wide,count);
+ status=_wrename(path_wide,destination_width);
+ destination_wide=RelinquishMagickMemory(destination_wide);
+ path_wide=RelinquishMagickMemory(path_wide);
+ return(status);
+#endif
+}
+
static inline int stat_utf8(const char *path,struct stat *attributes)
{
#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)