This is a quick account of what I have found so far:

Using #define NDEBUG in hpijs uncovered two errors, one cosmetic and one
that might not be cosmetic at all.

For the first bug, see the attached patch.  One could also use ul_MapPtr
instead of mapptr a few lines below, keeping the other ul_*MapPtr variables,
and just never defining mapptr if NDEBUG is set.

For the second bug, HeaderLJJetReady::MapPCLMediaTypeToString in file
prnt/hpijs/ljjetready.cpp, around line 476, must be fixed.  It has to init
"err" with a sane value, that default: clause with an empty assert doesn't
cut it.  I don't know enough to decide between using NO_ERROR, SYSTEM_ERROR
or whatever.

I have also a report of what looks like a double-free in the hpaio sane
backend (hplip 0.9.7, but the bug forwarded to me just a few days ago, see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=366475 for more
information). 

Is valgrind being used to weed out potential problems in hplip and hpijs?
Like pychecker and pylint, it is an extremely useful tool, that should be
used every once in a while (as it is probably too expensive to run the full
printer compatibility testing under valgrind, unless HP can spare an
extremely fast amd64 box for you guys :P ).

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
Index: prnt/hpijs/colormatch.cpp
===================================================================
RCS file: /cvsroot/pkg-hpijs/hplip/prnt/hpijs/colormatch.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 colormatch.cpp
--- prnt/hpijs/colormatch.cpp   4 Dec 2004 00:47:54 -0000       1.1.1.1
+++ prnt/hpijs/colormatch.cpp   10 May 2006 23:08:50 -0000
@@ -221,15 +221,21 @@
 {
     for (unsigned int r = 0; r < 9; r++)
     {
+#ifndef NDEBUG
         unsigned long ul_RedMapPtr = r * 9 * 9;
+#endif
         for (unsigned int g = 0; g < 9; g++)
         {
+#ifndef NDEBUG
             unsigned long ul_GreenMapPtr = g * 9;
+#endif
             for (unsigned int b = 0; b < 9; b++)
             {
                 unsigned long mapptr = b + (g * 9) + (r * 9 * 9);       // get 
address in map
+#ifndef NDEBUG
                 unsigned long ul_MapPtr = b + ul_GreenMapPtr + ul_RedMapPtr;
                 ASSERT(mapptr == ul_MapPtr);
+#endif
                 // put r,g,b in monitor range
                 unsigned int oldR = r * 255 >> 3;
                 unsigned int oldG = g * 255 >> 3;

Reply via email to