]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Sat, 2 Jun 2018 21:41:03 +0000 (17:41 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 2 Jun 2018 21:41:03 +0000 (17:41 -0400)
MagickCore/draw.c
coders/tiff.c
configure
configure.ac
version.sh

index ee74688ab65cdc16f61e92ab5da79c445a199f45..900c4cff4d6479dce0f456e2c55745c557afb010 100644 (file)
@@ -79,6 +79,7 @@
 #include "MagickCore/resample.h"
 #include "MagickCore/resample-private.h"
 #include "MagickCore/resource_.h"
+#include "MagickCore/splay-tree.h"
 #include "MagickCore/string_.h"
 #include "MagickCore/string-private.h"
 #include "MagickCore/thread-private.h"
@@ -182,9 +183,6 @@ typedef struct _PathInfo
 /*
   Forward declarations.
 */
-static char
-  *GetNodeByURL(const char *,const char *);
-
 static Image
   *DrawClippingMask(Image *,const DrawInfo *,const char *,const char *,
     ExceptionInfo *);
@@ -2234,86 +2232,93 @@ static MagickBooleanType CheckPrimitiveExtent(MVGInfo *mvg_info,
   return(MagickTrue);
 }
 
-static char *GetNodeByURL(const char *primitive,const char *url)
+static SplayTreeInfo *GetMVGMacros(const char *primitive)
 {
   char
-    *node;
+    *token;
 
   const char
-    *q,
-    *start;
+    *q;
 
   register const char
     *p;
 
   size_t
-    extent,
-    length;
+    extent;
 
-  ssize_t
-    n;
+  SplayTreeInfo
+    *macros;
 
   /*
-    Find and return node by ID.
+    Scan graphic primitives for definitions and classes.
   */
   if (primitive == (const char *) NULL)
-    return((char *) NULL);
-  node=AcquireString(primitive);
-  extent=strlen(node)+MagickPathExtent;
-  length=0;
-  n=0;
-  start=(const char *) NULL;
+    return((SplayTreeInfo *) NULL);
+  macros=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
+    RelinquishMagickMemory);
+  token=AcquireString(primitive);
+  extent=strlen(token)+MagickPathExtent;
   p=(const char *) NULL;
-  for (q=primitive; (*q != '\0') && (length == 0); )
+  for (q=primitive; *q != '\0'; )
   {
-    p=q;
-    GetNextToken(q,&q,extent,node);
-    if (*node == '\0')
+    GetNextToken(q,&q,extent,token);
+    if (*token == '\0')
       break;
-    if (*node == '#')
+    if (*token == '#')
       {
         /*
-          Comment.
+          Skip comment.
         */
         while ((*q != '\n') && (*q != '\0'))
           q++;
         continue;
       }
-    if (LocaleCompare("pop",node) == 0)
+    p=q-strlen(token)-1;
+    if (LocaleCompare("push",token) == 0)
       {
-        GetNextToken(q,&q,extent,node);
-        if ((n == 0) && (start != (const char *) NULL))
-          {
-            /*
-              End of node by ID.
-            */
-            length=(size_t) (p-start+1);
-            break;
-          }
-        n--;
-      }
-    if (LocaleCompare("push",node) == 0)
-      {
-        GetNextToken(q,&q,extent,node);
-        n++;
+        GetNextToken(q,&q,extent,token);
         if (*q == '"')
           {
-            GetNextToken(q,&q,extent,node);
-            if (LocaleCompare(url,node) == 0)
-              {
-                /*
-                  Start of node by ID.
-                */
-                n=0;
-                start=q;
-              }
+            char
+              name[MagickPathExtent];
+
+            const char
+              *r;
+
+            ssize_t
+             n;
+
+            GetNextToken(q,&q,extent,token);
+            (void) CopyMagickString(name,token,MagickPathExtent);
+            n=0;
+            for (r=q; *q != '\0'; )
+            {
+              GetNextToken(r,&r,extent,token);
+              if (LocaleCompare(token,"pop") == 0)
+                n--;
+              if (LocaleCompare(token,"push") == 0)
+                n++;
+              if (n < 0)
+                {
+                  char
+                    *macro;
+
+                  /*
+                    Extract definition or class.
+                  */
+                  GetNextToken(r,&r,extent,token);
+                  macro=AcquireString(p);
+                  macro[r-p]='\0';
+                  (void) AddValueToSplayTree(macros,ConstantString(name),
+                    ConstantString(macro));
+                  macro=DestroyString(macro);
+                  break;
+                }
+            }
           }
       }
   }
-  if (start == (const char *) NULL)
-    return(DestroyString(node));
-  (void) CopyMagickString(node,start,length);
-  return(node);
+  return(macros);
 }
 
 static inline MagickBooleanType IsPoint(const char *point)
@@ -2398,6 +2403,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
     number_points,
     number_stops;
 
+  SplayTreeInfo
+    *macros;
+
   ssize_t
     defsDepth,
     j,
