GNOME Bugzilla – Bug 692101
g_data_input_stream_read_upto_async returns NULL when it should return ""
Last modified: 2018-05-24 14:56:51 UTC
If the next character in the stream is one of the stop chars, g_data_input_stream_read_upto_finish will return NULL, seemingly with no way to distinguish this from hitting the end of the stream. In contract, g_data_input_stream_read_upto will return "" in the exact same case, which is what I would expect. Attaching a test program.
Created attachment 233898 [details] Test program showing the difference between sync and async variants Compile with gcc -o testupto `pkg-config --cflags --libs gio-2.0` testupto.c
Created attachment 233927 [details] [review] Proposed fix
In retrospect, a gboolean would have made more sense.
Created attachment 233928 [details] [review] Simpler, better fix
Comment on attachment 233928 [details] [review] Simpler, better fix hm... I think a "gboolean eof" (with the opposite value from "allow_empty") would be clearer. also, adding a test to gio/tests/data-input-stream.c would be great...
Review of attachment 233928 [details] [review]: Yeah, this looks good. Can you please include a test case in gio/tests/data-input-stream.c though?
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/655.