[prev in list] [next in list] [prev in thread] [next in thread] 

List:       graphicsmagick-commit
Subject:    [GM-commit] GraphicsMagick: Added new function GetBlobIsOpen(). SetImageAttr...
From:       GraphicsMagick Commits <graphicsmagick-commit () lists ! sourceforge ! net>
Date:       2012-06-03 16:19:15
Message-ID: hg.66c5296d01e7.1338740355.-1602079902 () blade ! simplesystems ! org
[Download RAW message or body]

changeset 66c5296d01e7 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=66c5296d01e7
                
summary: Added new function GetBlobIsOpen(). SetImageAttribute() does not translate \
comment and label string if blob is open.

diffstat:

 ChangeLog                              |  12 ++++++++++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 magick/attribute.c                     |  20 +++++++++++++-------
 magick/blob.c                          |  33 +++++++++++++++++++++++++++++++++
 magick/blob.h                          |   5 +++++
 magick/version.h                       |   4 ++--
 www/Changelog.html                     |  13 +++++++++++++
 www/api/attribute.html                 |   3 +++
 8 files changed, 83 insertions(+), 11 deletions(-)

diffs (180 lines):

diff -r a1f0802c146b -r 66c5296d01e7 ChangeLog
--- a/ChangeLog	Sat Jun 02 09:58:48 2012 -0500
+++ b/ChangeLog	Sun Jun 03 11:19:05 2012 -0500
@@ -1,3 +1,15 @@
+2012-06-03  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* magick/attribute.c (SetImageAttribute): Don't translate
+	'comment' and 'label' attributes if the request is made while a
+	file is being read.  This is a temporary workaround until there is
+	opportunity to modify the architecture so that there is a clear
+	split between user-provided settings and values obtained from the
+	input image.
+
+	* magick/blob.c (GetBlobIsOpen): New function to return if blob is
+	currently open.
+
 2012-06-02  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
 	* PerlMagick/typemap: Add typemap file needed by Perl 5.16.
diff -r a1f0802c146b -r 66c5296d01e7 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Sat Jun 02 09:58:48 2012 -0500
+++ b/VisualMagick/installer/inc/version.isx	Sun Jun 03 11:19:05 2012 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020120602"
-#define public MagickPackageReleaseDate "snapshot-20120602"
+#define public MagickPackageVersionAddendum ".020120603"
+#define public MagickPackageReleaseDate "snapshot-20120603"
diff -r a1f0802c146b -r 66c5296d01e7 magick/attribute.c
--- a/magick/attribute.c	Sat Jun 02 09:58:48 2012 -0500
+++ b/magick/attribute.c	Sun Jun 03 11:19:05 2012 -0500
@@ -2441,6 +2441,10 @@
 %  otherwise False.  If the value is NULL, the matching key is deleted
 %  from the list.
 %
