Re: Problems with GBufferedOutputStream

2009-08-19 Thread Alexander Larsson
On Sat, 2009-08-15 at 00:27 +0200, Sebastian Pölsterl wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Jürg Billeter schrieb:
  On Fri, 2009-08-14 at 20:49 +0200, Sebastian Pölsterl wrote:
  I came across a problem with GBufferedOutputStream and
  g_output_stream_write recently. If I try to write more data than the
  buffer size, not everything is written to the file.
  
 From the documentation of g_output_stream_write:
  
  On success, the number of bytes written to the stream is returned. It
  is not an error if this is not the same as the requested size, as it can
  happen e.g. on a partial i/o error, or if there is not enough storage in
  the stream. All writes either block until at least one byte is written,
  so zero is never returned (unless count is zero).
  
 I read the documentation, too. But non of the issues mentioned is
 applicable here. If the behavior is intended I'd have absolutely no idea
 why one would need such a function.

e.g. means for example. It is not an exhaustive list of possible
reasons for a short write. Any i/o code needs to correctly handle short
writes. I agree that it would be nice to additionally fix
BufferedOutputStream for this case, but its by no means a bug.

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Problems with GBufferedOutputStream

2009-08-14 Thread Jürg Billeter
On Fri, 2009-08-14 at 20:49 +0200, Sebastian Pölsterl wrote:
 I came across a problem with GBufferedOutputStream and
 g_output_stream_write recently. If I try to write more data than the
 buffer size, not everything is written to the file.

From the documentation of g_output_stream_write:

On success, the number of bytes written to the stream is returned. It
is not an error if this is not the same as the requested size, as it can
happen e.g. on a partial i/o error, or if there is not enough storage in
the stream. All writes either block until at least one byte is written,
so zero is never returned (unless count is zero).

Use g_output_stream_write_all if you want to make sure that all bytes
are written (as long as there is no error).

Cheers,
Jürg

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Problems with GBufferedOutputStream

2009-08-14 Thread Sebastian Pölsterl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jürg Billeter schrieb:
 On Fri, 2009-08-14 at 20:49 +0200, Sebastian Pölsterl wrote:
 I came across a problem with GBufferedOutputStream and
 g_output_stream_write recently. If I try to write more data than the
 buffer size, not everything is written to the file.
 
From the documentation of g_output_stream_write:
 
 On success, the number of bytes written to the stream is returned. It
 is not an error if this is not the same as the requested size, as it can
 happen e.g. on a partial i/o error, or if there is not enough storage in
 the stream. All writes either block until at least one byte is written,
 so zero is never returned (unless count is zero).
 
I read the documentation, too. But non of the issues mentioned is
applicable here. If the behavior is intended I'd have absolutely no idea
why one would need such a function.

- --
Greetings,
Sebastian Pölsterl
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqF5OcACgkQ1ygZeJ3lLIcJBQCfQZ9KrzygPcHHq3l4qlYYwSTH
qHQAnA0EEIZsxIbuTkf/piS5rNz4TmxL
=+UAm
-END PGP SIGNATURE-
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list