Initial original import from: fuse-2.4.2-2.fc4
[captive.git] / src / libcaptive / client / lib.c
index 83aab0b..01bc7bf 100644 (file)
@@ -134,3 +134,24 @@ gchar *pathname_normalized;
 
        return GNOME_VFS_OK;
 }
+
+
+void captive_giochannel_setup(GIOChannel *giochannel)
+{
+GIOStatus erriostatus;
+
+       g_return_if_fail(giochannel!=NULL);
+
+       if (g_io_channel_get_encoding(giochannel)) {
+               if (!g_io_channel_get_buffered(giochannel))     /* Prevent: Need to have NULL encoding to set the buffering state ... */
+                       g_io_channel_set_buffered(giochannel,TRUE);     /* Prevent: Need to set the channel buffered before setting the encoding. */
+               erriostatus=g_io_channel_set_encoding(giochannel,
+                               NULL,   /* encoding; force binary data */
+                               NULL);  /* error */
+               g_assert(erriostatus==G_IO_STATUS_NORMAL);
+               }
+       erriostatus=g_io_channel_flush(giochannel,
+                       NULL);  /* error */
+       g_assert(erriostatus==G_IO_STATUS_NORMAL);
+       g_io_channel_set_buffered(giochannel,FALSE);
+}