[glib: 3/15] Change to g_warning() into assertions in GOutputStream



commit 89da9eb6c0291262f0158e5c6e21b0414790b508
Author: Sebastian Dröge <sebastian centricular com>
Date:   Fri Jan 4 13:00:34 2019 +0200

    Change to g_warning() into assertions in GOutputStream
    
    These would only happen if the API contract of the write() and writev()
    functions was broken by subclasses.

 gio/goutputstream.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gio/goutputstream.c b/gio/goutputstream.c
index f80cc0a2a..10f9aa732 100644
--- a/gio/goutputstream.c
+++ b/gio/goutputstream.c
@@ -306,9 +306,7 @@ g_output_stream_write_all (GOutputStream  *stream,
            *bytes_written = _bytes_written;
          return FALSE;
        }
-      
-      if (res == 0)
-       g_warning ("Write returned zero without error");
+      g_return_val_if_fail (res > 0, FALSE);
 
       _bytes_written += res;
     }
@@ -492,8 +490,7 @@ g_output_stream_writev_all (GOutputStream  *stream,
           return FALSE;
         }
 
-      if (n_written == 0)
-        g_warning ("Write returned zero without error");
+      g_return_val_if_fail (n_written > 0, FALSE);
       _bytes_written += n_written;
 
       /* skip vectors that have been written in full */


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