[sane-devel] hs2p backend
jazz_johnson at verizon.net
jazz_johnson at verizon.net
Mon Nov 19 06:19:19 UTC 2007
On Saturday 17 November 2007, m. allan noah wrote:
> ok, i've used your patch to add the backend into my local tree and
> build it. it does build, but it gives quite a few warnings. my current
> system is 64 bit, hence some of these might appear new to you.
>
> Others are C90/C99 issues, which should be fixed, because they will
> bite us on some of SANE's older platforms. It would be nice to comment
> out all the unused vars as well, since they tend to obscure real
> problems. please see the attached log.
>
> if you can clone your patched cvs tree, and make your changes in the
> clone, then pull a patch between the two copies, it will be easier for
> me to apply this on top of what i've already done.
>
> thanks.
>
> allan
I notice that in your compile log you get lot of warnings like
hs2p.c:411: warning: cast discards qualifiers from pointer target type
hs2p.c:485: warning: cast discards qualifiers from pointer target type
hs2p.c:515: warning: cast discards qualifiers from pointer target type
hs2p.c:628: warning: cast discards qualifiers from pointer target type
hs2p.c:642: warning: cast discards qualifiers from pointer target type
hs2p.c:656: warning: cast discards qualifiers from pointer target type
hs2p.c:705: warning: cast discards qualifiers from pointer target type
which I don't get on my x86 system.
Apparently I have a function max_string_size(SANE_String strings[])
which I call as max_string_size( (SANE_String *) stringlist)
where stringlist is an array of SANE_String_Const, e.g.
SANE_String_Const stringlist[]={
"X", "Y", "Z", NULL
};
I have both arrays of SANE_String
(which are dynamically determined from interrogating the scanner's
vpd and jis info and hence the string pointers are not constant) and
SANE_String_Const which are statically pre-assigned.
Is there some other way of casting on x86_64 that I need to do to get rid of the warnings?
_____________________________________________
There's also another warning in your logfile which I don't get on x86:
hs2p.c:1345: warning: ISO C forbids conversion of function pointer to object pointer type
which results from a debug statement borrowed from one of the backends I was copying:
DBG (DBG_sane_init, "> sane_init (authorize = %p)\n", (void *) authorize);
If printing a function's address isn't terribly important I can delete the debug statement.
Or fix it if you know how.
_____________________________________________
One other warning you get which I don't is:
hs2p.c:2220: warning: cast to pointer from integer of different size
which results from the macro function call
get_auto_binarization_val (get_auto_binarization_id(s->val[OPT_AUTOBIN].s));
defined as
#define get_auto_binarization_val(i) (auto_binarization[ get_auto_binarization_id( (i) ) ].val)
#define get_auto_binarization_id(s) (get_list_index( ((SANE_String *) &auto_binarization_list[0]), (char *)(s) )
where
get_list_index just does a simple sequential search :
SANE_Int get_list_index (char *list[], char *s){}
to find the index of a string in
an array SANE_String_Const auto_binarization_list[],
and use the returned index to find a corresponding hex value
in an array struct{ int hexval, int index}
for that string which the scanner understands
since I don't have an option-value type of struct{ int hexval, char *string}
Do you see a way of fixing this warning on x86_64?
More information about the sane-devel
mailing list