Commit 09471fec authored by Matthias Clasen's avatar Matthias Clasen

Coding style fixups

svn path=/trunk/; revision=5993
parent 7c0e098f
2007-11-28 Matthias Clasen <mclasen@redhat.com>
* *.c: Coding style fixups
2007-11-28 Matthias Clasen <mclasen@redhat.com>
* inotify/inotify-helper.c: Don't export the lock from libgio.
......
......@@ -114,8 +114,8 @@ g_app_info_dup (GAppInfo *appinfo)
* Returns: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
**/
gboolean
g_app_info_equal (GAppInfo *appinfo1,
GAppInfo *appinfo2)
g_app_info_equal (GAppInfo *appinfo1,
GAppInfo *appinfo2)
{
GAppInfoIface *iface;
......@@ -255,9 +255,9 @@ g_app_info_set_as_default_for_type (GAppInfo *appinfo,
* or in case of an error.
**/
gboolean
g_app_info_set_as_default_for_extension (GAppInfo *appinfo,
const char *extension,
GError **error)
g_app_info_set_as_default_for_extension (GAppInfo *appinfo,
const char *extension,
GError **error)
{
GAppInfoIface *iface;
......@@ -284,12 +284,12 @@ g_app_info_set_as_default_for_extension (GAppInfo *appinfo,
* application is capable of opening files with the given content type.
*
* Returns: %TRUE if @appinfo supports @content_type.
* %FALSE if not, or in case of an error.
* %FALSE if not, or in case of an error.
**/
gboolean
g_app_info_add_supports_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
g_app_info_add_supports_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GAppInfoIface *iface;
......@@ -301,7 +301,10 @@ g_app_info_add_supports_type (GAppInfo *appinfo,
if (iface->add_supports_type)
return (* iface->add_supports_type) (appinfo, content_type, error);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "g_app_info_add_supports_type not supported yet");
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"g_app_info_add_supports_type not supported yet");
return FALSE;
}
......@@ -313,7 +316,7 @@ g_app_info_add_supports_type (GAppInfo *appinfo,
* Checks if a supported content type can be removed from an application.
*
* Returns: %TRUE if it is possible to remove supported
* content types from a given @appinfo, %FALSE if not.
* content types from a given @appinfo, %FALSE if not.
**/
gboolean
g_app_info_can_remove_supports_type (GAppInfo *appinfo)
......@@ -340,12 +343,12 @@ g_app_info_can_remove_supports_type (GAppInfo *appinfo)
* Removes a supported type from an application, if possible.
*
* Returns: %TRUE if @content_type support was removed
* from @appinfo. %FALSE if not.
* from @appinfo. %FALSE if not.
**/
gboolean
g_app_info_remove_supports_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
g_app_info_remove_supports_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GAppInfoIface *iface;
......@@ -357,7 +360,10 @@ g_app_info_remove_supports_type (GAppInfo *appinfo,
if (iface->remove_supports_type)
return (* iface->remove_supports_type) (appinfo, content_type, error);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "g_app_info_remove_supports_type not supported yet");
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"g_app_info_remove_supports_type not supported yet");
return FALSE;
}
......@@ -397,10 +403,10 @@ g_app_info_get_icon (GAppInfo *appinfo)
* Returns: %TRUE on successful launch, %FALSE otherwise.
**/
gboolean
g_app_info_launch (GAppInfo *appinfo,
GList *files,
GAppLaunchContext *launch_context,
GError **error)
g_app_info_launch (GAppInfo *appinfo,
GList *files,
GAppLaunchContext *launch_context,
GError **error)
{
GAppInfoIface *iface;
......@@ -447,10 +453,10 @@ g_app_info_supports_uris (GAppInfo *appinfo)
* Returns: %TRUE if the @appinfo was launched successfully, %FALSE otherwise.
**/
gboolean
g_app_info_launch_uris (GAppInfo *appinfo,
GList *uris,
GAppLaunchContext *launch_context,
GError **error)
g_app_info_launch_uris (GAppInfo *appinfo,
GList *uris,
GAppLaunchContext *launch_context,
GError **error)
{
GAppInfoIface *iface;
......@@ -473,8 +479,8 @@ g_app_info_launch_uris (GAppInfo *appinfo,
* Returns: %TRUE if the @appinfo should be shown, %FALSE otherwise.
**/
gboolean
g_app_info_should_show (GAppInfo *appinfo,
const char *desktop_env)
g_app_info_should_show (GAppInfo *appinfo,
const char *desktop_env)
{
GAppInfoIface *iface;
......@@ -548,10 +554,12 @@ g_app_launch_context_get_display (GAppLaunchContext *context,
* @files: a #GList of files.
*
* Gets the DESKTOP_STARTUP_ID for the launched application, if supported.
* Startup notification IDs are defined in the FreeDesktop.Org Startup Notifications standard,
* at <ulink url="http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt"/>.
* Startup notification IDs are defined in the FreeDesktop.Org Startup
* Notifications standard, at
* <ulink url="http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt"/>.
*
* Returns: a startup notifaction ID for the application, or %NULL if not supported.
* Returns: a startup notifaction ID for the application, or %NULL if
* not supported.
**/
char *
g_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
......@@ -575,14 +583,14 @@ g_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
/**
* g_app_launch_context_launch_failed:
* @context: a #GAppLaunchContext.
* @startup_notify_id: a string containing the DESKTOP_STARTUP_ID of the launched application.
* @startup_notify_id: a string containing the DESKTOP_STARTUP_ID
* of the launched application.
*
* TODO: what does this do? Can't find it implemented anywhere.
*
**/
void
g_app_launch_context_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
const char *startup_notify_id)
{
GAppLaunchContextClass *class;
......
......@@ -50,10 +50,10 @@ async_result_free (gpointer data)
void
_g_queue_async_result (GAsyncResultData *result,
gpointer async_object,
GError *error,
gpointer user_data,
GSourceFunc source_func)
gpointer async_object,
GError *error,
gpointer user_data,
GSourceFunc source_func)
{
GSource *source;
......@@ -83,8 +83,8 @@ typedef struct
} FDSource;
static gboolean
fd_source_prepare (GSource *source,
gint *timeout)
fd_source_prepare (GSource *source,
gint *timeout)
{
FDSource *fd_source = (FDSource *)source;
*timeout = -1;
......@@ -93,7 +93,7 @@ fd_source_prepare (GSource *source,
}
static gboolean
fd_source_check (GSource *source)
fd_source_check (GSource *source)
{
FDSource *fd_source = (FDSource *)source;
......@@ -139,15 +139,15 @@ static GSourceFuncs fd_source_funcs = {
/* Might be called on another thread */
static void
fd_source_cancelled_cb (GCancellable *cancellable,
gpointer data)
gpointer data)
{
/* Wake up the mainloop in case we're waiting on async calls with FDSource */
g_main_context_wakeup (NULL);
}
GSource *
_g_fd_source_new (int fd,
gushort events,
_g_fd_source_new (int fd,
gushort events,
GCancellable *cancellable)
{
GSource *source;
......
......@@ -197,7 +197,7 @@ g_buffered_input_stream_get_buffer_size (GBufferedInputStream *stream)
**/
void
g_buffered_input_stream_set_buffer_size (GBufferedInputStream *stream,
gsize size)
gsize size)
{
GBufferedInputStreamPrivate *priv;
gsize in_buffer;
......@@ -232,10 +232,10 @@ g_buffered_input_stream_set_buffer_size (GBufferedInputStream *stream,
}
static void
g_buffered_input_stream_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
g_buffered_input_stream_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GBufferedInputStreamPrivate *priv;
GBufferedInputStream *bstream;
......@@ -270,15 +270,14 @@ g_buffered_input_stream_get_property (GObject *object,
switch (prop_id)
{
case PROP_BUFSIZE:
g_value_set_uint (value, priv->len);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
......@@ -333,8 +332,8 @@ g_buffered_input_stream_new (GInputStream *base_stream)
* @base_stream: a #GOutputStream.
* @size: a #gsize.
*
* Creates a new #GBufferedInputStream from the given @base_stream, with
* a buffer set to @size.
* Creates a new #GBufferedInputStream from the given @base_stream,
* with a buffer set to @size.
*
* Returns: a #GInputStream.
**/
......@@ -384,13 +383,13 @@ g_buffered_input_stream_new_sized (GInputStream *base_stream,
* g_buffered_input_stream_fill_async().
*
* Returns: the number of bytes read into @stream's buffer, up to @count,
* or -1 on error.
* or -1 on error.
**/
gssize
g_buffered_input_stream_fill (GBufferedInputStream *stream,
gssize count,
GCancellable *cancellable,
GError **error)
gssize count,
GCancellable *cancellable,
GError **error)
{
GBufferedInputStreamClass *class;
GInputStream *input_stream;
......@@ -431,9 +430,9 @@ g_buffered_input_stream_fill (GBufferedInputStream *stream,
}
static void
async_fill_callback_wrapper (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
async_fill_callback_wrapper (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GBufferedInputStream *stream = G_BUFFERED_INPUT_STREAM (source_object);
......@@ -446,7 +445,7 @@ async_fill_callback_wrapper (GObject *source_object,
* g_buffered_input_stream_fill_async:
* @stream: #GBufferedInputStream.
* @count: a #gssize.
* @io_priority: the io priority of the request. the io priority of the request.
* @io_priority: the io priority of the request.
* @cancellable: optional #GCancellable object
* @callback: a #GAsyncReadyCallback.
* @user_data: a #gpointer.
......@@ -454,16 +453,14 @@ async_fill_callback_wrapper (GObject *source_object,
* Reads data into @stream's buffer asynchronously, up to @count size.
* @io_priority can be used to prioritize reads. For the synchronous
* version of this function, see g_buffered_input_stream_fill().
*
**/
void
g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
gssize count,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
gssize count,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GBufferedInputStreamClass *class;
GSimpleAsyncResult *simple;
......@@ -517,7 +514,7 @@ g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
stream->priv->outstanding_callback = callback;
g_object_ref (stream);
class->fill_async (stream, count, io_priority, cancellable,
async_fill_callback_wrapper, user_data);
async_fill_callback_wrapper, user_data);
}
/**
......@@ -532,8 +529,8 @@ g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
**/
gssize
g_buffered_input_stream_fill_finish (GBufferedInputStream *stream,
GAsyncResult *result,
GError **error)
GAsyncResult *result,
GError **error)
{
GSimpleAsyncResult *simple;
GBufferedInputStreamClass *class;
......@@ -545,11 +542,11 @@ g_buffered_input_stream_fill_finish (GBufferedInputStream *stream,
{
simple = G_SIMPLE_ASYNC_RESULT (result);
if (g_simple_async_result_propagate_error (simple, error))
return -1;
return -1;
/* Special case read of 0 bytes */
if (g_simple_async_result_get_source_tag (simple) == g_buffered_input_stream_fill_async)
return 0;
return 0;
}
class = G_BUFFERED_INPUT_STREAM_GET_CLASS (stream);
......@@ -565,7 +562,7 @@ g_buffered_input_stream_fill_finish (GBufferedInputStream *stream,
* Returns: size of the available stream.
**/
gsize
g_buffered_input_stream_get_available (GBufferedInputStream *stream)
g_buffered_input_stream_get_available (GBufferedInputStream *stream)
{
g_return_val_if_fail (G_IS_BUFFERED_INPUT_STREAM (stream), -1);
......@@ -579,16 +576,16 @@ g_buffered_input_stream_get_available (GBufferedInputStream *stream)
* @offset: a #gsize.
* @count: a #gsize.
*
* Peeks in the buffer, copying data of size @count into @buffer, offset
* @offset bytes.
* Peeks in the buffer, copying data of size @count into @buffer,
* offset @offset bytes.
*
* Returns: a #gsize of the number of bytes peeked, or %-1 on error.
**/
gsize
g_buffered_input_stream_peek (GBufferedInputStream *stream,
void *buffer,
gsize offset,
gsize count)
g_buffered_input_stream_peek (GBufferedInputStream *stream,
void *buffer,
gsize offset,
gsize count)
{
gsize available;
gsize end;
......@@ -620,8 +617,8 @@ g_buffered_input_stream_peek (GBufferedInputStream *stream,
* Returns: read-only buffer
**/
const void*
g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream,
gsize *count)
g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream,
gsize *count)
{
GBufferedInputStreamPrivate *priv;
......@@ -629,9 +626,8 @@ g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream,
priv = stream->priv;
if (count) {
if (count)
*count = priv->end - priv->pos;
}
return priv->buffer + priv->pos;
}
......@@ -646,19 +642,17 @@ compact_buffer (GBufferedInputStream *stream)
current_size = priv->end - priv->pos;
g_memmove (priv->buffer,
priv->buffer + priv->pos,
current_size);
g_memmove (priv->buffer, priv->buffer + priv->pos, current_size);
priv->pos = 0;
priv->end = current_size;
}
static gssize
g_buffered_input_stream_real_fill (GBufferedInputStream *stream,
gssize count,
GCancellable *cancellable,
GError **error)
g_buffered_input_stream_real_fill (GBufferedInputStream *stream,
gssize count,
GCancellable *cancellable,
GError **error)
{
GBufferedInputStreamPrivate *priv;
GInputStream *base_stream;
......@@ -693,10 +687,10 @@ g_buffered_input_stream_real_fill (GBufferedInputStream *stream,
}
static gssize
g_buffered_input_stream_skip (GInputStream *stream,
gsize count,
GCancellable *cancellable,
GError **error)
g_buffered_input_stream_skip (GInputStream *stream,
gsize count,
GCancellable *cancellable,
GError **error)
{
GBufferedInputStream *bstream;
GBufferedInputStreamPrivate *priv;
......@@ -715,7 +709,9 @@ g_buffered_input_stream_skip (GInputStream *stream,
return count;
}
/* Full request not available, skip all currently availbile and request refill for more */
/* Full request not available, skip all currently available and
* request refill for more
*/
priv->pos = 0;
priv->end = 0;
......@@ -732,15 +728,15 @@ g_buffered_input_stream_skip (GInputStream *stream,
base_stream = G_FILTER_INPUT_STREAM (stream)->base_stream;
nread = g_input_stream_skip (base_stream,
count,
cancellable,
error);
count,
cancellable,
error);
if (nread < 0 && bytes_skipped == 0)
return -1;
return -1;
if (nread > 0)
bytes_skipped += nread;
bytes_skipped += nread;
return bytes_skipped;
}
......@@ -752,9 +748,9 @@ g_buffered_input_stream_skip (GInputStream *stream,
if (nread < 0)
{
if (bytes_skipped == 0)
return -1;
return -1;
else
return bytes_skipped;
return bytes_skipped;
}
available = priv->end - priv->pos;
......@@ -815,10 +811,10 @@ g_buffered_input_stream_read (GInputStream *stream,
error);
if (nread < 0 && bytes_read == 0)
return -1;
return -1;
if (nread > 0)
bytes_read += nread;
bytes_read += nread;
return bytes_read;
}
......@@ -829,9 +825,9 @@ g_buffered_input_stream_read (GInputStream *stream,
if (nread < 0)
{
if (bytes_read == 0)
return -1;
return -1;
else
return bytes_read;
return bytes_read;
}
available = priv->end - priv->pos;
......@@ -924,9 +920,9 @@ g_buffered_input_stream_read_byte (GBufferedInputStream *stream,
/* ************************** */
static void
fill_async_callback (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
fill_async_callback (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
GError *error;
gssize res;
......@@ -951,12 +947,12 @@ fill_async_callback (GObject *source_object,
}
static void
g_buffered_input_stream_real_fill_async (GBufferedInputStream *stream,
gssize count,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
g_buffered_input_stream_real_fill_async (GBufferedInputStream *stream,
gssize count,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GBufferedInputStreamPrivate *priv;
GInputStream *base_stream;
......@@ -1364,5 +1360,3 @@ g_buffered_input_stream_skip_finish (GInputStream *stream,
#define __G_BUFFERED_INPUT_STREAM_C__
#include "gioaliasdef.c"
/* vim: ts=2 sw=2 et */
......@@ -762,5 +762,3 @@ g_buffered_output_stream_close_finish (GOutputStream *stream,
#define __G_BUFFERED_OUTPUT_STREAM_C__
#include "gioaliasdef.c"
/* vim: ts=2 sw=2 et */
......@@ -45,7 +45,7 @@
#include <windows.h>
static char *
get_registry_classes_key (const char *subdir,
get_registry_classes_key (const char *subdir,
const wchar_t *key_name)
{
wchar_t *wc_key;
......@@ -105,8 +105,8 @@ g_content_type_equals (const char *type1,
}
gboolean
g_content_type_is_a (const char *type,
const char *supertype)
g_content_type_is_a (const char *type,
const char *supertype)
{
gboolean res;
char *value_utf8;
......@@ -158,7 +158,7 @@ g_content_type_get_description (const char *type)
}
char *
g_content_type_get_mime_type (const char *type)
g_content_type_get_mime_type (const char *type)
{
char *mime;
......@@ -177,7 +177,7 @@ g_content_type_get_mime_type (const char *type)
}
GIcon *
g_content_type_get_icon (const char *type)
g_content_type_get_icon (const char *type)
{
g_return_val_if_fail (type != NULL, NULL);
......@@ -192,7 +192,7 @@ g_content_type_get_icon (const char *type)
}
gboolean
g_content_type_can_be_executable (const char *type)
g_content_type_can_be_executable (const char *type)
{
g_return_val_if_fail (type != NULL, FALSE);
......@@ -204,7 +204,8 @@ g_content_type_can_be_executable (const char *type)
}
static gboolean
looks_like_text (const guchar *data, gsize data_size)
looks_like_text (const guchar *data,
gsize data_size)
{
gsize i;
guchar c;
......@@ -352,8 +353,8 @@ _g_unix_content_type_get_parents (const char *type)
* %FALSE otherwise.
**/
gboolean
g_content_type_equals (const char *type1,
const char *type2)
g_content_type_equals (const char *type1,
const char *type2)
{
gboolean res;
......@@ -378,8 +379,8 @@ g_content_type_equals (const char *type1,
* %FALSE otherwise.
**/
gboolean
g_content_type_is_a (const char *type,
const char *supertype)
g_content_type_is_a (const char *type,
const char *supertype)
{
gboolean res;
......@@ -441,12 +442,12 @@ language_level (const char *lang)
}
static void
mime_info_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error)
mime_info_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error)
{
int i;
const char *lang;
......@@ -471,10 +472,10 @@ mime_info_start_element (GMarkupParseContext *context,
}
static void
mime_info_end_element (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
GError **error)
mime_info_end_element (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
GError **error)
{
MimeParser *parser = user_data;
......@@ -482,11 +483,11 @@ mime_info_end_element (GMarkupParseContext *context,
}
static void
mime_info_text (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
GError **error)
mime_info_text (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
GError **error)
{
MimeParser *parser = user_data;
......@@ -500,7 +501,8 @@ mime_info_text (GMarkupParseContext *context,
}
static char *
load_comment_for_mime_helper (const char *dir, const char *basename)
load_comment_for_mime_helper (const char *dir,
const char *basename)
{
GMarkupParseContext *context;
char *filename, *data;
......@@ -612,7 +614,7 @@ g_content_type_get_description (const char *type)
* Returns: the registered mime-type for the given @type.
**/
char *
g_content_type_get_mime_type (const char *type)
g_content_type_get_mime_type (const char *type)
{
g_return_val_if_fail (type != NULL, NULL);
......@@ -628,7 +630,7 @@ g_content_type_get_mime_type (const char *type)
* Returns: #GIcon corresponding to the content type.
**/
GIcon *
g_content_type_get_icon (const char *type)
g_content_type_get_icon (const char *type)
{
g_return_val_if_fail (type != NULL, NULL);
......@@ -647,7 +649,7 @@ g_content_type_get_icon (const char *type)
* can be executable, %FALSE otherwise.
**/
gboolean
g_content_type_can_be_executable (const char *type)
g_content_type_can_be_executable (const char *type)
{
g_return_val_if_fail (type != NULL, FALSE);
......@@ -777,9 +779,9 @@ g_content_type_guess (const char *filename,
}
static gboolean
foreach_mimetype (gpointer key,
gpointer value,
gpointer user_data)
foreach_mimetype (gpointer key,
gpointer value,
gpointer user_data)
{
GList **l = user_data;
......@@ -788,7 +790,9 @@ foreach_mimetype (gpointer key,
}
static void
enumerate_mimetypes_subdir (const char *dir, const char *prefix, GHashTable *mimetypes)
enumerate_mimetypes_subdir (const char *dir,
const char *prefix,
GHashTable *mimetypes)
{
DIR *d;
struct dirent *ent;
......@@ -810,7 +814,8 @@ enumerate_mimetypes_subdir (const char *dir, const char *prefix, GHashTable *mim
}
static void
enumerate_mimetypes_dir (const char *dir, GHashTable *mimetypes)
enumerate_mimetypes_dir (const char *dir,
GHashTable *mimetypes)
{
DIR *d;
struct dirent *ent;
......
......@@ -73,10 +73,10 @@ g_data_input_stream_class_init (GDataInputStreamClass *klass)
}