sane-project-website/old-archive/1999-03/0252.html

73 wiersze
3.0 KiB
HTML
Czysty Wina Historia

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!-- received="Tue Mar 30 21:28:25 1999 PST" -->
<!-- sent="Mon, 29 Mar 1999 05:38:49 +0100 (BST)" -->
<!-- name="Nick Lamb" -->
<!-- email="njl98r@ecs.soton.ac.uk" -->
<!-- subject="Net backend bug [patch]" -->
<!-- id="" -->
<!-- inreplyto="" -->
<title>sane-devel: Net backend bug [patch]</title>
<h1>Net backend bug [patch]</h1>
<b>Nick Lamb</b> (<a href="mailto:njl98r@ecs.soton.ac.uk"><i>njl98r@ecs.soton.ac.uk</i></a>)<br>
<i>Mon, 29 Mar 1999 05:38:49 +0100 (BST)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#252">[ date ]</a><a href="index.html#252">[ thread ]</a><a href="subject.html#252">[ subject ]</a><a href="author.html#252">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0253.html">Oliver Rauch: "To Astra 6X0S users!"</a>
<li> <b>Previous message:</b> <a href="0251.html">Oliver Rauch: "TO UMAX Astra 6X0S users"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
I think I've found a bug in the net backend.<br>
It certainly doesn't conform to the current SANE standard (but IMHO the<br>
current standard document could be tightened up more)<br>
<p>
The SANE_TYPE_BUTTON doesn't have a corresponding size. Therefore it is<br>
wrong of the net backend to insist on doing things with this size, or<br>
manipulating value at all.<br>
<p>
This patch checks for SANE_TYPE_BUTTON, where previously the Net backend<br>
crashed for me. I cannot tell if this is the only place where the wrong<br>
assumption about SANE_TYPE_BUTTON is made. But I hope this patch can go<br>
into a future version of the SANE sample implementation.<br>
<p>
Nick.<br>
<p>
--- net.c.old Thu Oct 29 07:42:27 1998<br>
+++ net.c Mon Mar 29 05:13:50 1999<br>
@@ -697,11 +697,13 @@<br>
{<br>
if (info)<br>
*info = reply.info;<br>
- if (s-&gt;opt.desc[option]-&gt;size == reply.value_size)<br>
- memcpy (value, reply.value, reply.value_size);<br>
- else<br>
+ if (s-&gt;opt.desc[option]-&gt;type == SANE_TYPE_BUTTON)<br>
+ ; /* Do nothing -- buttons have no value */<br>
+ else if (s-&gt;opt.desc[option]-&gt;size != reply.value_size)<br>
DBG(1, "control_option: size changed from %d to %d\n",<br>
s-&gt;opt.desc[option]-&gt;size, reply.value_size);<br>
+ else<br>
+ memcpy (value, reply.value, reply.value_size);<br>
<br>
if (reply.info &amp; SANE_INFO_RELOAD_OPTIONS)<br>
s-&gt;options_valid = 0;<br>
<p>
<p>
<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">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0253.html">Oliver Rauch: "To Astra 6X0S users!"</a>
<li> <b>Previous message:</b> <a href="0251.html">Oliver Rauch: "TO UMAX Astra 6X0S users"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>