GNOME Bugzilla – Bug 652758
GDataInputStream: Clarify g_data_input_stream_read_line docs(), mark as byte array
Last modified: 2011-06-17 12:52:36 UTC
This function doesn't do any encoding checks, so we shouldn't call the returned value a "string" (which I'd like to mean UTF-8).
Created attachment 190058 [details] [review] GDataInputStream: Clarify g_data_input_stream_read_line docs(), mark as byte array
Created attachment 190066 [details] [review] GDataInputStream: Clarify read_line() docs, mark as byte array g_data_input_stream_read_line() and g_data_input_stream_read_line_finish() don't do any encoding checks, so we shouldn't call the returned value a "string" (which I'd like to mean UTF-8). Annotate them as byte arrays and add encoding warnings to the docstrings.
Created attachment 190067 [details] [review] GDataInputStream: Add _utf8() variants of _read_line These will validate the resulting line, and throw a conversion error. In practice these will likely be used by bindings, but it's good for even C apps too that don't want to explode if that text file they're reading into Pango actually has invalid UTF-8.
Review of attachment 190066 [details] [review]: Good idea
Review of attachment 190067 [details] [review]: Thanks for adding tests. Don't forget to add the new functions to gio.symbols and gio-sections.txt and add Since: tags. ::: gio/gdatainputstream.c @@ +825,3 @@ + * If @cancellable is not %NULL, then the operation can be cancelled by + * triggering the cancellable object from another thread. If the operation + * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. Might be good to say here: If non-UTF-8 content is encountered, a %G_CONVERT_ERROR is returned.
Attachment 190066 [details] pushed as ff2f46a - GDataInputStream: Clarify read_line() docs, mark as byte array Attachment 190067 [details] pushed as 28254a3 - GDataInputStream: Add _utf8() variants of _read_line
Colin: you forgot Since tags and gio-sections.txt
(In reply to comment #8) > Colin: you forgot Since tags and gio-sections.txt Fixed, thanks.