[sane-devel] [patch] fix SANE_Device

Henning Meier-Geinitz henning@meier-geinitz.de
Sun, 14 Nov 2004 13:17:04 +0100


Hi,

On Sun, Nov 14, 2004 at 12:14:10AM +0100, Oliver Rauch wrote:
> Please can you explain what error/warning the const produces on your
> system?

e.g.:
abaton.c: In function sane_abaton_exit':
abaton.c:902: warning: cast discards qualifiers from pointer target type
abaton.c:903: warning: cast discards qualifiers from pointer target type

That happens in other backends, too.

The code is:
      free ((void *) dev->sane.name);
      free ((void *) dev->sane.model);      

> So I think there is no need to add anything in the backend. It would be
> enough when the backend creates a non const string and makes the pointer
> in the struct point to the non const string - may be with a typecast,
> but I think the typecast is not necessary.

That's the work-around used in my backends to avoid the warnings. It
works, but I don't think it's really clean.
A cast doesn't seem to be necessary.

Bye,
  Henning