@@ -2482,6 +2490,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
   extent=strlen(token)+MagickPathExtent;
   defsDepth=0;
   symbolDepth=0;
+  macros=GetMVGMacros(primitive);
   status=MagickTrue;
   for (q=primitive; *q != '\0'; )
   {
@@ -2585,8 +2594,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
       {
         if (LocaleCompare("class",keyword) == 0)
           {
-            char
-              *node;
+            const char
+              *macro;
 
             GetNextToken(q,&q,extent,token);
             if (*token == '\0')
@@ -2594,8 +2603,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                 status=MagickFalse;
                 break;
               }
-            node=GetNodeByURL(primitive,token);
-            if (node != (char *) NULL)
+            macro=(const char *) GetValueFromSplayTree(macros,token);
+            if (macro != (const char *) NULL)
               {
                 char
                   *elements;
@@ -2609,8 +2618,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                 offset=(ssize_t) (p-primitive);
                 elements=AcquireString(primitive);
                 elements[offset]='\0';
-                (void) ConcatenateString(&elements,node);
-                node=DestroyString(node);
+                (void) ConcatenateString(&elements,macro);
                 (void) ConcatenateString(&elements,"\n");
                 (void) ConcatenateString(&elements,q);
                 primitive=DestroyString(primitive);
@@ -2621,7 +2629,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
           }
         if (LocaleCompare("clip-path",keyword) == 0)
           {
-            char
+            const char
               *clip_path;
 
             /*
@@ -2634,8 +2642,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                 break;
               }
             (void) CloneString(&graphic_context[n]->clip_mask,token);
-            clip_path=GetNodeByURL(primitive,graphic_context[n]->clip_mask);
-            if (clip_path != (char *) NULL)
+            clip_path=(const char *) GetValueFromSplayTree(macros,
+              graphic_context[n]->clip_mask);
+            if (clip_path != (const char *) NULL)
               {
                 if (graphic_context[n]->clipping_mask != (Image *) NULL)
                   graphic_context[n]->clipping_mask=
@@ -2643,7 +2652,6 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                 graphic_context[n]->clipping_mask=DrawClippingMask(image,
                   graphic_context[n],graphic_context[n]->clip_mask,clip_path,
                   exception);
-                clip_path=DestroyString(clip_path);
                 if (draw_info->compliance != SVGCompliance)
                   (void) DrawClipPath(image,graphic_context[n],
                     graphic_context[n]->clip_mask,exception);
@@ -2993,14 +3001,14 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
       {
         if (LocaleCompare("mask",keyword) == 0)
           {
-            char
+            const char
               *mask_path;
 
             /*
               Take a node from within the MVG document, and duplicate it here.
             */
             GetNextToken(q,&q,extent,token);
-            mask_path=GetNodeByURL(primitive,token);
+            mask_path=(const char *) GetValueFromSplayTree(macros,token);
             if (mask_path != (char *) NULL)
               {
                 if (graphic_context[n]->composite_mask != (Image *) NULL)
@@ -3008,7 +3016,6 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                     DestroyImage(graphic_context[n]->composite_mask);
                 graphic_context[n]->composite_mask=DrawCompositeMask(image,
                   graphic_context[n],token,mask_path,exception);
-                mask_path=DestroyString(mask_path);
                 if (draw_info->compliance != SVGCompliance)
                   status=SetImageMask(image,CompositePixelMask,
                     graphic_context[n]->composite_mask,exception);
@@ -3146,17 +3153,16 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
             if (LocaleCompare("clip-path",token) == 0)
               {
                 char
-                  *clip_path,
                   name[MaxTextExtent];
 
+                const char
+                  *clip_path;
+
                 GetNextToken(q,&q,extent,token);
                 (void) FormatLocaleString(name,MaxTextExtent,"%s",token);
-                clip_path=GetNodeByURL(primitive,name);
+                clip_path=(const char *) GetValueFromSplayTree(macros,name);
                 if (clip_path != (char *) NULL)
-                  {
-                    (void) SetImageArtifact(image,name,clip_path);
-                    clip_path=DestroyString(clip_path);
-                  }
+                  (void) SetImageArtifact(image,name,clip_path);
                 break;
               }
             if (LocaleCompare("defs",token) == 0)
@@ -3674,22 +3680,21 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
       {
         if (LocaleCompare("use",keyword) == 0)
           {
-            char
-              *node;
+            const char
+              *macro;
 
             /*
-              Get a node from the MVG document, and "use" it here.
+              Get a macro from the MVG document, and "use" it here.
             */
             GetNextToken(q,&q,extent,token);
-            node=GetNodeByURL(primitive,token);
-            if (node != (char *) NULL)
+            macro=(const char *) GetValueFromSplayTree(macros,token);
+            if (macro != (char *) NULL)
               {
                 DrawInfo
                   *clone_info;
 
                 clone_info=CloneDrawInfo((ImageInfo *) NULL,graphic_context[n]);
-                (void) CloneString(&clone_info->primitive,node);
-                node=DestroyString(node);
+                (void) CloneString(&clone_info->primitive,macro);
                 status=DrawImage(image,clone_info,exception);
                 clone_info=DestroyDrawInfo(clone_info);
               }
@@ -4214,6 +4219,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
   /*
     Relinquish resources.
   */
+  macros=DestroySplayTree(macros);
   token=DestroyString(token);
   if (primitive_info != (PrimitiveInfo *) NULL)
     primitive_info=(PrimitiveInfo *) RelinquishMagickMemory(primitive_info);
index 9c55a176c4b0228d270d25e5525c80adee61169b..f08209dcb55f800dac843237c131a4092b58dfe0 100644 (file)
@@ -1811,7 +1811,7 @@ RestoreMSCWarning
           register Quantum
             *magick_restrict q;
 
-         tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels);
+          tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels);
           if (tiff_status == -1)
             break;
           q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
index 61bf7dc0c942b8f9ddb47361ef0115f427c93e07..88e3bd041d95a07f5909da2d4f2fbf35488d92db 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ImageMagick 7.0.7-38.
+# Generated by GNU Autoconf 2.69 for ImageMagick 7.0.7-39.
 #
 # Report bugs to <https://github.com/ImageMagick/ImageMagick/issues>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ImageMagick'
 PACKAGE_TARNAME='ImageMagick'
-PACKAGE_VERSION='7.0.7-38'
-PACKAGE_STRING='ImageMagick 7.0.7-38'
+PACKAGE_VERSION='7.0.7-39'
+PACKAGE_STRING='ImageMagick 7.0.7-39'
 PACKAGE_BUGREPORT='https://github.com/ImageMagick/ImageMagick/issues'
 PACKAGE_URL='https://www.imagemagick.org'
 
@@ -1841,7 +1841,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ImageMagick 7.0.7-38 to adapt to many kinds of systems.
+\`configure' configures ImageMagick 7.0.7-39 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1916,7 +1916,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ImageMagick 7.0.7-38:";;
+     short | recursive ) echo "Configuration of ImageMagick 7.0.7-39:";;
    esac
   cat <<\_ACEOF
 
@@ -2203,7 +2203,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ImageMagick configure 7.0.7-38
+ImageMagick configure 7.0.7-39
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -3254,7 +3254,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ImageMagick $as_me 7.0.7-38, which was
+It was created by ImageMagick $as_me 7.0.7-39, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4240,7 +4240,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ImageMagick'
- VERSION='7.0.7-38'
+ VERSION='7.0.7-39'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4550,11 +4550,11 @@ MAGICK_MINOR_VERSION=0
 
 MAGICK_MICRO_VERSION=7
 
-MAGICK_PATCHLEVEL_VERSION=38
+MAGICK_PATCHLEVEL_VERSION=39
 
-MAGICK_VERSION=7.0.7-38
+MAGICK_VERSION=7.0.7-39
 
-MAGICK_GIT_REVISION=14394:3696d9306:20180530
+MAGICK_GIT_REVISION=14410:9b377c1c9:20180602
 
 
 # Substitute library versioning
@@ -37715,7 +37715,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ImageMagick $as_me 7.0.7-38, which was
+This file was extended by ImageMagick $as_me 7.0.7-39, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -37782,7 +37782,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ImageMagick config.status 7.0.7-38
+ImageMagick config.status 7.0.7-39
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 7c253a57990a7e912a9275f6915fb4c2183b0525..ca749a727a04673c41a3d62256c8d0f4f5611129 100644 (file)
@@ -27,7 +27,7 @@ AC_PREREQ(2.69)
 m4_define([magick_major_version], [7])
 m4_define([magick_minor_version], [0])
 m4_define([magick_micro_version], [7])
-m4_define([magick_patchlevel_version], [38])
+m4_define([magick_patchlevel_version], [39])
 m4_define([magick_version],
           [magick_major_version.magick_minor_version.magick_micro_version-magick_patchlevel_version])
 m4_define([magick_git_revision], esyscmd([sh -c "(gitversion.sh .) | awk '{ print \$1 }' | tr -d '\n'"]))
index bb6b0f73e9f4552ecd656d9312b6b44fd6ac0618..c03032e1c26df11f30cb89c9df502e2589b5011c 100644 (file)
@@ -19,7 +19,7 @@ PACKAGE_CHANGE_DATE=`awk '/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/ { print
 PACKAGE_VERSION='7.0.7'
 PACKAGE_PERL_VERSION='7.07'
 PACKAGE_LIB_VERSION="0x707"
-PACKAGE_RELEASE="38"
+PACKAGE_RELEASE="39"
 PACKAGE_LIB_VERSION_NUMBER="7,0,7,${PACKAGE_RELEASE}"
 PACKAGE_RELEASE_DATE_RAW=`date +%F`
 PACKAGE_RELEASE_DATE_REPRODUCIBLE="${PACKAGE_CHANGE_DATE}"