+%  The 'comment' and 'label' attributes are treated specially in that
+%  embedded format specifications are translated according to the formatting
+%  rules of TranslateText().
+%
 %  The format of the SetImageAttribute method is:
 %
 %      unsigned int SetImageAttribute(Image *image,const char *key,
@@ -2503,18 +2507,20 @@
     return(MagickFail);
   attribute->key=AllocateString(key);
   attribute->length=0;
-  if ((LocaleNCompare(key,"comment",7) == 0) ||
-      (LocaleNCompare(key,"label",5) == 0))
+  if (!GetBlobIsOpen(image) &&
+      ((LocaleNCompare(key,"comment",7) == 0) ||
+       (LocaleNCompare(key,"label",5) == 0)))
     {
       /*
-        Translate format requests in attribute text.
+        Translate format requests in attribute text when the blob is
+        not open.
 
         This is really gross since it is assumed that the attribute is
         supplied by the user and the user intends for translation to
-        occur.  However, comment attributes may also come from an
-        image file and may contain arbitrary text.  There does not
-        seem to be any work-around which preserves the already defined
-        interface.
+        occur.  However, 'comment' and 'label' attributes may also
+        come from an image file and may contain arbitrary text.  As a
+        crude-workaround, translations are only performed when the
+        blob is not open.
       */
       attribute->value=TranslateText((ImageInfo *) NULL,image,value);
       if (attribute->value != (char *) NULL)
diff -r a1f0802c146b -r 66c5296d01e7 magick/blob.c
--- a/magick/blob.c	Sat Jun 02 09:58:48 2012 -0500
+++ b/magick/blob.c	Sun Jun 03 11:19:05 2012 -0500
@@ -1389,6 +1389,39 @@
 %                                                                             %
 %                                                                             %
 %                                                                             %
++  G e t B l o b I s O p e n                                                  %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  GetBlobIsOpen() returns MagickTrue if the blob is currently open or
+%  MagickFalse if it is currently closed.
+%
+%  The format of the GetBlobSize method is:
+%
+%      MagickBool GetBlobIsOpen(const Image *image)
+%
+%  A description of each parameter follows:
+%
+%    o image: The image.
+%
+%
+*/
+MagickExport MagickBool GetBlobIsOpen(const Image *image)
+{
+  assert(image != (Image *) NULL);
+  assert(image->signature == MagickSignature);
+  assert(image->blob != (BlobInfo *) NULL);
+
+  return (image->blob->type != UndefinedStream ? MagickTrue : MagickFalse);
+}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 +  G e t B l o b S i z e                                                      %
 %                                                                             %
 %                                                                             %
diff -r a1f0802c146b -r 66c5296d01e7 magick/blob.h
--- a/magick/blob.h	Sat Jun 02 09:58:48 2012 -0500
+++ b/magick/blob.h	Sun Jun 03 11:19:05 2012 -0500
@@ -194,6 +194,11 @@
   extern MagickExport int GetBlobStatus(const Image *image);
 
   /*
+    Test to see if blob is currently open.
+  */
+  extern MagickExport MagickBool GetBlobIsOpen(const Image *image);
+
+  /*
     Obtain the current size of the file or BLOB.  Zero is returned if
     the size can not be determined.  If BLOB is no longer open, then
     return the size when the BLOB was closed.
diff -r a1f0802c146b -r 66c5296d01e7 magick/version.h
--- a/magick/version.h	Sat Jun 02 09:58:48 2012 -0500
+++ b/magick/version.h	Sun Jun 03 11:19:05 2012 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x110800
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 11,8,0
-#define MagickChangeDate   "20120602"
-#define MagickReleaseDate  "snapshot-20120602"
+#define MagickChangeDate   "20120603"
+#define MagickReleaseDate  "snapshot-20120603"
 	
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r a1f0802c146b -r 66c5296d01e7 www/Changelog.html
--- a/www/Changelog.html	Sat Jun 02 09:58:48 2012 -0500
+++ b/www/Changelog.html	Sun Jun 03 11:19:05 2012 -0500
@@ -36,6 +36,19 @@
 <div class="document">
 
 
+<p>2012-06-03  Bob Friesenhahn  &lt;<a class="reference external" \
href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#6 \
4;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 +<blockquote>
+<ul class="simple">
+<li>magick/attribute.c (SetImageAttribute): Don't translate
+'comment' and 'label' attributes if the request is made while a
+file is being read.  This is a temporary workaround until there is
+opportunity to modify the architecture so that there is a clear
+split between user-provided settings and values obtained from the
+input image.</li>
+<li>magick/blob.c (GetBlobIsOpen): New function to return if blob is
+currently open.</li>
+</ul>
+</blockquote>
 <p>2012-06-02  Bob Friesenhahn  &lt;<a class="reference external" \
href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#6 \
4;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
  <blockquote>
 <ul class="simple">
diff -r a1f0802c146b -r 66c5296d01e7 www/api/attribute.html
--- a/www/api/attribute.html	Sat Jun 02 09:58:48 2012 -0500
+++ b/www/api/attribute.html	Sun Jun 03 11:19:05 2012 -0500
@@ -166,6 +166,9 @@
 True if the attribute is successfully concatenated or added to the list,
 otherwise False.  If the value is NULL, the matching key is deleted
 from the list.</p>
+<p>The 'comment' and 'label' attributes are treated specially in that
+embedded format specifications are translated according to the formatting
+rules of TranslateText().</p>
 <p>The format of the SetImageAttribute method is:</p>
 <pre class="literal-block">
 unsigned int SetImageAttribute( <a class="reference external" \
href="../api/types.html#image">Image</a> *image, const char *key, const char *value \
);

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Graphicsmagick-commit mailing list
Graphicsmagick-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic