Would like some help fixing bug in TclMagick

Computer Jock <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.help
Organization Digital Liar
Message-ID <[email protected]>
I hope there is still some life to this project...

I've been trying to get TclMagick working on win7x64. Tcl's native image 
manipulation is almost non-existent and, while there are a few other 
extensions available (imgtools, tksvg, ...), none approach the 
capabilities of GraphicsMagick.

I've managed to compile and link (no thanks to libtool) using Msys2's 
64-bit MinGW gcc tool chain.

I've got one bug that I'd like some help fixing, but first of all here 
are some
of the issues I've fixed.

1) I had to replace unix/m4/tcl.m4 with a >much< more current version. I 
used this from the latest Tcl distribution: 
tcl8.6.6/pkgs/sqlite3.13.0/tclconfig/tcl.m4

I then had to rerun genconf.sh

2) I fixed two bugs (one remains):

--- GraphicsMagick-1.3.25/TclMagick/generic/TclMagick.c.orig  2016-09-05 
17:45:26.803926700 -0500
+++ GraphicsMagick-1.3.25/TclMagick/generic/TclMagick.c  2017-04-13 
23:47:43.006038500 -0500
@@ -146,7 +146,7 @@
       * create one from the MagickWand address
       */
      if( name == NULL ) {
-        sprintf(idString, "magick%lX", (unsigned long)wandPtr );
+        sprintf(idString, "magick%p", wandPtr );
          name = idString;
      }

@@ -449,7 +449,7 @@
                  "resourceType", 0, &resourceIdx) != TCL_OK) {
          return TCL_ERROR;
      }
-    if (objc == 3) {
+    if (objc == 4) {
          /*
           * Set channel depth
           */

3) The last (that I know of so far) occurs when there is an exception 
while using a wand. After reporting the error, the exception has to be 
cleared or the wand becomes unusable and constantly reports the same 
error message.

I dug out a really old archive I had from 2006. I had gotten TclMagick 
working on FreeBSD. [The above bugs, and this one, are still present 
today -- I guess that no one uses TclMagick].

In version 0.45 of TclMagick linking against ImageMagick 6.2.8, I added 
a call:

   MagickClearException(wandPtr);

This was at the end of MyMagickError() which now appears in TclMagick.h. 
Here's the code in TclMagick.h:

         :
     if( description != NULL ) {
         MagickRelinquishMemory(description);
     }
==> MagickClearException(wandPtr); <== this or equivalent needs to be added
     /*
      * if(severity < ErrorException) --> warning
      * return TCL_OK ???
      */
     return TCL_ERROR;
         :

There is no longer a MagickClearException() nor can I find an 
equivalent. WandPtr is an opaque pointer and there is no private header 
I can #include to define it. The actual wand structure is defined within 
wand/magick_wand.c. I had tried

     DestroyExceptionInfo(&wandPtr->exception);
     GetExceptionInfo(&wandPtr->exception);

but, of course, that fails since WandPtr is an opaque pointer.

I could just copy the declaration of struct _MagickWand but if there's 
an alternative I'd like to do things the "right" way.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.