Re: scanimage -T using Purify...

From: Henning Meier-Geinitz (henning@meier-geinitz.de)
Date: Tue May 01 2001 - 12:15:50 PDT

  • Next message: Oliver Rauch: "Re: scanimage -T using Purify..."

    Hi,

    On Tue, May 01, 2001 at 08:23:01PM +0200, Oliver Rauch wrote:
    > Henning Meier-Geinitz wrote:
    > >
    > >
    > > Ok, if we have a str containing "\n" (empty line), len
    > > will be 1 and str[--len] is '\n' and after that len = 0. Next step:
    > > len is 0, --len is -1 --> str[-1] !
    > >
    > > Something like
    > >
    > > while((len > 0) && (isspace(str[--len])))
    > >
    > > should fix this. Petter, can you check this with purify?
    > >
    >
    > if I see it right sanei_config_read() does not change
    > the return buffer when the line is "\n".
    > This also should be changed (buffer[0]=0).

    "\n" is white space so

       len = strlen( str);
       while( (0 < len) && (isspace( str[--len])) )
         str[len] = '\0';
                
    should remove it. Or am I wrong?

    >
    > > umax.c:
    > > len = strlen (config_line);
    > > if (config_line[len - 1] == '\n')
    > > {
    > > config_line[--len] = '\0';
    > > }
    > >
    > > What happens if len==0? Similar things are probably in many backends.
    > >
    >
    > Ok, this hsould fix it.
    >
    > if (len && (config_line[len - 1] == '\n'))

    Yes, but why are you using this? Isn't that already done in
    sanei_config_read?

    Bye,
      Henning

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Tue May 01 2001 - 12:10:04 PDT