lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LYNX-DEV the printing function and submit/image/reset buttons


From: Laura Eaves
Subject: Re: LYNX-DEV the printing function and submit/image/reset buttons
Date: Tue, 8 Apr 1997 08:31:53 -0400 (EDT)

> From: Klaus Weide <address@hidden>
>...
> I haven't looked at your code in detail or tested it.
> So I cannot say whether your patch creates problems (I just supect
> it may, given how complicated that FORM-handling stuff is...)
> Just some quick comments:
>...
> > *** fm/HTML.c       Mon Apr  7 07:08:20 1997
> > --- src/HTML.c      Mon Apr  7 16:06:26 1997
> > ***************
> > *** 3818,3824 ****
> >             I.md = (char *)value[HTML_INPUT_MD];
> >   
> >         chars = HText_beginInput(me->text, &I);
> > !       if (me->sp[0].tag_number == HTML_PRE && chars > 20) {
> >             /*
> >              *  The code inadequately handles INPUT fields in PRE tags.
> >              *  We'll put up a minimum of 20 underscores, and if any
> > --- 3819,3836 ----
> >             I.md = (char *)value[HTML_INPUT_MD];
> >   
> >         chars = HText_beginInput(me->text, &I);
> > !       /*
> > !        * Value for submit and reset buttons saved in I by
> > !        * HText_beginInput(), so it can be output correctly during
> > !        * print operations.  --LE
> > !        */
> > !       if ( I.type &&
> > !           (   !strcasecomp(I.type,"submit")
> > !            || !strcasecomp(I.type,"reset")
> > !            || !strcasecomp(I.type,"image") ) )
> > !           is_submit_or_reset = 1;
> > !       if (me->sp[0].tag_number == HTML_PRE && chars > 20
> > !       &&  !is_submit_or_reset) {
>                 ^^^^^^^^^^^^^^^^^^^
> >             /*
> >              *  The code inadequately handles INPUT fields in PRE tags.
> >              *  We'll put up a minimum of 20 underscores, and if any
>
> Have you checked whether your code handles e.g. submit fields, possibly
> with a long value lable, adequately when within a PRE section... ?

I'm not sure what the code for HTML_PRE is trying to do...
It seems it indiscriminantly puts out 20 '_'s and subtracts this amount
from chars without checking the value of chars.  If chars is still > 0,
the subsequent code then puts out the "rest" of the '_'s in the field.

How should this apply to submit/reset button values?  Should I force them
to be a minimum of 20 chars?  Does that mean I should append '_'s if the
value if chars < 20?

I guess I just chose to ignore HTML_PRE until I had more info...
What do you think?

> > ***************
> > *** 3830,3837 ****
> >             }
> >             HText_setIgnoreExcess(me->text, TRUE);
> >         }
> > !       for (; chars > 0; chars--)
> > !           HTML_put_character(me, '_');
> >         HText_setIgnoreExcess(me->text, FALSE);
> >     }
> >     break;
> > --- 3842,3855 ----
> >             }
> >             HText_setIgnoreExcess(me->text, TRUE);
> >         }
> > !       /*--LE*/
> > !       if ( !is_submit_or_reset ) {
> > !           for (; chars > 0; chars--)
> > !               HTML_put_character(me, '_');
> > !       } else { int i;
> > !           for ( i = 0;  i < chars;  ++i )
>                              ^^^^^^^^^^
> > !               HTML_put_character(me, I.value[i]);
> > !       }
> >         HText_setIgnoreExcess(me->text, FALSE);
> >     }
> >     break;
>
> You should probably test for end of string (a '\0' char) there,
> or explain why that is not necessary.

chars is returned from HText_beginInput and is the length
of the value.  I.value for submit buttons
is also processed in HText_beginInput and presumably is legal...
In any case, chars should be no longer than strlen(I.value).  So I don't think
there's a null in the first 'chars' chars of I.value.
--le
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]