[sane-devel] hs2p backend

m. allan noah kitno455 at gmail.com
Mon Nov 19 19:52:57 UTC 2007


weird- hey, wait, did you update both patches on your site? i
re-downloaded on this machine, which would explain the difference.
also, this machine is 32 bit, just to confuse matters further :)

i'll try again. hold on.

allan

On Nov 19, 2007 2:38 PM,  <jazz_johnson at verizon.net> wrote:
>
>
> On Monday 19 November 2007, m. allan noah wrote:
> > On Nov 18, 2007 11:08 PM,  <jazz_johnson at verizon.net> wrote:
> > > On Saturday 17 November 2007, m. allan noah wrote:
> > > As you can see, there's still one unused parameter in sense_handler(...,
> > > void *arg) definition and there's a bunch of hs2p scsi commands for which
> > > I wrote functions but have not used in the main hs2p backend. I also
> > > defined some structs for hs2p compression types which I've also not used.
> >
> > ok, lets start by saying that lots of other sane backends produce
> > warnings, and i am probably running a newer version of gcc than you,
> > so it's not a requirement that we remove all of them. it's just a pet
> > peev of mine.
> That's OK. I'm obviously a novice at programming.
> I'm running the following gcc:
> # gcc -v
> Using built-in specs.
> Target: i686-pc-linux-gnu
> Configured with: /var/tmp/portage/sys-devel/gcc-4.1.1-r3/work/gcc-4.1.1/configure
> --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.1
> --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
> --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1
> --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man
> --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info
> --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
> --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu
> --disable-altivec --enable-nls --without-included-gettext
> --with-system-zlib --disable-checking --disable-werror
> --enable-secureplt --disable-libunwind-exceptions
> --disable-multilib --disable-libmudflap --disable-libssp --disable-libgcj
> --enable-languages=c,c++,fortran --enable-shared
> --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
> Thread model: posix
> gcc version 4.1.1 (Gentoo 4.1.1-r3)
> >
> > 1. if you put a little 'arg = arg;' line in the function, gcc will
> > shutup about the param.
> > 2. if you wrap the unused functions in #if 0/#endif, you can keep them
> > for later.
> >
> > i've applied your patch, but most of the issues remain. see the attached
> > log.
> Is the log which you attached the compile log which resulted after the latest patch?
> Or is it the old compile log?
> I ask because the warnings about unused variables 'i', 't', and 'left'
>  and unsupported '%lf' are fixed in my code and the patch which I attached.
>
> I used
> diff -r -N -u sane-backends-hs2p      sane-backends-hs2p-new      | gzip -c - > h2p_patch.new
>
> Did the patch not work?
> Did I need to rename these directories as
>
> #mv sane-backends sane-backends-cvs
> #mv sane-backends-hs2p-new sane-backends
> #mv sane-backends-hs2p sane-backends-hs2p.old
> #diff -r -N -u sane-backends-hs2p.old sane-backends  |gzip -c - >hs2p_patch.new
>
>
>
> >
> > the errors break down into a couple classes:
> >
> > 1. iso C90 or 99 errors, like using new printf formats or extra
> > semicolons, or mixing your variable declarations with code. these are
> > the most important to correct, as they will prevent sane from building
> > on other platforms.
> >
> > fixes:
> > make sure your debug statements are after your variable declarations,
> > use %ld, etc.
> '%lf' warnings were fixed.
>
> >
> > 2. assigning non-const to a const pointer.
> >
> > fixes:
> > change max_string_size to take SANE_String_Const, and remove most of the
> > casts.
> But will max_string_size( SANE_String_Const)
> compile without warnings when called with strings of type SANE_String ?
> Or must I have a separate routine to handle strings of type SANE_String ?
>
> If I have a string of type SANE_String_Const and try to assign its value dynamically I'll get a compile error.
> >
> > 3. unused vars and functions
> All unused vars were fixed except for the declaration in sense_handler(..., (void *)arg)
> I'll set arg=arg to quiet the compiler.
> I'll comment out the unused routines with #if 0/#endif
> >
> > 4. calling 'sizeof' on a void type. if you know what type it will be, cast
> > it.
> >
> > 5. trash the warning of the function pointer.
> OK
> in sane_exit() there's a call to free some allocated strings
> which needs to be cast on x86 or I get an error. I'll try
> casting to (char *) and see if that's OK with both x86 and x86_64:
>
>   for (dev = first_dev; dev; dev = next)
>     {
>       next = dev->next;
>       free ((void *) dev->sane.name);
>       free ((void *) dev->sane.model);
>       free (dev);
>     }
>
> >
> > 6. some functions return SANE_Int, but the caller crams the output
> > into SANE_Status. Convert to the latter.
> This was fixed.
> I  fixed get/set_endorser_control and get/set_white_balance to return
> SANE_Status instead of scanner value, and to pass the scanner value
>  by reference instead.
> >
> > 7. sometimes you send the fd into do_cancel, other times the struct?
> This was fixed too.
> >
> > allan
>
>
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
>              to sane-devel-request at lists.alioth.debian.org
>



-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list