mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 23:16:14 +01:00
Bug 568723 – g_buffered_input_stream_fill_async doesn't take count == -1
2009-01-22 Ryan Lortie <desrt@desrt.ca> Bug 568723 – g_buffered_input_stream_fill_async doesn't take count == -1 * gbufferedinputstream.c (g_buffered_input_stream_fill_async, g_buffered_input_stream_fill): check for count < -1 instead of count < 0 and copy modified check to non-async version for consistency. document the "count = -1" API. svn path=/trunk/; revision=7828
This commit is contained in:
parent
fb50c2ae1a
commit
fc10cb46ad
@ -1,3 +1,12 @@
|
|||||||
|
2009-01-22 Ryan Lortie <desrt@desrt.ca>
|
||||||
|
|
||||||
|
Bug 568723 – g_buffered_input_stream_fill_async doesn't take count == -1
|
||||||
|
|
||||||
|
* gbufferedinputstream.c (g_buffered_input_stream_fill_async,
|
||||||
|
g_buffered_input_stream_fill): check for count < -1 instead of count <
|
||||||
|
0 and copy modified check to non-async version for consistency.
|
||||||
|
document the "count = -1" API.
|
||||||
|
|
||||||
2009-01-22 Ryan Lortie <desrt@desrt.ca>
|
2009-01-22 Ryan Lortie <desrt@desrt.ca>
|
||||||
|
|
||||||
Bug 568741 – g_buffered_input_stream_fill_async doesn't work
|
Bug 568741 – g_buffered_input_stream_fill_async doesn't work
|
||||||
|
@ -380,6 +380,9 @@ g_buffered_input_stream_new_sized (GInputStream *base_stream,
|
|||||||
* can happen e.g. near the end of a file. Zero is returned on end of file
|
* 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.
|
* (or if @count is zero), but never otherwise.
|
||||||
*
|
*
|
||||||
|
* If @count is -1 then the attempted read size is equal to the number of
|
||||||
|
* bytes that are required to fill the buffer.
|
||||||
|
*
|
||||||
* If @cancellable is not %NULL, then the operation can be cancelled by
|
* If @cancellable is not %NULL, then the operation can be cancelled by
|
||||||
* triggering the cancellable object from another thread. If the operation
|
* triggering the cancellable object from another thread. If the operation
|
||||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
|
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
|
||||||
@ -408,6 +411,13 @@ g_buffered_input_stream_fill (GBufferedInputStream *stream,
|
|||||||
|
|
||||||
input_stream = G_INPUT_STREAM (stream);
|
input_stream = G_INPUT_STREAM (stream);
|
||||||
|
|
||||||
|
if (count < -1)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
|
_("Too large count value passed to %s"), G_STRFUNC);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_input_stream_set_pending (input_stream, error))
|
if (!g_input_stream_set_pending (input_stream, error))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -440,7 +450,7 @@ async_fill_callback_wrapper (GObject *source_object,
|
|||||||
/**
|
/**
|
||||||
* g_buffered_input_stream_fill_async:
|
* g_buffered_input_stream_fill_async:
|
||||||
* @stream: #GBufferedInputStream.
|
* @stream: #GBufferedInputStream.
|
||||||
* @count: a #gssize.
|
* @count: the number of bytes that will be read from the stream.
|
||||||
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
||||||
* of the request.
|
* of the request.
|
||||||
* @cancellable: optional #GCancellable object
|
* @cancellable: optional #GCancellable object
|
||||||
@ -450,6 +460,9 @@ async_fill_callback_wrapper (GObject *source_object,
|
|||||||
* Reads data into @stream's buffer asynchronously, up to @count size.
|
* Reads data into @stream's buffer asynchronously, up to @count size.
|
||||||
* @io_priority can be used to prioritize reads. For the synchronous
|
* @io_priority can be used to prioritize reads. For the synchronous
|
||||||
* version of this function, see g_buffered_input_stream_fill().
|
* version of this function, see g_buffered_input_stream_fill().
|
||||||
|
*
|
||||||
|
* If @count is -1 then the attempted read size is equal to the number
|
||||||
|
* of bytes that are required to fill the buffer.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
|
g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
|
||||||
@ -476,7 +489,7 @@ g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((gssize) count) < 0)
|
if (count < -1)
|
||||||
{
|
{
|
||||||
g_simple_async_report_error_in_idle (G_OBJECT (stream),
|
g_simple_async_report_error_in_idle (G_OBJECT (stream),
|
||||||
callback,
|
callback,
|
||||||
|
Loading…
Reference in New Issue
Block a user