[sane-devel] [niash] Fix unused-but-set-variable compiler warning

Olaf Meeuwissen paddy-hack at member.fsf.org
Mon Sep 19 03:47:57 UTC 2016


On 2016-08-28, Olaf Meeuwissen wrote:

> Hi Gerhard,
>
> The startBlackX variable in SimpleClibExt() from niash_core.c is flagged
> as set but unused by gcc on my debian-8-full build.  I was going to just
> remove it but wondered if it ought to be used.

I removed it in fb0464d and pushed that just now.

> Specifically, I wondered
> if it would be needed in the loop that starts at niash_core.c:1301.
>
>>  for (i = 0; i < endBlackY - startBlackY + 1; i++)
>>    {
>>      CircBufferGetLine (iHandle, &DataPipe, abLine, iReversedHead);
>>      for (j = 0; j < endBlackX; j++)
>>	{
>>	  bMinR = MIN (abLine[j * 3 + 0], bMinR);
>>	  bMinG = MIN (abLine[j * 3 + 1], bMinG);
>>	  bMinB = MIN (abLine[j * 3 + 2], bMinB);
>>	}
>>    }
>
> Should the initialization of j use startBlackX?  For hp scanners the
> startBlackX variable is set to 0 but for agfa scanner to 1666.

Hope this helps,
-- 
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join




More information about the sane-devel mailing list