[glib] doc: improve doc of g_input_stream_read()



commit 48c7d041e2d046462156056d297f609465fce6ab
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Jul 3 18:02:31 2014 +0200

    doc: improve doc of g_input_stream_read()
    
    I recently needed to nul-terminate the returned buffer, and I wasn't
    sure if g_input_stream_read() does that or not. I've checked
    glocalfileinputstream.c, which calls read(2) which doesn't nul-terminate
    the buffer. So I assume it's the same behavior for all GInputStream
    subclasses.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732704

 gio/ginputstream.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gio/ginputstream.c b/gio/ginputstream.c
index 0bf067e..a2fd55d 100644
--- a/gio/ginputstream.c
+++ b/gio/ginputstream.c
@@ -141,6 +141,9 @@ g_input_stream_init (GInputStream *stream)
  * can happen e.g. near the end of a file. Zero is returned on end of file
  * (or if @count is zero),  but never otherwise.
  *
+ * The returned @buffer is not a nul-terminated string, it can contain nul bytes
+ * at any position, and this function doesn't nul-terminate the @buffer.
+ *
  * 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. If an


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