line terminators containing nulls in GIOChannel



	Thinking about the GIOChannel implementation, one thing
that's been bugging me is that the line terminator used by
g_io_channel_read_line() can't contain internal nulls,
(or, for binary channels, be non-UTF-8). With this in mind,
there are a few changes I'd like to make if we're not too late
into the API freeze:

1. Add a length argument to g_io_channel_[set,get]_line_term.
   Passing a -1 to set would treat the line terminator as
   a null terminated string.

2. Move the check for intermediate nulls in input in
   g_io_channel_read_line(), so that they are only checked for
   in the autodetection case (NULL line term), instead of
   in all cases.

3. Not check that the data passed to g_io_channel_set_line_term()
   is valid UTF-8. The machinery for looking for line terminators
   in binary channels already exists, we just need to allow
   binary line terminators. For non-binary encodings, not
   validating the line terminator is consistent with the
   gtk+ policy of assuming that the data passed by the programmer
   is valid UTF-8.

Comments? Owen?

Ron Steinke




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