sane-project-website/old-archive/2001-05/0189.html

141 wiersze
4.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: DBG(0, ...)</TITLE>
<META NAME="Author" CONTENT="Petter Reinholdtsen (pere@hungry.com)">
<META NAME="Subject" CONTENT="DBG(0, ...)">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>DBG(0, ...)</H1>
<!-- received="Mon May 14 01:01:08 2001" -->
<!-- isoreceived="20010514080108" -->
<!-- sent="Mon, 14 May 2001 10:16:35 +0200" -->
<!-- isosent="20010514081635" -->
<!-- name="Petter Reinholdtsen" -->
<!-- email="pere@hungry.com" -->
<!-- subject="DBG(0, ...)" -->
<!-- id="E14zDWt-0001kJ-00@minerva" -->
<STRONG>From:</STRONG> Petter Reinholdtsen (<A HREF="mailto:pere@hungry.com?Subject=Re:%20DBG(0,%20...)&In-Reply-To=&lt;E14zDWt-0001kJ-00@minerva&gt;"><EM>pere@hungry.com</EM></A>)<BR>
<STRONG>Date:</STRONG> Mon May 14 2001 - 01:16:35 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0190.html">Petter Reinholdtsen: "Re: [dev] Status of pnm.c-bad?"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0188.html">Micah Yoder: "Re: HP 5200C -- segfaults and &quot;inappropriate ioctl for device&quot;"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0192.html">Oliver Rauch: "Re: DBG(0, ...)"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0192.html">Oliver Rauch: "Re: DBG(0, ...)"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0196.html">Henning Meier-Geinitz: "Re: DBG(0, ...)"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#189">[ date ]</A>
<A HREF="index.html#189">[ thread ]</A>
<A HREF="subject.html#189">[ subject ]</A>
<A HREF="author.html#189">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
I believe there is a misfeature in the DBG() functions. Peter Fales
<BR>
pointed out to me that the following code in a backend
<BR>
<P>&nbsp;&nbsp;DBG(0, &quot;foo&quot;);
<BR>
<P>will print out &quot;foo&quot; even if SANE_DEBUG_BACKEND is not set. I believe
<BR>
this is wrong. I believe DBG() should not print anything unless
<BR>
debugging is enabled for that specific backend. I suggest applying
<BR>
this patch to fix it. Is there anything I haven't thought about?
<BR>
<P>The patch changes the default level to be (in practise, not in
<BR>
reality) -1, instead of the previous default level 0.
<BR>
<P>Index: sanei/sanei_init_debug.c
<BR>
===================================================================
<BR>
RCS file: /cvsroot/external/sane/sane-backends/sanei/sanei_init_debug.c,v
<BR>
retrieving revision 1.3
<BR>
diff -u -w -r1.3 sanei_init_debug.c
<BR>
--- sanei_init_debug.c 2000/10/23 14:59:57 1.3
<BR>
+++ sanei_init_debug.c 2001/05/14 08:14:53
<BR>
@@ -87,7 +87,7 @@
<BR>
&nbsp;&nbsp;&nbsp;if (!val)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
<BR>
&nbsp;
<BR>
- *var = atoi (val);
<BR>
+ *var = atoi (val) + 1;
<BR>
&nbsp;
<BR>
&nbsp;&nbsp;&nbsp;DBG (0, &quot;Setting debug level of %s to %d.\n&quot;, backend, *var);
<BR>
&nbsp;}
<BR>
@@ -98,7 +98,7 @@
<BR>
&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;char *msg;
<BR>
&nbsp;
<BR>
- if (max_level &gt;= level)
<BR>
+ if (max_level &gt;= level + 1)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( 1 == isfdtype(fileno(stderr), S_IFSOCK) )
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
<P><PRE>
--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20DBG(0,%20...)&In-Reply-To=&lt;E14zDWt-0001kJ-00@minerva&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0190.html">Petter Reinholdtsen: "Re: [dev] Status of pnm.c-bad?"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0188.html">Micah Yoder: "Re: HP 5200C -- segfaults and &quot;inappropriate ioctl for device&quot;"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0192.html">Oliver Rauch: "Re: DBG(0, ...)"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0192.html">Oliver Rauch: "Re: DBG(0, ...)"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0196.html">Henning Meier-Geinitz: "Re: DBG(0, ...)"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#189">[ date ]</A>
<A HREF="index.html#189">[ thread ]</A>
<A HREF="subject.html#189">[ subject ]</A>
<A HREF="author.html#189">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Mon May 14 2001 - 01:02:42 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>