Re: XForms: browser object

T.C. Zhao (tc_zhao@yahoo.com)
Tue, 21 Sep 1999 16:12:01 -0700 (PDT)

# To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

--- Peter Hanley <peter@hanley.demon.co.uk> wrote:
> # To subscribers of the xforms list from Peter Hanley
> <peter@hanley.demon.co.uk> :
>
> I am using FL_HOLD_BROWSER as a file viewer, to select a range of
> lines,
> and to return line numbers to an application.
>
> This is using forms.88 on pc-linux 2.2
>
> To highlight the selected range I am using code like:
>
> fl_freeze_form(viewer_form);
> for(i = first; i <= last; i++)
> {
> /* make selected lines highlighted */
> strncpy(buffer1, fl_get_browser_line(file_viewer,i),
> BUFFER_SIZE);

I don't know how big BUFFER_SIZE is, but you really should be
doing BUFFER_SIZE-1, and manually set the last char to 0
as strncpy() does not append the null character.

> if(*buffer != '@')
> {
> sprintf(buffer2,"@C%i",SELECTION_COLOR);
> strncat(buffer2, buffer1, BUFFER_SIZE);
> fl_replace_browser_line(file_viewer,i,buffer2);
> }
> }
> fl_unfreeze_form(viewer_form);
>
>
>
> This produces the desired behaviour, but if fl_replace_browser_line
> is
> called more than a certain number of times (typically 90 or 100) I
> get a
> segmentation fault. I can get more lines if SELECTION_COLOR has one
> digit
> rather than two, so it is as if there is insufficient memory
> allocated
> for the extra line length.
It's s possible that there is a bug somewhere in xforms,
but fl_replace_broswser_line does no more than a strdup(), so it's
hard to imagine that would be the problem.
> this?
>
> Thankyou
>
>
> Peter Hanley
>
>
==============================================================================
> Western Lodge, Parkend +44 01594 562817
> Lydney
> peter@hanley.demon.co.uk
> Gloucestershire GL15 4JQ
> UK
>
==============================================================================
>
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> xforms-request@bob.usuhs.mil or see
> http://bob.usuhs.mil/mailserv/xforms.html
> XForms Home Page: http://bragg.phys.uwm.edu/xforms
> List Archive: http://bob.usuhs.mil/mailserv/list-archives/
>
>

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/