Improve the g_file_make_symbolic_link docs
[platform/upstream/glib.git] / gio / gfileinputstream.c
index 75607a5..502584b 100644 (file)
  * Author: Alexander Larsson <alexl@redhat.com>
  */
 
-#include <config.h>
+#include "config.h"
 
 #include <glib.h>
 #include <gfileinputstream.h>
 #include <gseekable.h>
 #include "gsimpleasyncresult.h"
+#include "gcancellable.h"
+#include "gasyncresult.h"
+#include "gioerror.h"
 #include "glibintl.h"
 
 #include "gioalias.h"
@@ -33,7 +36,7 @@
 /**
  * SECTION:gfileinputstream
  * @short_description: File input streaming operations
- * @include: gio.h
+ * @include: gio/gio.h
  * @see_also: #GInputStream, #GDataInputStream, #GSeekable
  *
  * GFileInputStream provides input streams that take their
  *
  * GFileInputStream implements #GSeekable, which allows the input 
  * stream to jump to arbitrary positions in the file, provided the 
- * filesystem of the file allows it. In addition to the generic 
- * g_seekable_ API, GFileInputStream has its own API for seeking 
- * and positioning. To find the position of a file input stream, 
- * use g_file_input_stream_tell(). To find out if a file input 
- * stream supports seeking, use g_file_input_stream_can_seek().
- * To position a file input stream, use g_file_input_stream_seek().
+ * filesystem of the file allows it. To find the position of a file
+ * input stream, use g_seekable_tell(). To find out if a file input
+ * stream supports seeking, use g_seekable_stream_can_seek().
+ * To position a file input stream, use g_seekable_seek().
  **/
 
 static void       g_file_input_stream_seekable_iface_init    (GSeekableIface       *iface);
@@ -63,7 +64,7 @@ static gboolean   g_file_input_stream_seekable_truncate      (GSeekable
                                                              GCancellable         *cancellable,
                                                              GError              **error);
 static void       g_file_input_stream_real_query_info_async  (GFileInputStream     *stream,
-                                                             char                 *attributes,
+                                                             const char           *attributes,
                                                              int                   io_priority,
                                                              GCancellable         *cancellable,
                                                              GAsyncReadyCallback   callback,
@@ -126,7 +127,7 @@ g_file_input_stream_init (GFileInputStream *stream)
  **/
 GFileInfo *
 g_file_input_stream_query_info (GFileInputStream  *stream,
-                                char              *attributes,
+                                const char        *attributes,
                                 GCancellable      *cancellable,
                                 GError           **error)
 {
@@ -150,8 +151,8 @@ g_file_input_stream_query_info (GFileInputStream  *stream,
   if (class->query_info)
     info = class->query_info (stream, attributes, cancellable, error);
   else
-    g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-                _("Stream doesn't support query_info"));
+    g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                         _("Stream doesn't support query_info"));
 
   if (cancellable)
     g_cancellable_pop_current (cancellable);
@@ -199,7 +200,7 @@ async_ready_callback_wrapper (GObject      *source_object,
  **/
 void
 g_file_input_stream_query_info_async (GFileInputStream    *stream,
-                                      char                *attributes,
+                                      const char          *attributes,
                                       int                  io_priority,
                                       GCancellable        *cancellable,
                                       GAsyncReadyCallback  callback,
@@ -264,15 +265,7 @@ g_file_input_stream_query_info_finish (GFileInputStream  *stream,
   return class->query_info_finish (stream, result, error);
 }
 
-/**
- * g_file_input_stream_tell:
- * @stream: a #GFileInputStream.
- * 
- * Gets the current position in the stream.
- * 
- * Returns: a #goffset with the position in the stream.
- **/
-goffset
+static goffset
 g_file_input_stream_tell (GFileInputStream *stream)
 {
   GFileInputStreamClass *class;
@@ -295,15 +288,7 @@ g_file_input_stream_seekable_tell (GSeekable *seekable)
   return g_file_input_stream_tell (G_FILE_INPUT_STREAM (seekable));
 }
 
-/**
- * g_file_input_stream_can_seek:
- * @stream: a #GFileInputStream.
- * 
- * Checks if a file input stream can be seeked.
- * 
- * Returns: %TRUE if stream can be seeked. %FALSE otherwise.
- **/
-gboolean
+static gboolean
 g_file_input_stream_can_seek (GFileInputStream *stream)
 {
   GFileInputStreamClass *class;
@@ -330,25 +315,7 @@ g_file_input_stream_seekable_can_seek (GSeekable *seekable)
   return g_file_input_stream_can_seek (G_FILE_INPUT_STREAM (seekable));
 }
 
-/**
- * g_file_input_stream_seek:
- * @stream: a #GFileInputStream.
- * @offset: a #goffset to seek.
- * @type: a #GSeekType.
- * @cancellable: optional #GCancellable object, %NULL to ignore. 
- * @error: a #GError location to store the error occuring, or 
- *     %NULL to ignore.
- * 
- * Seeks in the file input stream.
- * 
- * If @cancellable is not %NULL, then the operation can be cancelled by
- * triggering the cancellable object from another thread. If the operation
- * was cancelled, the error %G_IO_ERROR_CANCELLED will be set.
- * 
- * Returns: %TRUE if the stream was successfully seeked to the position.
- * %FALSE on error.
- **/
-gboolean
+static gboolean
 g_file_input_stream_seek (GFileInputStream  *stream,
                          goffset            offset,
                          GSeekType          type,
@@ -366,8 +333,8 @@ g_file_input_stream_seek (GFileInputStream  *stream,
 
   if (!class->seek)
     {
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-                  _("Seek not supported on stream"));
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                           _("Seek not supported on stream"));
       return FALSE;
     }
 
@@ -410,8 +377,8 @@ g_file_input_stream_seekable_truncate (GSeekable     *seekable,
                                       GCancellable  *cancellable,
                                       GError       **error)
 {
-  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-              _("Truncate not allowed on input stream"));
+  g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                       _("Truncate not allowed on input stream"));
   return FALSE;
 }
 
@@ -451,8 +418,8 @@ query_info_async_thread (GSimpleAsyncResult *res,
   if (class->query_info)
     info = class->query_info (G_FILE_INPUT_STREAM (object), data->attributes, cancellable, &error);
   else
-    g_set_error (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-                _("Stream doesn't support query_info"));
+    g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                         _("Stream doesn't support query_info"));
 
   if (info == NULL)
     {
@@ -465,7 +432,7 @@ query_info_async_thread (GSimpleAsyncResult *res,
 
 static void
 g_file_input_stream_real_query_info_async (GFileInputStream    *stream,
-                                           char                *attributes,
+                                           const char          *attributes,
                                            int                  io_priority,
                                            GCancellable        *cancellable,
                                            GAsyncReadyCallback  callback,