[glib/wip/pwithnall/converter-stream-debugging] WIP



commit 19ae277afeb8d303c2db0fd9a89a7611b99e22da
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Apr 5 15:50:10 2022 +0100

    WIP
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/gconverterinputstream.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/gio/gconverterinputstream.c b/gio/gconverterinputstream.c
index dd84b3474d..fceb36f1c3 100644
--- a/gio/gconverterinputstream.c
+++ b/gio/gconverterinputstream.c
@@ -422,6 +422,8 @@ read_internal (GInputStream *stream,
       !priv->at_input_end)
     {
       nread = fill_input_buffer (cstream, count, blocking, cancellable, error);
+      if (error != NULL && *error != NULL)
+        g_message ("fill_input_buffer error: %s", (*error)->message);
       if (nread < 0)
        return -1;
       if (nread == 0)
@@ -457,6 +459,8 @@ read_internal (GInputStream *stream,
        {
          /* No previously read data and no "special" error, return error */
          g_propagate_error (error, my_error);
+          if (error != NULL && *error != NULL)
+            g_message ("convert error: %s", (*error)->message);
          return -1;
        }
       else
@@ -537,6 +541,8 @@ read_internal (GInputStream *stream,
              /* Can't read any more data, return that error */
              g_error_free (my_error);
              g_propagate_error (error, my_error2);
+              if (error != NULL && *error != NULL)
+                g_message ("fill_input_buffer error 2: %s", (*error)->message);
              priv->need_input = TRUE;
              return -1;
            }
@@ -564,6 +570,8 @@ read_internal (GInputStream *stream,
 
       /* Any other random error, return it */
       g_propagate_error (error, my_error);
+      if (error != NULL && *error != NULL)
+        g_message ("random error: %s", (*error)->message);
       return -1;
     }
 
@@ -595,6 +603,12 @@ g_converter_input_stream_is_readable (GPollableInputStream *stream)
   GInputStream *base_stream = G_FILTER_INPUT_STREAM (stream)->base_stream;
   GConverterInputStream *cstream = G_CONVERTER_INPUT_STREAM (stream);
 
+  g_message ("converted_buffer size %lu, input_buffer size %lu, need_input %u, base_stream is %s",
+             buffer_data_size (&cstream->priv->converted_buffer),
+             buffer_data_size (&cstream->priv->input_buffer),
+             cstream->priv->need_input,
+             g_pollable_input_stream_is_readable (G_POLLABLE_INPUT_STREAM (base_stream)) ? "readable" : "not 
readable");
+
   if (buffer_data_size (&cstream->priv->converted_buffer))
     return TRUE;
   else if (buffer_data_size (&cstream->priv->input_buffer) &&


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