]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 30 May 2015 17:20:38 +0000 (17:20 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 30 May 2015 17:20:38 +0000 (17:20 +0000)
MagickCore/blob.h
MagickCore/cache.c
MagickCore/magick-baseconfig.h
MagickCore/studio.h
MagickCore/version.h
MagickWand/studio.h
config/config.h.in
configure
configure.ac

index 1f507304a194b1dc4f30c069a03255c92dec2a50..3d48aa016c95f708a8fd64ec9ca380783e4d5a8a 100644 (file)
@@ -25,7 +25,7 @@
 extern "C" {
 #endif
 
-#define MagickMaxBufferExtent  (32*8192)
+#define MagickMaxBufferExtent  8192
 
 typedef enum
 {
index 56bffc805f9c2adb3205198620f40c23b88ea4b1..5c2ae6a77fa8e2ff02cea64e08681adc9a7e6f43 100644 (file)
@@ -119,6 +119,7 @@ static MagickBooleanType
   GetOneVirtualPixelFromCache(const Image *,const VirtualPixelMethod,
     const ssize_t,const ssize_t,Quantum *,ExceptionInfo *),
   OpenPixelCache(Image *,const MapMode,ExceptionInfo *),
+  OpenPixelCacheOnDisk(CacheInfo *,const MapMode),
   ReadPixelCachePixels(CacheInfo *restrict,NexusInfo *restrict,ExceptionInfo *),
   ReadPixelCacheMetacontent(CacheInfo *restrict,NexusInfo *restrict,
     ExceptionInfo *),
@@ -472,6 +473,53 @@ MagickPrivate void ClonePixelCacheMethods(Cache clone,const Cache cache)
 %
 */
 
+static MagickBooleanType ClonePixelCacheOnDisk(CacheInfo *restrict cache_info,
+  CacheInfo *restrict clone_info,ExceptionInfo *exception)
+{
+  MagickSizeType
+    extent;
+
+  ssize_t
+    count;
+
+  unsigned char
+    buffer[MagickMaxBufferExtent];
+
+  /*
+    Clone pixel cache on disk with identifcal morphology.
+  */
+  if ((OpenPixelCacheOnDisk(cache_info,ReadMode) == MagickFalse) ||
+      (OpenPixelCacheOnDisk(clone_info,IOMode) == MagickFalse))
+    return(MagickFalse);
+#if defined(MAGICKCORE_HAVE_SENDFILE)
+  if (cache_info->length == (MagickSizeType) ((ssize_t) cache_info->length))
+    {
+      off_t
+        offset;
+
+      offset=0;
+      count=sendfile(clone_info->file,cache_info->file,&offset,
+        (size_t) cache_info->length);
+      if (count == (ssize_t) cache_info->length)
+        return(MagickTrue);
+    }
+#endif
+  extent=0;
+  while ((count=read(cache_info->file,buffer,sizeof(buffer))) > 0)
+  { 
+    ssize_t
+      number_bytes;
+    
+    number_bytes=write(clone_info->file,buffer,(size_t) count);
+    if (number_bytes != count)
+      break;
+    extent+=number_bytes;
+  }
+  if (extent != cache_info->length)
+    return(MagickFalse);
+  return(MagickTrue);
+}
+
 static MagickBooleanType ClonePixelCacheRepository(
   CacheInfo *restrict clone_info,CacheInfo *restrict cache_info,
   ExceptionInfo *exception)
@@ -502,23 +550,36 @@ static MagickBooleanType ClonePixelCacheRepository(
   if (cache_info->type == PingCache)
     return(MagickTrue);
   length=cache_info->number_channels*sizeof(*cache_info->channel_map);
-  if (((cache_info->type == MemoryCache) || (cache_info->type == MapCache)) &&
-      ((clone_info->type == MemoryCache) || (clone_info->type == MapCache)) &&
-      (cache_info->columns == clone_info->columns) &&
+  if ((cache_info->columns == clone_info->columns) &&
       (cache_info->rows == clone_info->rows) &&
       (cache_info->number_channels == clone_info->number_channels) &&
       (memcmp(cache_info->channel_map,clone_info->channel_map,length) == 0) &&
       (cache_info->metacontent_extent == clone_info->metacontent_extent))
     {
-      (void) memcpy(clone_info->pixels,cache_info->pixels,cache_info->columns*
-        cache_info->number_channels*cache_info->rows*
-        sizeof(*cache_info->pixels));
-      if ((cache_info->metacontent_extent != 0) &&
-          (clone_info->metacontent_extent != 0))
-        (void) memcpy(clone_info->metacontent,cache_info->metacontent,
-          cache_info->columns*cache_info->rows*clone_info->metacontent_extent*
-          sizeof(unsigned char));
-      return(MagickTrue);
+      /*
+        Identical pixel cache morphology.
+      */
+      if (((cache_info->type == MemoryCache) ||
+           (cache_info->type == MapCache)) &&
+          ((clone_info->type == MemoryCache) ||
+           (clone_info->type == MapCache)))
+        {
+          (void) memcpy(clone_info->pixels,cache_info->pixels,
+            cache_info->columns*cache_info->number_channels*cache_info->rows*
+            sizeof(*cache_info->pixels));
+          if ((cache_info->metacontent_extent != 0) &&
+              (clone_info->metacontent_extent != 0))
+            (void) memcpy(clone_info->metacontent,cache_info->metacontent,
+              cache_info->columns*cache_info->rows*
+              clone_info->metacontent_extent*sizeof(unsigned char));
+          return(MagickTrue);
+        }
+      if ((cache_info->type == DiskCache) && (cache_info->type == DiskCache))
+        {
+          status=ClonePixelCacheOnDisk(cache_info,clone_info,exception);
+          if (status != MagickFalse)
+            return(status);
+        }
     }
   /*
     Mismatched pixel cache morphology.
@@ -3144,8 +3205,8 @@ static MagickBooleanType OpenPixelCacheOnDisk(CacheInfo *cache_info,
   /*
     Open pixel cache on disk.
   */
-  if (cache_info->file != -1)
-    return(MagickTrue);  /* cache already open */
+  if ((cache_info->file != -1) && (cache_info->mode == mode))
+    return(MagickTrue);  /* cache already open and in the proper mode */
   if (*cache_info->cache_filename == '\0')
     file=AcquireUniqueFileResource(cache_info->cache_filename);
   else
@@ -3177,6 +3238,8 @@ static MagickBooleanType OpenPixelCacheOnDisk(CacheInfo *cache_info,
   if (file == -1)
     return(MagickFalse);
   (void) AcquireMagickResource(FileResource,1);
+  if (cache_info->file != -1)
+    (void) ClosePixelCacheOnDisk(cache_info);
   cache_info->file=file;
   cache_info->mode=mode;
   return(MagickTrue);
index 4bd3feaeecfddebec2f83a55be953f3e0aedb8fd..507e73ecd741a4dcf14c608dd575f2e827c569f1 100644 (file)
 #define MAGICKCORE_HAVE_SYS_SELECT_H 1
 #endif
 
+/* Define to 1 if you have the <sys/sendfile.h> header file. */
+#ifndef MAGICKCORE_HAVE_SYS_SENDFILE_H
+#define MAGICKCORE_HAVE_SYS_SENDFILE_H 1
+#endif
+
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #ifndef MAGICKCORE_HAVE_SYS_SOCKET_H
 #define MAGICKCORE_HAVE_SYS_SOCKET_H 1
index 6905a11faa31546b36faefa14abf1908f915efd0..46b243fb265e88e31a203cf1790cde264f44d425 100644 (file)
@@ -210,6 +210,9 @@ extern int vsnprintf(char *,size_t,const char *,va_list);
 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
 #  include <sys/mman.h>
 # endif
+# if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
+#  include <sys/sendfile.h>
+# endif
 #endif
 #else
 # include <types.h>
index 5b97bfc0c2772707711eb21e862b147087a3a106..db8ef5e7a46bfea19c705810d5cfc642705e3024 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
 */
 #define MagickPackageName "ImageMagick"
 #define MagickCopyright  "Copyright (C) 1999-2015 ImageMagick Studio LLC"
-#define MagickSVNRevision  "18670:18677M"
+#define MagickSVNRevision  "18670:18682M"
 #define MagickLibVersion  0x700
 #define MagickLibVersionText  "7.0.0"
 #define MagickLibVersionNumber  0,0,0
index 7bf0aa3a1262e43f13c6366008041edc7e624bba..3cd4e2226440a19ddb63925dc3136405748e0da8 100644 (file)
@@ -213,6 +213,9 @@ extern int vsnprintf(char *,size_t,const char *,va_list);
 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
 #  include <sys/mman.h>
 # endif
+# if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
+#  include <sys/sendfile.h>
+# endif
 #endif
 #else
 # include <types.h>
index 97c28883e800b9221253e2f9ac67ee077a3e1cb3..c43f91bcb4a18046f298b0d2e98929e8346eadda 100644 (file)
 /* Define to 1 if you have the <sys/select.h> header file. */
 #undef HAVE_SYS_SELECT_H
 
+/* Define to 1 if you have the <sys/sendfile.h> header file. */
+#undef HAVE_SYS_SENDFILE_H
+
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #undef HAVE_SYS_SOCKET_H
 
index 1b2fe7ea146eff773048f75131c0ebe76d9bfba0..7769c3c0e1c91da74ebc6d76740f916f643e3f97 100755 (executable)
--- a/configure
+++ b/configure
@@ -4341,7 +4341,7 @@ MAGICK_PATCHLEVEL_VERSION=0
 
 MAGICK_VERSION=7.0.0-0
 
-MAGICK_SVN_REVISION=18670:18677M
+MAGICK_SVN_REVISION=18670:18682M
 
 
 # Substitute library versioning
@@ -22371,7 +22371,7 @@ fi
 
 
 # Check additional headers
-for ac_header in arm/limits.h arpa/inet.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h netinet/in.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/socket.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h wchar.h xlocale.h
+for ac_header in arm/limits.h arpa/inet.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h netinet/in.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/sendfile.h sys/socket.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h wchar.h xlocale.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
index 5d74c1dbbcf68523c84f353a56f4efff9fed7eb6..e94ab491df2c3c6f56fd74762e881eac6ffe0ab8 100755 (executable)
@@ -924,7 +924,7 @@ AC_HEADER_ASSERT
 AC_HEADER_DIRENT
 
 # Check additional headers
-AC_CHECK_HEADERS(arm/limits.h arpa/inet.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h netinet/in.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/socket.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h wchar.h xlocale.h)
+AC_CHECK_HEADERS(arm/limits.h arpa/inet.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h netinet/in.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/sendfile.h sys/socket.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h wchar.h xlocale.h)
 
 ########
 #