Handle partial writes.
2008-01-15 Matthias Clasen <mclasne@redhat.com> * gdk-pixbuf-io.c (save_to_stream): Handle partial writes. svn path=/trunk/; revision=19380
This commit is contained in:

committed by
Matthias Clasen

parent
37fcd9e6f9
commit
00a56fc2ab
@ -1,3 +1,7 @@
|
|||||||
|
2008-01-15 Matthias Clasen <mclasne@redhat.com>
|
||||||
|
|
||||||
|
* gdk-pixbuf-io.c (save_to_stream): Handle partial writes.
|
||||||
|
|
||||||
2008-01-16 Michael Natterer <mitch@imendio.com>
|
2008-01-16 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* gdk-pixbuf-io.c (save_to_stream): fix signature of this function
|
* gdk-pixbuf-io.c (save_to_stream): fix signature of this function
|
||||||
|
@ -2218,14 +2218,20 @@ save_to_stream (const gchar *buffer,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
SaveToStreamData *sdata = (SaveToStreamData *)data;
|
SaveToStreamData *sdata = (SaveToStreamData *)data;
|
||||||
|
gsize remaining;
|
||||||
|
gssize written;
|
||||||
GError *my_error = NULL;
|
GError *my_error = NULL;
|
||||||
gsize n;
|
|
||||||
|
|
||||||
n = g_output_stream_write (sdata->stream,
|
remaining = count;
|
||||||
buffer, count,
|
written = 0;
|
||||||
|
while (remaining > 0) {
|
||||||
|
buffer += written;
|
||||||
|
remaining -= written;
|
||||||
|
written = g_output_stream_write (sdata->stream,
|
||||||
|
buffer, remaining,
|
||||||
sdata->cancellable,
|
sdata->cancellable,
|
||||||
&my_error);
|
&my_error);
|
||||||
if (n != count) {
|
if (written < 0) {
|
||||||
if (!my_error) {
|
if (!my_error) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_IO_ERROR, 0,
|
G_IO_ERROR, 0,
|
||||||
@ -2236,6 +2242,8 @@ save_to_stream (const gchar *buffer,
|
|||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user