* 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"
/**
* 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);
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,
**/
GFileInfo *
g_file_input_stream_query_info (GFileInputStream *stream,
- char *attributes,
+ const char *attributes,
GCancellable *cancellable,
GError **error)
{
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);
**/
void
g_file_input_stream_query_info_async (GFileInputStream *stream,
- char *attributes,
+ const char *attributes,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
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;
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;
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,
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;
}
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;
}
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)
{
static void
g_file_input_stream_real_query_info_async (GFileInputStream *stream,
- char *attributes,
+ const char *attributes,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,