[gtksourceview/wip/uchardet-2: 2/5] BufferOutputStream: handle G_IO_ERROR_PARTIAL_INPUT



commit 377e6a130043cc4a6dff871ccfde26222cdca830
Author: Jehan <jehan girinstud io>
Date:   Sat Nov 28 16:20:10 2015 +0100

    BufferOutputStream: handle G_IO_ERROR_PARTIAL_INPUT
    
    g_convert() and g_convert_with_iconv() can have a
    G_CONVERT_ERROR_PARTIAL_INPUT error. But g_converter_convert() actually
    make G_IO_ERROR_PARTIAL_INPUT errors for an incomplete multibyte sequence.

 gtksourceview/gtksourcebufferoutputstream.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcebufferoutputstream.c b/gtksourceview/gtksourcebufferoutputstream.c
index 2de2a29..060f5e8 100644
--- a/gtksourceview/gtksourcebufferoutputstream.c
+++ b/gtksourceview/gtksourcebufferoutputstream.c
@@ -323,7 +323,8 @@ try_convert (GCharsetConverter *converter,
 
        if (err != NULL)
        {
-               if (err->code == G_CONVERT_ERROR_PARTIAL_INPUT)
+               if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT) ||
+                   g_error_matches (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT))
                {
                        /* FIXME We can get partial input while guessing the
                           encoding because we just take some amount of text


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