More coding style fixes

svn path=/trunk/; revision=5999
This commit is contained in:
Matthias Clasen
2007-11-30 05:11:25 +00:00
parent f3be1cf2d1
commit a2ca589703
34 changed files with 1129 additions and 1138 deletions

View File

@@ -1,3 +1,7 @@
2007-11-29 Matthias Clasen <mclasen@redhat.com>
* *.c: More coding style fixes.
2007-11-29 Matthias Clasen <mclasen@redhat.com> 2007-11-29 Matthias Clasen <mclasen@redhat.com>
* gasyncresult.c: Add another paragraph to the intro, * gasyncresult.c: Add another paragraph to the intro,

View File

@@ -458,13 +458,11 @@ g_buffered_output_stream_flush (GOutputStream *stream,
res = flush_buffer (bstream, cancellable, error); res = flush_buffer (bstream, cancellable, error);
if (res == FALSE) { if (res == FALSE)
return FALSE; return FALSE;
}
res = g_output_stream_flush (base_stream, res = g_output_stream_flush (base_stream, cancellable, error);
cancellable,
error);
return res; return res;
} }
@@ -486,17 +484,9 @@ g_buffered_output_stream_close (GOutputStream *stream,
/* report the first error but still close the stream */ /* report the first error but still close the stream */
if (res) if (res)
{ res = g_output_stream_close (base_stream, cancellable, error);
res = g_output_stream_close (base_stream,
cancellable,
error);
}
else else
{ g_output_stream_close (base_stream, cancellable, NULL);
g_output_stream_close (base_stream,
cancellable,
NULL);
}
return res; return res;
} }
@@ -545,11 +535,7 @@ flush_buffer_thread (GSimpleAsyncResult *result,
/* if flushing the buffer didn't work don't even bother /* if flushing the buffer didn't work don't even bother
* to flush the stream but just report that error */ * to flush the stream but just report that error */
if (res && fdata->flush_stream) if (res && fdata->flush_stream)
{ res = g_output_stream_flush (base_stream, cancellable, &error);
res = g_output_stream_flush (base_stream,
cancellable,
&error);
}
if (fdata->close_stream) if (fdata->close_stream)
{ {
@@ -558,18 +544,9 @@ flush_buffer_thread (GSimpleAsyncResult *result,
* an error report that first error but still try * an error report that first error but still try
* close the stream */ * close the stream */
if (res == FALSE) if (res == FALSE)
{ g_output_stream_close (base_stream, cancellable, NULL);
g_output_stream_close (base_stream,
cancellable,
NULL);
}
else else
{ res = g_output_stream_close (base_stream, cancellable, &error);
res = g_output_stream_close (base_stream,
cancellable,
&error);
}
} }
if (res == FALSE) if (res == FALSE)

View File

@@ -1184,23 +1184,24 @@ g_desktop_app_info_set_as_default_for_extension (GAppInfo *appinfo,
mimetype = g_strdup_printf ("application/x-extension-%s", extension); mimetype = g_strdup_printf ("application/x-extension-%s", extension);
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { if (!g_file_test (filename, G_FILE_TEST_EXISTS))
char *contents; {
char *contents;
contents = contents =
g_strdup_printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" g_strdup_printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\n" "<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\n"
" <mime-type type=\"%s\">\n" " <mime-type type=\"%s\">\n"
" <comment>%s document</comment>\n" " <comment>%s document</comment>\n"
" <glob pattern=\"*.%s\"/>\n" " <glob pattern=\"*.%s\"/>\n"
" </mime-type>\n" " </mime-type>\n"
"</mime-info>\n", mimetype, extension, extension); "</mime-info>\n", mimetype, extension, extension);
g_file_set_contents (filename, contents, -1, NULL); g_file_set_contents (filename, contents, -1, NULL);
g_free (contents); g_free (contents);
run_update_command ("update-mime-database", "mime"); run_update_command ("update-mime-database", "mime");
} }
g_free (filename); g_free (filename);
res = g_desktop_app_info_set_as_default_for_type (appinfo, res = g_desktop_app_info_set_as_default_for_type (appinfo,
@@ -2179,14 +2180,14 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type)
/* Go through all entries that support the mimetype */ /* Go through all entries that support the mimetype */
for (dir_list = mime_info_cache->dirs; for (dir_list = mime_info_cache->dirs;
dir_list != NULL; dir_list != NULL;
dir_list = dir_list->next) { dir_list = dir_list->next)
dir = dir_list->data; {
dir = dir_list->data;
list = g_hash_table_lookup (dir->mime_info_cache_map, mime_type); list = g_hash_table_lookup (dir->mime_info_cache_map, mime_type);
for (tmp = list; tmp != NULL; tmp = tmp->next) { for (tmp = list; tmp != NULL; tmp = tmp->next)
desktop_entries = append_desktop_entry (desktop_entries, tmp->data); desktop_entries = append_desktop_entry (desktop_entries, tmp->data);
} }
}
} }
G_UNLOCK (mime_info_cache); G_UNLOCK (mime_info_cache);

View File

@@ -270,17 +270,18 @@ g_dummy_file_contains_file (GFile *parent,
descendant_dummy->decoded_uri != NULL) descendant_dummy->decoded_uri != NULL)
{ {
if (uri_same_except_path (parent_dummy->decoded_uri, if (uri_same_except_path (parent_dummy->decoded_uri,
descendant_dummy->decoded_uri)) { descendant_dummy->decoded_uri))
remainder = match_prefix (descendant_dummy->decoded_uri->path, {
parent_dummy->decoded_uri->path); remainder = match_prefix (descendant_dummy->decoded_uri->path,
if (remainder != NULL && *remainder == '/') parent_dummy->decoded_uri->path);
{ if (remainder != NULL && *remainder == '/')
while (*remainder == '/') {
remainder++; while (*remainder == '/')
if (*remainder != 0) remainder++;
return TRUE; if (*remainder != 0)
} return TRUE;
} }
}
} }
else else
{ {
@@ -310,17 +311,18 @@ g_dummy_file_get_relative_path (GFile *parent,
descendant_dummy->decoded_uri != NULL) descendant_dummy->decoded_uri != NULL)
{ {
if (uri_same_except_path (parent_dummy->decoded_uri, if (uri_same_except_path (parent_dummy->decoded_uri,
descendant_dummy->decoded_uri)) { descendant_dummy->decoded_uri))
remainder = match_prefix (descendant_dummy->decoded_uri->path, {
parent_dummy->decoded_uri->path); remainder = match_prefix (descendant_dummy->decoded_uri->path,
if (remainder != NULL && *remainder == '/') parent_dummy->decoded_uri->path);
{ if (remainder != NULL && *remainder == '/')
while (*remainder == '/') {
remainder++; while (*remainder == '/')
if (*remainder != 0) remainder++;
return g_strdup (remainder); if (*remainder != 0)
} return g_strdup (remainder);
} }
}
} }
else else
{ {
@@ -340,7 +342,7 @@ g_dummy_file_get_relative_path (GFile *parent,
static GFile * static GFile *
g_dummy_file_resolve_relative_path (GFile *file, g_dummy_file_resolve_relative_path (GFile *file,
const char *relative_path) const char *relative_path)
{ {
GDummyFile *dummy = G_DUMMY_FILE (file); GDummyFile *dummy = G_DUMMY_FILE (file);
@@ -464,30 +466,32 @@ unescape_string (const gchar *escaped_string,
result = g_malloc (escaped_string_end - escaped_string + 1); result = g_malloc (escaped_string_end - escaped_string + 1);
out = result; out = result;
for (in = escaped_string; in < escaped_string_end; in++) { for (in = escaped_string; in < escaped_string_end; in++)
character = *in; {
if (*in == '%') { character = *in;
in++; if (*in == '%')
if (escaped_string_end - in < 2) {
{ in++;
g_free (result); if (escaped_string_end - in < 2)
return NULL; {
} g_free (result);
return NULL;
}
character = unescape_character (in); character = unescape_character (in);
/* Check for an illegal character. We consider '\0' illegal here. */ /* Check for an illegal character. We consider '\0' illegal here. */
if (character <= 0 || if (character <= 0 ||
(illegal_characters != NULL && (illegal_characters != NULL &&
strchr (illegal_characters, (char)character) != NULL)) strchr (illegal_characters, (char)character) != NULL))
{ {
g_free (result); g_free (result);
return NULL; return NULL;
} }
in++; /* The other char will be eaten in the loop header */ in++; /* The other char will be eaten in the loop header */
}
*out++ = (char)character;
} }
*out++ = (char)character;
}
*out = '\0'; *out = '\0';
g_assert (out - result <= strlen (escaped_string)); g_assert (out - result <= strlen (escaped_string));

View File

@@ -1749,16 +1749,17 @@ matcher_add (GFileAttributeMatcher *matcher,
* g_file_attribute_matcher_new: * g_file_attribute_matcher_new:
* @attributes: an attribute string to match. * @attributes: an attribute string to match.
* *
* Creates a new file attribute matcher, which matches attributes against * Creates a new file attribute matcher, which matches attributes
* a given string. #GFileAttributeMatcher<!-- -->s are reference counted structures, * against a given string. #GFileAttributeMatcher<!-- -->s are reference
* and are created with a reference count of 1. If the number of references * counted structures, and are created with a reference count of 1. If
* falls to 0, the #GFileAttributeMatcher is automatically destroyed. * the number of references falls to 0, the #GFileAttributeMatcher is
* automatically destroyed.
* *
* The @attribute string should be formatted with specific keys separated * The @attribute string should be formatted with specific keys separated
* from namespaces with a colon. Several "namespace:key" strings may be * from namespaces with a colon. Several "namespace:key" strings may be
* concatenated with a single comma (e.g. "std:type,std:is_hidden"). * concatenated with a single comma (e.g. "std:type,std:is_hidden").
* The wildcard "*" may be used to match all keys and namespaces, or "namespace:*" will * The wildcard "*" may be used to match all keys and namespaces, or
* match all keys in a given namespace. * "namespace:*" will match all keys in a given namespace.
* *
* Examples of strings to use: * Examples of strings to use:
* <table> * <table>

View File

@@ -29,14 +29,13 @@
/** /**
* SECTION:gicon * SECTION:gicon
* @short_description: base class for icons * @short_description: interface for icons
* *
* #GIcon is a base class for implementing more complex icon classes. It * #GIcon is a very minimal interface for icons. It provides functions
* contains a very minimal interface for checking the equality of two icons * for checking the equality of two icons and hashing of icons.
* and hashing of icons.
* *
* #GIcon does not provide the actual pixmap for the icon as this is out * #GIcon does not provide the actual pixmap for the icon as this is out
* of gio's scope, however implementations of #GIcon may contain the name * of GIO's scope, however implementations of #GIcon may contain the name
* of an icon (see #GThemedIcon), or the path to an icon (see #GLoadableIcon). * of an icon (see #GThemedIcon), or the path to an icon (see #GLoadableIcon).
* *
* To obtain a hash of a #GIcon, see g_icon_hash(). * To obtain a hash of a #GIcon, see g_icon_hash().

View File

@@ -32,8 +32,7 @@
* @short_description: Loadable Icons * @short_description: Loadable Icons
* @see_also: #GIcon, #GThemedIcon * @see_also: #GIcon, #GThemedIcon
* *
* Implements #GIcon and adds the ability to load icons. * Extends the #GIcon interface and adds the ability to load icons.
*
**/ **/
static void g_loadable_icon_real_load_async (GLoadableIcon *icon, static void g_loadable_icon_real_load_async (GLoadableIcon *icon,
@@ -122,7 +121,6 @@ g_loadable_icon_load (GLoadableIcon *icon,
iface = G_LOADABLE_ICON_GET_IFACE (icon); iface = G_LOADABLE_ICON_GET_IFACE (icon);
return (* iface->load) (icon, size, type, cancellable, error); return (* iface->load) (icon, size, type, cancellable, error);
} }
/** /**
@@ -136,7 +134,6 @@ g_loadable_icon_load (GLoadableIcon *icon,
* Loads an icon asynchronously. To finish this function, see * Loads an icon asynchronously. To finish this function, see
* g_loadable_icon_load_finish(). For the synchronous, blocking * g_loadable_icon_load_finish(). For the synchronous, blocking
* version of this function, see g_loadable_icon_load(). * version of this function, see g_loadable_icon_load().
*
**/ **/
void void
g_loadable_icon_load_async (GLoadableIcon *icon, g_loadable_icon_load_async (GLoadableIcon *icon,
@@ -152,7 +149,6 @@ g_loadable_icon_load_async (GLoadableIcon *icon,
iface = G_LOADABLE_ICON_GET_IFACE (icon); iface = G_LOADABLE_ICON_GET_IFACE (icon);
(* iface->load_async) (icon, size, cancellable, callback, user_data); (* iface->load_async) (icon, size, cancellable, callback, user_data);
} }
/** /**
@@ -188,7 +184,6 @@ g_loadable_icon_load_finish (GLoadableIcon *icon,
iface = G_LOADABLE_ICON_GET_IFACE (icon); iface = G_LOADABLE_ICON_GET_IFACE (icon);
return (* iface->load_finish) (icon, res, type, error); return (* iface->load_finish) (icon, res, type, error);
} }
/******************************************** /********************************************

View File

@@ -62,10 +62,10 @@ g_local_directory_monitor_finalize (GObject* object)
} }
static void static void
g_local_directory_monitor_set_property (GObject *object, g_local_directory_monitor_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
switch (property_id) switch (property_id)
{ {
@@ -79,9 +79,9 @@ g_local_directory_monitor_set_property (GObject *object,
} }
static GObject * static GObject *
g_local_directory_monitor_constructor (GType type, g_local_directory_monitor_constructor (GType type,
guint n_construct_properties, guint n_construct_properties,
GObjectConstructParam *construct_properties) GObjectConstructParam *construct_properties)
{ {
GObject *obj; GObject *obj;
GLocalDirectoryMonitorClass *klass; GLocalDirectoryMonitorClass *klass;
@@ -157,7 +157,7 @@ g_local_directory_monitor_init (GLocalDirectoryMonitor* local_monitor)
static void static void
mounts_changed (GUnixMountMonitor *mount_monitor, mounts_changed (GUnixMountMonitor *mount_monitor,
gpointer user_data) gpointer user_data)
{ {
GLocalDirectoryMonitor *local_monitor = user_data; GLocalDirectoryMonitor *local_monitor = user_data;
GUnixMount *mount; GUnixMount *mount;
@@ -190,7 +190,7 @@ mounts_changed (GUnixMountMonitor *mount_monitor,
static gint static gint
_compare_monitor_class_by_prio (gconstpointer a, _compare_monitor_class_by_prio (gconstpointer a,
gconstpointer b, gconstpointer b,
gpointer user_data) gpointer user_data)
{ {
GType *type1 = (GType *) a, *type2 = (GType *) b; GType *type1 = (GType *) a, *type2 = (GType *) b;
GLocalDirectoryMonitorClass *klass1, *klass2; GLocalDirectoryMonitorClass *klass1, *klass2;
@@ -261,7 +261,7 @@ get_default_local_directory_monitor (gpointer data)
* Returns: new #GDirectoryMonitor for the given @dirname. * Returns: new #GDirectoryMonitor for the given @dirname.
**/ **/
GDirectoryMonitor* GDirectoryMonitor*
_g_local_directory_monitor_new (const char* dirname, _g_local_directory_monitor_new (const char* dirname,
GFileMonitorFlags flags) GFileMonitorFlags flags)
{ {
static GOnce once_init = G_ONCE_INIT; static GOnce once_init = G_ONCE_INIT;

View File

@@ -284,7 +284,7 @@ g_local_file_is_native (GFile *file)
} }
static gboolean static gboolean
g_local_file_has_uri_scheme (GFile *file, g_local_file_has_uri_scheme (GFile *file,
const char *uri_scheme) const char *uri_scheme)
{ {
return g_ascii_strcasecmp (uri_scheme, "file") == 0; return g_ascii_strcasecmp (uri_scheme, "file") == 0;
@@ -330,7 +330,7 @@ get_filename_charset (const gchar **filename_charset)
static gboolean static gboolean
name_is_valid_for_display (const char *string, name_is_valid_for_display (const char *string,
gboolean is_valid_utf8) gboolean is_valid_utf8)
{ {
char c; char c;
@@ -452,7 +452,8 @@ g_local_file_equal (GFile *file1,
} }
static const char * static const char *
match_prefix (const char *path, const char *prefix) match_prefix (const char *path,
const char *prefix)
{ {
int prefix_len; int prefix_len;
@@ -492,7 +493,7 @@ g_local_file_get_relative_path (GFile *parent,
} }
static GFile * static GFile *
g_local_file_resolve_relative_path (GFile *file, g_local_file_resolve_relative_path (GFile *file,
const char *relative_path) const char *relative_path)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
@@ -510,11 +511,11 @@ g_local_file_resolve_relative_path (GFile *file,
} }
static GFileEnumerator * static GFileEnumerator *
g_local_file_enumerate_children (GFile *file, g_local_file_enumerate_children (GFile *file,
const char *attributes, const char *attributes,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
return _g_local_file_enumerator_new (local->filename, return _g_local_file_enumerator_new (local->filename,
@@ -553,96 +554,97 @@ get_fs_type (long f_type)
{ {
/* filesystem ids taken from linux manpage */ /* filesystem ids taken from linux manpage */
switch (f_type) { switch (f_type)
case 0xadf5: {
return "adfs"; case 0xadf5:
case 0xADFF: return "adfs";
return "affs"; case 0xADFF:
case 0x42465331: return "affs";
return "befs"; case 0x42465331:
case 0x1BADFACE: return "befs";
return "bfs"; case 0x1BADFACE:
case 0xFF534D42: return "bfs";
return "cifs"; case 0xFF534D42:
case 0x73757245: return "cifs";
return "coda"; case 0x73757245:
case 0x012FF7B7: return "coda";
return "coh"; case 0x012FF7B7:
case 0x28cd3d45: return "coh";
return "cramfs"; case 0x28cd3d45:
case 0x1373: return "cramfs";
return "devfs"; case 0x1373:
case 0x00414A53: return "devfs";
return "efs"; case 0x00414A53:
case 0x137D: return "efs";
return "ext"; case 0x137D:
case 0xEF51: return "ext";
return "ext2"; case 0xEF51:
case 0xEF53: return "ext2";
return "ext3"; case 0xEF53:
case 0x4244: return "ext3";
return "hfs"; case 0x4244:
case 0xF995E849: return "hfs";
return "hpfs"; case 0xF995E849:
case 0x958458f6: return "hpfs";
return "hugetlbfs"; case 0x958458f6:
case 0x9660: return "hugetlbfs";
return "isofs"; case 0x9660:
case 0x72b6: return "isofs";
return "jffs2"; case 0x72b6:
case 0x3153464a: return "jffs2";
return "jfs"; case 0x3153464a:
case 0x137F: return "jfs";
return "minix"; case 0x137F:
case 0x138F: return "minix";
return "minix2"; case 0x138F:
case 0x2468: return "minix2";
return "minix2"; case 0x2468:
case 0x2478: return "minix2";
return "minix22"; case 0x2478:
case 0x4d44: return "minix22";
return "msdos"; case 0x4d44:
case 0x564c: return "msdos";
return "ncp"; case 0x564c:
case 0x6969: return "ncp";
return "nfs"; case 0x6969:
case 0x5346544e: return "nfs";
return "ntfs"; case 0x5346544e:
case 0x9fa1: return "ntfs";
return "openprom"; case 0x9fa1:
case 0x9fa0: return "openprom";
return "proc"; case 0x9fa0:
case 0x002f: return "proc";
return "qnx4"; case 0x002f:
case 0x52654973: return "qnx4";
return "reiserfs"; case 0x52654973:
case 0x7275: return "reiserfs";
return "romfs"; case 0x7275:
case 0x517B: return "romfs";
return "smb"; case 0x517B:
case 0x012FF7B6: return "smb";
return "sysv2"; case 0x012FF7B6:
case 0x012FF7B5: return "sysv2";
return "sysv4"; case 0x012FF7B5:
case 0x01021994: return "sysv4";
return "tmpfs"; case 0x01021994:
case 0x15013346: return "tmpfs";
return "udf"; case 0x15013346:
case 0x00011954: return "udf";
return "ufs"; case 0x00011954:
case 0x9fa2: return "ufs";
return "usbdevice"; case 0x9fa2:
case 0xa501FCF5: return "usbdevice";
return "vxfs"; case 0xa501FCF5:
case 0x012FF7B4: return "vxfs";
return "xenix"; case 0x012FF7B4:
case 0x58465342: return "xenix";
return "xfs"; case 0x58465342:
case 0x012FD16D: return "xfs";
return "xiafs"; case 0x012FD16D:
default: return "xiafs";
return NULL; default:
} return NULL;
}
} }
#endif #endif
@@ -656,20 +658,20 @@ typedef enum {
static gboolean static gboolean
device_equal (gconstpointer v1, device_equal (gconstpointer v1,
gconstpointer v2) gconstpointer v2)
{ {
return *(dev_t *)v1 == * (dev_t *)v2; return *(dev_t *)v1 == * (dev_t *)v2;
} }
static guint static guint
device_hash (gconstpointer v) device_hash (gconstpointer v)
{ {
return (guint) *(dev_t *)v; return (guint) *(dev_t *)v;
} }
static void static void
get_mount_info (GFileInfo *fs_info, get_mount_info (GFileInfo *fs_info,
const char *path, const char *path,
GFileAttributeMatcher *matcher) GFileAttributeMatcher *matcher)
{ {
struct stat buf; struct stat buf;
@@ -734,10 +736,10 @@ get_mount_info (GFileInfo *fs_info,
} }
static GFileInfo * static GFileInfo *
g_local_file_query_filesystem_info (GFile *file, g_local_file_query_filesystem_info (GFile *file,
const char *attributes, const char *attributes,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
GFileInfo *info; GFileInfo *info;
@@ -820,9 +822,9 @@ g_local_file_query_filesystem_info (GFile *file,
} }
static GVolume * static GVolume *
g_local_file_find_enclosing_volume (GFile *file, g_local_file_find_enclosing_volume (GFile *file,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
struct stat buf; struct stat buf;
@@ -858,10 +860,10 @@ g_local_file_find_enclosing_volume (GFile *file,
} }
static GFile * static GFile *
g_local_file_set_display_name (GFile *file, g_local_file_set_display_name (GFile *file,
const char *display_name, const char *display_name,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local, *new_local; GLocalFile *local, *new_local;
GFile *new_file, *parent; GFile *new_file, *parent;
@@ -950,28 +952,28 @@ g_local_file_query_info (GFile *file,
} }
static GFileAttributeInfoList * static GFileAttributeInfoList *
g_local_file_query_settable_attributes (GFile *file, g_local_file_query_settable_attributes (GFile *file,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
return g_file_attribute_info_list_ref (local_writable_attributes); return g_file_attribute_info_list_ref (local_writable_attributes);
} }
static GFileAttributeInfoList * static GFileAttributeInfoList *
g_local_file_query_writable_namespaces (GFile *file, g_local_file_query_writable_namespaces (GFile *file,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
return g_file_attribute_info_list_ref (local_writable_namespaces); return g_file_attribute_info_list_ref (local_writable_namespaces);
} }
static gboolean static gboolean
g_local_file_set_attribute (GFile *file, g_local_file_set_attribute (GFile *file,
const char *attribute, const char *attribute,
const GFileAttributeValue *value, const GFileAttributeValue *value,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
@@ -984,11 +986,11 @@ g_local_file_set_attribute (GFile *file,
} }
static gboolean static gboolean
g_local_file_set_attributes_from_info (GFile *file, g_local_file_set_attributes_from_info (GFile *file,
GFileInfo *info, GFileInfo *info,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
int res, chained_res; int res, chained_res;
@@ -1010,9 +1012,9 @@ g_local_file_set_attributes_from_info (GFile *file,
} }
static GFileInputStream * static GFileInputStream *
g_local_file_read (GFile *file, g_local_file_read (GFile *file,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
int fd; int fd;
@@ -1041,32 +1043,32 @@ g_local_file_read (GFile *file,
} }
static GFileOutputStream * static GFileOutputStream *
g_local_file_append_to (GFile *file, g_local_file_append_to (GFile *file,
GFileCreateFlags flags, GFileCreateFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
return _g_local_file_output_stream_append (G_LOCAL_FILE (file)->filename, return _g_local_file_output_stream_append (G_LOCAL_FILE (file)->filename,
flags, cancellable, error); flags, cancellable, error);
} }
static GFileOutputStream * static GFileOutputStream *
g_local_file_create (GFile *file, g_local_file_create (GFile *file,
GFileCreateFlags flags, GFileCreateFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
return _g_local_file_output_stream_create (G_LOCAL_FILE (file)->filename, return _g_local_file_output_stream_create (G_LOCAL_FILE (file)->filename,
flags, cancellable, error); flags, cancellable, error);
} }
static GFileOutputStream * static GFileOutputStream *
g_local_file_replace (GFile *file, g_local_file_replace (GFile *file,
const char *etag, const char *etag,
gboolean make_backup, gboolean make_backup,
GFileCreateFlags flags, GFileCreateFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
return _g_local_file_output_stream_replace (G_LOCAL_FILE (file)->filename, return _g_local_file_output_stream_replace (G_LOCAL_FILE (file)->filename,
etag, make_backup, flags, etag, make_backup, flags,
@@ -1075,9 +1077,9 @@ g_local_file_replace (GFile *file,
static gboolean static gboolean
g_local_file_delete (GFile *file, g_local_file_delete (GFile *file,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
@@ -1139,7 +1141,8 @@ expand_symlink (const char *link)
} }
static char * static char *
get_parent (const char *path, dev_t *parent_dev) get_parent (const char *path,
dev_t *parent_dev)
{ {
char *parent, *tmp; char *parent, *tmp;
struct stat parent_stat; struct stat parent_stat;
@@ -1209,7 +1212,8 @@ expand_all_symlinks (const char *path)
} }
static char * static char *
find_mountpoint_for (const char *file, dev_t dev) find_mountpoint_for (const char *file,
dev_t dev)
{ {
char *dir, *parent; char *dir, *parent;
dev_t dir_dev, parent_dev; dev_t dir_dev, parent_dev;
@@ -1217,20 +1221,21 @@ find_mountpoint_for (const char *file, dev_t dev)
dir = g_strdup (file); dir = g_strdup (file);
dir_dev = dev; dir_dev = dev;
while (1) { while (1)
parent = get_parent (dir, &parent_dev); {
if (parent == NULL) parent = get_parent (dir, &parent_dev);
return dir; if (parent == NULL)
return dir;
if (parent_dev != dir_dev) if (parent_dev != dir_dev)
{ {
g_free (parent); g_free (parent);
return dir; return dir;
} }
g_free (dir); g_free (dir);
dir = parent; dir = parent;
} }
} }
static char * static char *
@@ -1247,7 +1252,8 @@ find_topdir_for (const char *file)
} }
static char * static char *
get_unique_filename (const char *basename, int id) get_unique_filename (const char *basename,
int id)
{ {
const char *dot; const char *dot;
@@ -1262,7 +1268,8 @@ get_unique_filename (const char *basename, int id)
} }
static gboolean static gboolean
path_has_prefix (const char *path, const char *prefix) path_has_prefix (const char *path,
const char *prefix)
{ {
int prefix_len; int prefix_len;
@@ -1282,7 +1289,8 @@ path_has_prefix (const char *path, const char *prefix)
} }
static char * static char *
try_make_relative (const char *path, const char *base) try_make_relative (const char *path,
const char *base)
{ {
char *path2, *base2; char *path2, *base2;
char *relative; char *relative;
@@ -1336,9 +1344,9 @@ escape_trash_name (char *name)
} }
static gboolean static gboolean
g_local_file_trash (GFile *file, g_local_file_trash (GFile *file,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
struct stat file_stat, home_stat, trash_stat, global_stat; struct stat file_stat, home_stat, trash_stat, global_stat;
@@ -1575,9 +1583,9 @@ g_local_file_trash (GFile *file,
} }
static gboolean static gboolean
g_local_file_make_directory (GFile *file, g_local_file_make_directory (GFile *file,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
@@ -1602,10 +1610,10 @@ g_local_file_make_directory (GFile *file,
} }
static gboolean static gboolean
g_local_file_make_symbolic_link (GFile *file, g_local_file_make_symbolic_link (GFile *file,
const char *symlink_value, const char *symlink_value,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
#ifdef HAVE_SYMLINK #ifdef HAVE_SYMLINK
GLocalFile *local = G_LOCAL_FILE (file); GLocalFile *local = G_LOCAL_FILE (file);
@@ -1635,13 +1643,13 @@ g_local_file_make_symbolic_link (GFile *file,
static gboolean static gboolean
g_local_file_copy (GFile *source, g_local_file_copy (GFile *source,
GFile *destination, GFile *destination,
GFileCopyFlags flags, GFileCopyFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GFileProgressCallback progress_callback, GFileProgressCallback progress_callback,
gpointer progress_callback_data, gpointer progress_callback_data,
GError **error) GError **error)
{ {
/* Fall back to default copy */ /* Fall back to default copy */
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Copy not supported"); g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Copy not supported");
@@ -1649,13 +1657,13 @@ g_local_file_copy (GFile *source,
} }
static gboolean static gboolean
g_local_file_move (GFile *source, g_local_file_move (GFile *source,
GFile *destination, GFile *destination,
GFileCopyFlags flags, GFileCopyFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GFileProgressCallback progress_callback, GFileProgressCallback progress_callback,
gpointer progress_callback_data, gpointer progress_callback_data,
GError **error) GError **error)
{ {
GLocalFile *local_source = G_LOCAL_FILE (source); GLocalFile *local_source = G_LOCAL_FILE (source);
GLocalFile *local_destination = G_LOCAL_FILE (destination); GLocalFile *local_destination = G_LOCAL_FILE (destination);
@@ -1770,18 +1778,18 @@ g_local_file_move (GFile *source,
static GDirectoryMonitor* static GDirectoryMonitor*
g_local_file_monitor_dir (GFile* file, g_local_file_monitor_dir (GFile *file,
GFileMonitorFlags flags, GFileMonitorFlags flags,
GCancellable *cancellable) GCancellable *cancellable)
{ {
GLocalFile* local_file = G_LOCAL_FILE(file); GLocalFile* local_file = G_LOCAL_FILE(file);
return _g_local_directory_monitor_new (local_file->filename, flags); return _g_local_directory_monitor_new (local_file->filename, flags);
} }
static GFileMonitor* static GFileMonitor*
g_local_file_monitor_file (GFile* file, g_local_file_monitor_file (GFile *file,
GFileMonitorFlags flags, GFileMonitorFlags flags,
GCancellable *cancellable) GCancellable *cancellable)
{ {
GLocalFile* local_file = G_LOCAL_FILE(file); GLocalFile* local_file = G_LOCAL_FILE(file);
return _g_local_file_monitor_new (local_file->filename, flags); return _g_local_file_monitor_new (local_file->filename, flags);

View File

@@ -102,7 +102,7 @@ g_local_file_enumerator_init (GLocalFileEnumerator *local)
static void static void
convert_file_to_io_error (GError **error, convert_file_to_io_error (GError **error,
GError *file_error) GError *file_error)
{ {
int new_code; int new_code;
@@ -111,21 +111,23 @@ convert_file_to_io_error (GError **error,
new_code = G_IO_ERROR_FAILED; new_code = G_IO_ERROR_FAILED;
if (file_error->domain == G_FILE_ERROR) { if (file_error->domain == G_FILE_ERROR)
switch (file_error->code) { {
case G_FILE_ERROR_NOENT: switch (file_error->code)
new_code = G_IO_ERROR_NOT_FOUND; {
break; case G_FILE_ERROR_NOENT:
case G_FILE_ERROR_ACCES: new_code = G_IO_ERROR_NOT_FOUND;
new_code = G_IO_ERROR_PERMISSION_DENIED; break;
break; case G_FILE_ERROR_ACCES:
case G_FILE_ERROR_NOTDIR: new_code = G_IO_ERROR_PERMISSION_DENIED;
new_code = G_IO_ERROR_NOT_DIRECTORY; break;
break; case G_FILE_ERROR_NOTDIR:
default: new_code = G_IO_ERROR_NOT_DIRECTORY;
break; break;
default:
break;
}
} }
}
g_set_error (error, G_IO_ERROR, g_set_error (error, G_IO_ERROR,
new_code, new_code,
@@ -133,11 +135,11 @@ convert_file_to_io_error (GError **error,
} }
GFileEnumerator * GFileEnumerator *
_g_local_file_enumerator_new (const char *filename, _g_local_file_enumerator_new (const char *filename,
const char *attributes, const char *attributes,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileEnumerator *local; GLocalFileEnumerator *local;
GDir *dir; GDir *dir;
@@ -145,11 +147,12 @@ _g_local_file_enumerator_new (const char *filename,
dir_error = NULL; dir_error = NULL;
dir = g_dir_open (filename, 0, error != NULL ? &dir_error : NULL); dir = g_dir_open (filename, 0, error != NULL ? &dir_error : NULL);
if (dir == NULL) { if (dir == NULL)
convert_file_to_io_error (error, dir_error); {
g_error_free (dir_error); convert_file_to_io_error (error, dir_error);
return NULL; g_error_free (dir_error);
} return NULL;
}
local = g_object_new (G_TYPE_LOCAL_FILE_ENUMERATOR, NULL); local = g_object_new (G_TYPE_LOCAL_FILE_ENUMERATOR, NULL);
@@ -162,9 +165,9 @@ _g_local_file_enumerator_new (const char *filename,
} }
static GFileInfo * static GFileInfo *
g_local_file_enumerator_next_file (GFileEnumerator *enumerator, g_local_file_enumerator_next_file (GFileEnumerator *enumerator,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileEnumerator *local = G_LOCAL_FILE_ENUMERATOR (enumerator); GLocalFileEnumerator *local = G_LOCAL_FILE_ENUMERATOR (enumerator);
const char *filename; const char *filename;
@@ -212,7 +215,7 @@ g_local_file_enumerator_next_file (GFileEnumerator *enumerator,
} }
static gboolean static gboolean
g_local_file_enumerator_close (GFileEnumerator *enumerator, g_local_file_enumerator_close (GFileEnumerator *enumerator,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {

View File

@@ -149,10 +149,10 @@ read_link (const gchar *full_name)
/* Get the SELinux security context */ /* Get the SELinux security context */
static void static void
get_selinux_context (const char *path, get_selinux_context (const char *path,
GFileInfo *info, GFileInfo *info,
GFileAttributeMatcher *attribute_matcher, GFileAttributeMatcher *attribute_matcher,
gboolean follow_symlinks) gboolean follow_symlinks)
{ {
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
char *context; char *context;
@@ -202,7 +202,8 @@ name_is_valid (const char *str)
} }
static char * static char *
hex_escape_string (const char *str, gboolean *free_return) hex_escape_string (const char *str,
gboolean *free_return)
{ {
int num_invalid, i; int num_invalid, i;
char *escaped_str, *p; char *escaped_str, *p;
@@ -248,7 +249,9 @@ hex_escape_string (const char *str, gboolean *free_return)
} }
static char * static char *
hex_unescape_string (const char *str, int *out_len, gboolean *free_return) hex_unescape_string (const char *str,
int *out_len,
gboolean *free_return)
{ {
int i; int i;
char *unescaped_str, *p; char *unescaped_str, *p;
@@ -292,10 +295,10 @@ hex_unescape_string (const char *str, int *out_len, gboolean *free_return)
} }
static void static void
escape_xattr (GFileInfo *info, escape_xattr (GFileInfo *info,
const char *gio_attr, /* gio attribute name */ const char *gio_attr, /* gio attribute name */
const char *value, /* Is zero terminated */ const char *value, /* Is zero terminated */
size_t len /* not including zero termination */) size_t len /* not including zero termination */)
{ {
char *escaped_val; char *escaped_val;
gboolean free_escaped_val; gboolean free_escaped_val;
@@ -310,10 +313,10 @@ escape_xattr (GFileInfo *info,
static void static void
get_one_xattr (const char *path, get_one_xattr (const char *path,
GFileInfo *info, GFileInfo *info,
const char *gio_attr, const char *gio_attr,
const char *xattr, const char *xattr,
gboolean follow_symlinks) gboolean follow_symlinks)
{ {
char value[64]; char value[64];
char *value_p; char *value_p;
@@ -365,11 +368,11 @@ get_one_xattr (const char *path,
#endif /* defined HAVE_XATTR */ #endif /* defined HAVE_XATTR */
static void static void
get_xattrs (const char *path, get_xattrs (const char *path,
gboolean user, gboolean user,
GFileInfo *info, GFileInfo *info,
GFileAttributeMatcher *matcher, GFileAttributeMatcher *matcher,
gboolean follow_symlinks) gboolean follow_symlinks)
{ {
#ifdef HAVE_XATTR #ifdef HAVE_XATTR
gboolean all; gboolean all;
@@ -480,8 +483,8 @@ get_xattrs (const char *path,
#ifdef HAVE_XATTR #ifdef HAVE_XATTR
static void static void
get_one_xattr_from_fd (int fd, get_one_xattr_from_fd (int fd,
GFileInfo *info, GFileInfo *info,
const char *gio_attr, const char *gio_attr,
const char *xattr) const char *xattr)
{ {
@@ -525,9 +528,9 @@ get_one_xattr_from_fd (int fd,
#endif /* defined HAVE_XATTR */ #endif /* defined HAVE_XATTR */
static void static void
get_xattrs_from_fd (int fd, get_xattrs_from_fd (int fd,
gboolean user, gboolean user,
GFileInfo *info, GFileInfo *info,
GFileAttributeMatcher *matcher) GFileAttributeMatcher *matcher)
{ {
#ifdef HAVE_XATTR #ifdef HAVE_XATTR
@@ -633,10 +636,10 @@ get_xattrs_from_fd (int fd,
#ifdef HAVE_XATTR #ifdef HAVE_XATTR
static gboolean static gboolean
set_xattr (char *filename, set_xattr (char *filename,
const char *escaped_attribute, const char *escaped_attribute,
const GFileAttributeValue *attr_value, const GFileAttributeValue *attr_value,
GError **error) GError **error)
{ {
char *attribute, *value; char *attribute, *value;
gboolean free_attribute, free_value; gboolean free_attribute, free_value;
@@ -680,7 +683,6 @@ set_xattr (char *filename,
attribute = hex_unescape_string (escaped_attribute, NULL, &free_attribute); attribute = hex_unescape_string (escaped_attribute, NULL, &free_attribute);
value = hex_unescape_string (attr_value->u.string, &val_len, &free_value); value = hex_unescape_string (attr_value->u.string, &val_len, &free_value);
if (is_user) if (is_user)
a = g_strconcat ("user.", attribute, NULL); a = g_strconcat ("user.", attribute, NULL);
else else
@@ -714,9 +716,9 @@ set_xattr (char *filename,
void void
_g_local_file_info_get_parent_info (const char *dir, _g_local_file_info_get_parent_info (const char *dir,
GFileAttributeMatcher *attribute_matcher, GFileAttributeMatcher *attribute_matcher,
GLocalParentFileInfo *parent_info) GLocalParentFileInfo *parent_info)
{ {
struct stat statbuf; struct stat statbuf;
int res; int res;
@@ -750,10 +752,10 @@ _g_local_file_info_get_parent_info (const char *dir,
static void static void
get_access_rights (GFileAttributeMatcher *attribute_matcher, get_access_rights (GFileAttributeMatcher *attribute_matcher,
GFileInfo *info, GFileInfo *info,
const gchar *path, const gchar *path,
struct stat *statbuf, struct stat *statbuf,
GLocalParentFileInfo *parent_info) GLocalParentFileInfo *parent_info)
{ {
if (g_file_attribute_matcher_matches (attribute_matcher, if (g_file_attribute_matcher_matches (attribute_matcher,
G_FILE_ATTRIBUTE_ACCESS_CAN_READ)) G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
@@ -807,7 +809,8 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher,
} }
static void static void
set_info_from_stat (GFileInfo *info, struct stat *statbuf, set_info_from_stat (GFileInfo *info,
struct stat *statbuf,
GFileAttributeMatcher *attribute_matcher) GFileAttributeMatcher *attribute_matcher)
{ {
GFileType file_type; GFileType file_type;
@@ -1098,13 +1101,13 @@ get_groupname_from_gid (gid_t gid)
} }
static char * static char *
get_content_type (const char *basename, get_content_type (const char *basename,
const char *path, const char *path,
struct stat *statbuf, struct stat *statbuf,
gboolean is_symlink, gboolean is_symlink,
gboolean symlink_broken, gboolean symlink_broken,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
gboolean fast) gboolean fast)
{ {
if (is_symlink && if (is_symlink &&
(symlink_broken || (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS))) (symlink_broken || (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)))
@@ -1161,7 +1164,8 @@ get_content_type (const char *basename,
} }
static char * static char *
thumb_digest_to_ascii (unsigned char digest[16], const char *suffix) thumb_digest_to_ascii (unsigned char digest[16],
const char *suffix)
{ {
static const char hex_digits[] = "0123456789abcdef"; static const char hex_digits[] = "0123456789abcdef";
char *res; char *res;
@@ -1169,10 +1173,11 @@ thumb_digest_to_ascii (unsigned char digest[16], const char *suffix)
res = g_malloc (33 + strlen (suffix)); res = g_malloc (33 + strlen (suffix));
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++)
res[2*i] = hex_digits[digest[i] >> 4]; {
res[2*i+1] = hex_digits[digest[i] & 0xf]; res[2*i] = hex_digits[digest[i] >> 4];
} res[2*i+1] = hex_digits[digest[i] & 0xf];
}
res[32] = 0; res[32] = 0;
@@ -1184,7 +1189,7 @@ thumb_digest_to_ascii (unsigned char digest[16], const char *suffix)
static void static void
get_thumbnail_attributes (const char *path, get_thumbnail_attributes (const char *path,
GFileInfo *info) GFileInfo *info)
{ {
char *uri; char *uri;
unsigned char digest[16]; unsigned char digest[16];
@@ -1215,12 +1220,12 @@ get_thumbnail_attributes (const char *path,
GFileInfo * GFileInfo *
_g_local_file_info_get (const char *basename, _g_local_file_info_get (const char *basename,
const char *path, const char *path,
GFileAttributeMatcher *attribute_matcher, GFileAttributeMatcher *attribute_matcher,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GLocalParentFileInfo *parent_info, GLocalParentFileInfo *parent_info,
GError **error) GError **error)
{ {
GFileInfo *info; GFileInfo *info;
struct stat statbuf; struct stat statbuf;
@@ -1452,8 +1457,8 @@ _g_local_file_info_get (const char *basename,
} }
GFileInfo * GFileInfo *
_g_local_file_info_get_from_fd (int fd, _g_local_file_info_get_from_fd (int fd,
char *attributes, char *attributes,
GError **error) GError **error)
{ {
struct stat stat_buf; struct stat stat_buf;
@@ -1502,9 +1507,9 @@ _g_local_file_info_get_from_fd (int fd,
} }
static gboolean static gboolean
get_uint32 (const GFileAttributeValue *value, get_uint32 (const GFileAttributeValue *value,
guint32 *val_out, guint32 *val_out,
GError **error) GError **error)
{ {
if (value->type != G_FILE_ATTRIBUTE_TYPE_UINT32) if (value->type != G_FILE_ATTRIBUTE_TYPE_UINT32)
{ {
@@ -1519,9 +1524,9 @@ get_uint32 (const GFileAttributeValue *value,
} }
static gboolean static gboolean
get_uint64 (const GFileAttributeValue *value, get_uint64 (const GFileAttributeValue *value,
guint64 *val_out, guint64 *val_out,
GError **error) GError **error)
{ {
if (value->type != G_FILE_ATTRIBUTE_TYPE_UINT64) if (value->type != G_FILE_ATTRIBUTE_TYPE_UINT64)
{ {
@@ -1537,9 +1542,9 @@ get_uint64 (const GFileAttributeValue *value,
#if defined(HAVE_SYMLINK) #if defined(HAVE_SYMLINK)
static gboolean static gboolean
get_byte_string (const GFileAttributeValue *value, get_byte_string (const GFileAttributeValue *value,
const char **val_out, const char **val_out,
GError **error) GError **error)
{ {
if (value->type != G_FILE_ATTRIBUTE_TYPE_BYTE_STRING) if (value->type != G_FILE_ATTRIBUTE_TYPE_BYTE_STRING)
{ {
@@ -1555,9 +1560,9 @@ get_byte_string (const GFileAttributeValue *value,
#endif #endif
static gboolean static gboolean
set_unix_mode (char *filename, set_unix_mode (char *filename,
const GFileAttributeValue *value, const GFileAttributeValue *value,
GError **error) GError **error)
{ {
guint32 val; guint32 val;
@@ -1577,11 +1582,11 @@ set_unix_mode (char *filename,
#ifdef HAVE_CHOWN #ifdef HAVE_CHOWN
static gboolean static gboolean
set_unix_uid_gid (char *filename, set_unix_uid_gid (char *filename,
const GFileAttributeValue *uid_value, const GFileAttributeValue *uid_value,
const GFileAttributeValue *gid_value, const GFileAttributeValue *gid_value,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GError **error) GError **error)
{ {
int res; int res;
guint32 val; guint32 val;
@@ -1625,9 +1630,9 @@ set_unix_uid_gid (char *filename,
#ifdef HAVE_SYMLINK #ifdef HAVE_SYMLINK
static gboolean static gboolean
set_symlink (char *filename, set_symlink (char *filename,
const GFileAttributeValue *value, const GFileAttributeValue *value,
GError **error) GError **error)
{ {
const char *val; const char *val;
struct stat statbuf; struct stat statbuf;
@@ -1682,7 +1687,9 @@ set_symlink (char *filename,
#endif #endif
static int static int
lazy_stat (char *filename, struct stat *statbuf, gboolean *called_stat) lazy_stat (char *filename,
struct stat *statbuf,
gboolean *called_stat)
{ {
int res; int res;
@@ -1700,12 +1707,12 @@ lazy_stat (char *filename, struct stat *statbuf, gboolean *called_stat)
#ifdef HAVE_UTIMES #ifdef HAVE_UTIMES
static gboolean static gboolean
set_mtime_atime (char *filename, set_mtime_atime (char *filename,
const GFileAttributeValue *mtime_value, const GFileAttributeValue *mtime_value,
const GFileAttributeValue *mtime_usec_value, const GFileAttributeValue *mtime_usec_value,
const GFileAttributeValue *atime_value, const GFileAttributeValue *atime_value,
const GFileAttributeValue *atime_usec_value, const GFileAttributeValue *atime_usec_value,
GError **error) GError **error)
{ {
int res; int res;
guint64 val; guint64 val;
@@ -1782,12 +1789,12 @@ set_mtime_atime (char *filename,
#endif #endif
gboolean gboolean
_g_local_file_info_set_attribute (char *filename, _g_local_file_info_set_attribute (char *filename,
const char *attribute, const char *attribute,
const GFileAttributeValue *value, const GFileAttributeValue *value,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_MODE) == 0) if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_MODE) == 0)
return set_unix_mode (filename, value, error); return set_unix_mode (filename, value, error);
@@ -1828,11 +1835,11 @@ _g_local_file_info_set_attribute (char *filename,
} }
gboolean gboolean
_g_local_file_info_set_attributes (char *filename, _g_local_file_info_set_attributes (char *filename,
GFileInfo *info, GFileInfo *info,
GFileQueryInfoFlags flags, GFileQueryInfoFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GFileAttributeValue *value, *uid, *gid; GFileAttributeValue *value, *uid, *gid;
GFileAttributeValue *mtime, *mtime_usec, *atime, *atime_usec; GFileAttributeValue *mtime, *mtime_usec, *atime, *atime_usec;
@@ -1989,7 +1996,8 @@ thumb_md5 (const char *string, unsigned char digest[16])
* Note: this code is harmless on little-endian machines. * Note: this code is harmless on little-endian machines.
*/ */
static void static void
byteReverse(unsigned char *buf, unsigned longs) byteReverse (unsigned char *buf,
unsigned longs)
{ {
guint32 t; guint32 t;
do { do {
@@ -2024,8 +2032,8 @@ thumb_md5_init (struct ThumbMD5Context *ctx)
*/ */
static void static void
thumb_md5_update (struct ThumbMD5Context *ctx, thumb_md5_update (struct ThumbMD5Context *ctx,
unsigned char const *buf, unsigned char const *buf,
unsigned len) unsigned len)
{ {
guint32 t; guint32 t;
@@ -2075,7 +2083,8 @@ thumb_md5_update (struct ThumbMD5Context *ctx,
* 1 0* (64-bit count of bits processed, MSB-first) * 1 0* (64-bit count of bits processed, MSB-first)
*/ */
static void static void
thumb_md5_final (unsigned char digest[16], struct ThumbMD5Context *ctx) thumb_md5_final (unsigned char digest[16],
struct ThumbMD5Context *ctx)
{ {
unsigned count; unsigned count;
unsigned char *p; unsigned char *p;
@@ -2134,7 +2143,8 @@ thumb_md5_final (unsigned char digest[16], struct ThumbMD5Context *ctx)
* the data and converts bytes into longwords for this routine. * the data and converts bytes into longwords for this routine.
*/ */
static void static void
thumb_md5_transform (guint32 buf[4], guint32 const in[16]) thumb_md5_transform (guint32 buf[4],
guint32 const in[16])
{ {
register guint32 a, b, c, d; register guint32 a, b, c, d;

View File

@@ -125,11 +125,11 @@ _g_local_file_input_stream_new (int fd)
} }
static gssize static gssize
g_local_file_input_stream_read (GInputStream *stream, g_local_file_input_stream_read (GInputStream *stream,
void *buffer, void *buffer,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileInputStream *file; GLocalFileInputStream *file;
gssize res; gssize res;
@@ -160,10 +160,10 @@ g_local_file_input_stream_read (GInputStream *stream,
} }
static gssize static gssize
g_local_file_input_stream_skip (GInputStream *stream, g_local_file_input_stream_skip (GInputStream *stream,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
off_t res, start; off_t res, start;
GLocalFileInputStream *file; GLocalFileInputStream *file;
@@ -197,9 +197,9 @@ g_local_file_input_stream_skip (GInputStream *stream,
} }
static gboolean static gboolean
g_local_file_input_stream_close (GInputStream *stream, g_local_file_input_stream_close (GInputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileInputStream *file; GLocalFileInputStream *file;
int res; int res;
@@ -213,12 +213,10 @@ g_local_file_input_stream_close (GInputStream *stream,
{ {
res = close (file->priv->fd); res = close (file->priv->fd);
if (res == -1) if (res == -1)
{ g_set_error (error, G_IO_ERROR,
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
g_io_error_from_errno (errno), _("Error closing file: %s"),
_("Error closing file: %s"), g_strerror (errno));
g_strerror (errno));
}
break; break;
} }
@@ -277,11 +275,11 @@ seek_type_to_lseek (GSeekType type)
} }
static gboolean static gboolean
g_local_file_input_stream_seek (GFileInputStream *stream, g_local_file_input_stream_seek (GFileInputStream *stream,
goffset offset, goffset offset,
GSeekType type, GSeekType type,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileInputStream *file; GLocalFileInputStream *file;
off_t pos; off_t pos;
@@ -303,10 +301,10 @@ g_local_file_input_stream_seek (GFileInputStream *stream,
} }
static GFileInfo * static GFileInfo *
g_local_file_input_stream_query_info (GFileInputStream *stream, g_local_file_input_stream_query_info (GFileInputStream *stream,
char *attributes, char *attributes,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileInputStream *file; GLocalFileInputStream *file;

View File

@@ -43,10 +43,10 @@ g_local_file_monitor_init (GLocalFileMonitor* local_monitor)
} }
static void static void
g_local_file_monitor_set_property (GObject *object, g_local_file_monitor_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
switch (property_id) switch (property_id)
{ {
@@ -60,8 +60,8 @@ g_local_file_monitor_set_property (GObject *object,
} }
static GObject * static GObject *
g_local_file_monitor_constructor (GType type, g_local_file_monitor_constructor (GType type,
guint n_construct_properties, guint n_construct_properties,
GObjectConstructParam *construct_properties) GObjectConstructParam *construct_properties)
{ {
GObject *obj; GObject *obj;
@@ -126,7 +126,7 @@ g_local_file_monitor_class_init (GLocalFileMonitorClass* klass)
static gint static gint
_compare_monitor_class_by_prio (gconstpointer a, _compare_monitor_class_by_prio (gconstpointer a,
gconstpointer b, gconstpointer b,
gpointer user_data) gpointer user_data)
{ {
GType *type1 = (GType *) a, *type2 = (GType *) b; GType *type1 = (GType *) a, *type2 = (GType *) b;
GLocalFileMonitorClass *klass1, *klass2; GLocalFileMonitorClass *klass1, *klass2;
@@ -198,8 +198,8 @@ get_default_local_file_monitor (gpointer data)
* Returns: a new #GFileMonitor for the given @pathname. * Returns: a new #GFileMonitor for the given @pathname.
**/ **/
GFileMonitor* GFileMonitor*
_g_local_file_monitor_new (const char* pathname, _g_local_file_monitor_new (const char *pathname,
GFileMonitorFlags flags) GFileMonitorFlags flags)
{ {
static GOnce once_init = G_ONCE_INIT; static GOnce once_init = G_ONCE_INIT;
static GType monitor_type = G_TYPE_INVALID; static GType monitor_type = G_TYPE_INVALID;

View File

@@ -128,11 +128,11 @@ g_local_file_output_stream_init (GLocalFileOutputStream *stream)
} }
static gssize static gssize
g_local_file_output_stream_write (GOutputStream *stream, g_local_file_output_stream_write (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileOutputStream *file; GLocalFileOutputStream *file;
gssize res; gssize res;
@@ -162,9 +162,9 @@ g_local_file_output_stream_write (GOutputStream *stream,
} }
static gboolean static gboolean
g_local_file_output_stream_close (GOutputStream *stream, g_local_file_output_stream_close (GOutputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileOutputStream *file; GLocalFileOutputStream *file;
struct stat final_stat; struct stat final_stat;
@@ -259,7 +259,7 @@ g_local_file_output_stream_close (GOutputStream *stream,
} }
static char * static char *
g_local_file_output_stream_get_etag (GFileOutputStream *stream) g_local_file_output_stream_get_etag (GFileOutputStream *stream)
{ {
GLocalFileOutputStream *file; GLocalFileOutputStream *file;
@@ -319,11 +319,11 @@ seek_type_to_lseek (GSeekType type)
} }
static gboolean static gboolean
g_local_file_output_stream_seek (GFileOutputStream *stream, g_local_file_output_stream_seek (GFileOutputStream *stream,
goffset offset, goffset offset,
GSeekType type, GSeekType type,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileOutputStream *file; GLocalFileOutputStream *file;
off_t pos; off_t pos;
@@ -345,17 +345,17 @@ g_local_file_output_stream_seek (GFileOutputStream *stream,
} }
static gboolean static gboolean
g_local_file_output_stream_can_truncate (GFileOutputStream *stream) g_local_file_output_stream_can_truncate (GFileOutputStream *stream)
{ {
/* We can't truncate pipes and stuff where we can't seek */ /* We can't truncate pipes and stuff where we can't seek */
return g_local_file_output_stream_can_seek (stream); return g_local_file_output_stream_can_seek (stream);
} }
static gboolean static gboolean
g_local_file_output_stream_truncate (GFileOutputStream *stream, g_local_file_output_stream_truncate (GFileOutputStream *stream,
goffset size, goffset size,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileOutputStream *file; GLocalFileOutputStream *file;
int res; int res;
@@ -363,7 +363,7 @@ g_local_file_output_stream_truncate (GFileOutputStream *stream,
file = G_LOCAL_FILE_OUTPUT_STREAM (stream); file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
restart: restart:
res = ftruncate(file->priv->fd, size); res = ftruncate (file->priv->fd, size);
if (res == -1) if (res == -1)
{ {
@@ -386,10 +386,10 @@ g_local_file_output_stream_truncate (GFileOutputStream *stream,
static GFileInfo * static GFileInfo *
g_local_file_output_stream_query_info (GFileOutputStream *stream, g_local_file_output_stream_query_info (GFileOutputStream *stream,
char *attributes, char *attributes,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileOutputStream *file; GLocalFileOutputStream *file;
@@ -404,10 +404,10 @@ g_local_file_output_stream_query_info (GFileOutputStream *stream,
} }
GFileOutputStream * GFileOutputStream *
_g_local_file_output_stream_create (const char *filename, _g_local_file_output_stream_create (const char *filename,
GFileCreateFlags flags, GFileCreateFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileOutputStream *stream; GLocalFileOutputStream *stream;
int mode; int mode;
@@ -447,10 +447,10 @@ _g_local_file_output_stream_create (const char *filename,
} }
GFileOutputStream * GFileOutputStream *
_g_local_file_output_stream_append (const char *filename, _g_local_file_output_stream_append (const char *filename,
GFileCreateFlags flags, GFileCreateFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GLocalFileOutputStream *stream; GLocalFileOutputStream *stream;
int mode; int mode;
@@ -560,12 +560,12 @@ copy_file_data (gint sfd,
} }
static int static int
handle_overwrite_open (const char *filename, handle_overwrite_open (const char *filename,
const char *etag, const char *etag,
gboolean create_backup, gboolean create_backup,
char **temp_filename, char **temp_filename,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
int fd = -1; int fd = -1;
struct stat original_stat; struct stat original_stat;

View File

@@ -69,15 +69,15 @@ _g_local_vfs_new (void)
} }
static GFile * static GFile *
g_local_vfs_get_file_for_path (GVfs *vfs, g_local_vfs_get_file_for_path (GVfs *vfs,
const char *path) const char *path)
{ {
return _g_local_file_new (path); return _g_local_file_new (path);
} }
static GFile * static GFile *
g_local_vfs_get_file_for_uri (GVfs *vfs, g_local_vfs_get_file_for_uri (GVfs *vfs,
const char *uri) const char *uri)
{ {
char *path; char *path;
GFile *file; GFile *file;
@@ -104,7 +104,7 @@ g_local_vfs_get_supported_uri_schemes (GVfs *vfs)
static GFile * static GFile *
g_local_vfs_parse_name (GVfs *vfs, g_local_vfs_parse_name (GVfs *vfs,
const char *parse_name) const char *parse_name)
{ {
GFile *file; GFile *file;
char *filename; char *filename;

View File

@@ -171,7 +171,7 @@ g_memory_input_stream_init (GMemoryInputStream *stream)
**/ **/
void void
g_memory_input_stream_set_free_data (GMemoryInputStream *stream, g_memory_input_stream_set_free_data (GMemoryInputStream *stream,
gboolean free_data) gboolean free_data)
{ {
g_return_if_fail (G_IS_MEMORY_INPUT_STREAM (stream)); g_return_if_fail (G_IS_MEMORY_INPUT_STREAM (stream));
@@ -186,7 +186,8 @@ g_memory_input_stream_set_free_data (GMemoryInputStream *stream,
* Returns: new #GInputStream read from @data of @len bytes. * Returns: new #GInputStream read from @data of @len bytes.
**/ **/
GInputStream * GInputStream *
g_memory_input_stream_from_data (const void *data, gssize len) g_memory_input_stream_from_data (const void *data,
gssize len)
{ {
GInputStream *stream; GInputStream *stream;
GMemoryInputStream *memory_stream; GMemoryInputStream *memory_stream;
@@ -206,11 +207,11 @@ g_memory_input_stream_from_data (const void *data, gssize len)
} }
static gssize static gssize
g_memory_input_stream_read (GInputStream *stream, g_memory_input_stream_read (GInputStream *stream,
void *buffer, void *buffer,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GMemoryInputStream *memory_stream; GMemoryInputStream *memory_stream;
GMemoryInputStreamPrivate * priv; GMemoryInputStreamPrivate * priv;
@@ -254,10 +255,10 @@ g_memory_input_stream_get_data_size (GMemoryInputStream *stream)
} }
static gssize static gssize
g_memory_input_stream_skip (GInputStream *stream, g_memory_input_stream_skip (GInputStream *stream,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GMemoryInputStream *memory_stream; GMemoryInputStream *memory_stream;
GMemoryInputStreamPrivate *priv; GMemoryInputStreamPrivate *priv;
@@ -274,21 +275,21 @@ g_memory_input_stream_skip (GInputStream *stream,
} }
static gboolean static gboolean
g_memory_input_stream_close (GInputStream *stream, g_memory_input_stream_close (GInputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
return TRUE; return TRUE;
} }
static void static void
g_memory_input_stream_read_async (GInputStream *stream, g_memory_input_stream_read_async (GInputStream *stream,
void *buffer, void *buffer,
gsize count, gsize count,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nread; gssize nread;
@@ -304,9 +305,9 @@ g_memory_input_stream_read_async (GInputStream *stream,
} }
static gssize static gssize
g_memory_input_stream_read_finish (GInputStream *stream, g_memory_input_stream_read_finish (GInputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nread; gssize nread;
@@ -319,30 +320,30 @@ g_memory_input_stream_read_finish (GInputStream *stream,
} }
static void static void
g_memory_input_stream_skip_async (GInputStream *stream, g_memory_input_stream_skip_async (GInputStream *stream,
gsize count, gsize count,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nskipped; gssize nskipped;
nskipped = g_memory_input_stream_skip (stream, count, cancellable, NULL); nskipped = g_memory_input_stream_skip (stream, count, cancellable, NULL);
simple = g_simple_async_result_new (G_OBJECT (stream), simple = g_simple_async_result_new (G_OBJECT (stream),
callback, callback,
user_data, user_data,
g_memory_input_stream_skip_async); g_memory_input_stream_skip_async);
g_simple_async_result_set_op_res_gssize (simple, nskipped); g_simple_async_result_set_op_res_gssize (simple, nskipped);
g_simple_async_result_complete_in_idle (simple); g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple); g_object_unref (simple);
} }
static gssize static gssize
g_memory_input_stream_skip_finish (GInputStream *stream, g_memory_input_stream_skip_finish (GInputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nskipped; gssize nskipped;
@@ -355,11 +356,11 @@ g_memory_input_stream_skip_finish (GInputStream *stream,
} }
static void static void
g_memory_input_stream_close_async (GInputStream *stream, g_memory_input_stream_close_async (GInputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@@ -372,9 +373,9 @@ g_memory_input_stream_close_async (GInputStream *stream,
} }
static gboolean static gboolean
g_memory_input_stream_close_finish (GInputStream *stream, g_memory_input_stream_close_finish (GInputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
return TRUE; return TRUE;
} }
@@ -398,11 +399,11 @@ gboolean g_memory_input_stream_can_seek (GSeekable *seekable)
} }
static gboolean static gboolean
g_memory_input_stream_seek (GSeekable *seekable, g_memory_input_stream_seek (GSeekable *seekable,
goffset offset, goffset offset,
GSeekType type, GSeekType type,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GMemoryInputStream *memory_stream; GMemoryInputStream *memory_stream;
GMemoryInputStreamPrivate * priv; GMemoryInputStreamPrivate * priv;
@@ -411,8 +412,8 @@ g_memory_input_stream_seek (GSeekable *seekable,
memory_stream = G_MEMORY_INPUT_STREAM (seekable); memory_stream = G_MEMORY_INPUT_STREAM (seekable);
priv = memory_stream->priv; priv = memory_stream->priv;
switch (type) { switch (type)
{
case G_SEEK_CUR: case G_SEEK_CUR:
absolute = priv->pos + offset; absolute = priv->pos + offset;
break; break;
@@ -432,7 +433,7 @@ g_memory_input_stream_seek (GSeekable *seekable,
"Invalid GSeekType supplied"); "Invalid GSeekType supplied");
return FALSE; return FALSE;
} }
if (absolute < 0 || absolute > priv->len) if (absolute < 0 || absolute > priv->len)
{ {
@@ -455,10 +456,10 @@ g_memory_input_stream_can_truncate (GSeekable *seekable)
} }
static gboolean static gboolean
g_memory_input_stream_truncate (GSeekable *seekable, g_memory_input_stream_truncate (GSeekable *seekable,
goffset offset, goffset offset,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
g_set_error (error, g_set_error (error,
G_IO_ERROR, G_IO_ERROR,
@@ -469,5 +470,3 @@ g_memory_input_stream_truncate (GSeekable *seekable,
#define __G_MEMORY_INPUT_STREAM_C__ #define __G_MEMORY_INPUT_STREAM_C__
#include "gioaliasdef.c" #include "gioaliasdef.c"
/* vim: ts=2 sw=2 et */

View File

@@ -227,13 +227,12 @@ g_memory_output_stream_new (GByteArray *data)
{ {
GOutputStream *stream; GOutputStream *stream;
if (data == NULL) { if (data == NULL)
stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM, NULL); stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM, NULL);
} else { else
stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM, stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM,
"data", data, "data", data,
NULL); NULL);
}
return stream; return stream;
} }
@@ -246,7 +245,7 @@ g_memory_output_stream_new (GByteArray *data)
**/ **/
void void
g_memory_output_stream_set_free_data (GMemoryOutputStream *ostream, g_memory_output_stream_set_free_data (GMemoryOutputStream *ostream,
gboolean free_data) gboolean free_data)
{ {
GMemoryOutputStreamPrivate *priv; GMemoryOutputStreamPrivate *priv;
@@ -276,23 +275,23 @@ g_memory_output_stream_set_max_size (GMemoryOutputStream *ostream,
priv->max_size = max_size; priv->max_size = max_size;
if (priv->max_size > 0 && if (priv->max_size > 0 &&
priv->max_size < priv->data->len) { priv->max_size < priv->data->len)
{
g_byte_array_set_size (priv->data, priv->max_size); g_byte_array_set_size (priv->data, priv->max_size);
if (priv->pos > priv->max_size) { if (priv->pos > priv->max_size)
priv->pos = priv->max_size; priv->pos = priv->max_size;
} }
}
g_object_notify (G_OBJECT (ostream), "size-limit"); g_object_notify (G_OBJECT (ostream), "size-limit");
} }
static void static void
g_memory_output_stream_set_property (GObject *object, g_memory_output_stream_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GMemoryOutputStream *ostream; GMemoryOutputStream *ostream;
GMemoryOutputStreamPrivate *priv; GMemoryOutputStreamPrivate *priv;
@@ -306,18 +305,18 @@ g_memory_output_stream_set_property (GObject *object,
{ {
case PROP_DATA: case PROP_DATA:
if (priv->data && priv->free_data) { if (priv->data && priv->free_data)
g_byte_array_free (priv->data, TRUE); g_byte_array_free (priv->data, TRUE);
}
data = g_value_get_pointer (value); data = g_value_get_pointer (value);
if (data == NULL) { if (data == NULL)
data = g_byte_array_new (); {
priv->free_data = TRUE; data = g_byte_array_new ();
} else { priv->free_data = TRUE;
}
else
priv->free_data = FALSE; priv->free_data = FALSE;
}
priv->data = data; priv->data = data;
priv->pos = 0; priv->pos = 0;
@@ -395,19 +394,18 @@ array_check_boundary (GMemoryOutputStream *stream,
priv = stream->priv; priv = stream->priv;
if (! priv->max_size) { if (!priv->max_size)
return TRUE; return TRUE;
}
if (priv->max_size < size || size > G_MAXUINT) { if (priv->max_size < size || size > G_MAXUINT)
{
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_FAILED,
"Reached maximum data array limit");
g_set_error (error, return FALSE;
G_IO_ERROR, }
G_IO_ERROR_FAILED,
"Reached maximum data array limit");
return FALSE;
}
return TRUE; return TRUE;
} }
@@ -435,17 +433,16 @@ array_resize (GMemoryOutputStream *stream,
if (size > old_len && priv->pos > old_len) if (size > old_len && priv->pos > old_len)
memset (priv->data->data + priv->pos, 0, size - old_len); memset (priv->data->data + priv->pos, 0, size - old_len);
return priv->data->len - priv->pos; return priv->data->len - priv->pos;
} }
static gssize static gssize
g_memory_output_stream_write (GOutputStream *stream, g_memory_output_stream_write (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GMemoryOutputStream *ostream; GMemoryOutputStream *ostream;
GMemoryOutputStreamPrivate *priv; GMemoryOutputStreamPrivate *priv;
@@ -465,9 +462,7 @@ g_memory_output_stream_write (GOutputStream *stream,
new_size = priv->pos + count; new_size = priv->pos + count;
if (priv->max_size > 0) if (priv->max_size > 0)
{ new_size = MIN (new_size, priv->max_size);
new_size = MIN (new_size, priv->max_size);
}
n = array_resize (ostream, new_size, error); n = array_resize (ostream, new_size, error);
@@ -480,9 +475,7 @@ g_memory_output_stream_write (GOutputStream *stream,
return -1; return -1;
} }
else if (n < 0) else if (n < 0)
{ return -1;
return -1;
}
} }
dest = priv->data->data + priv->pos; dest = priv->data->data + priv->pos;
@@ -507,13 +500,13 @@ g_memory_output_stream_close (GOutputStream *stream,
} }
static void static void
g_memory_output_stream_write_async (GOutputStream *stream, g_memory_output_stream_write_async (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer data) gpointer data)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nwritten; gssize nwritten;
@@ -533,13 +526,12 @@ g_memory_output_stream_write_async (GOutputStream *stream,
g_simple_async_result_set_op_res_gssize (simple, nwritten); g_simple_async_result_set_op_res_gssize (simple, nwritten);
g_simple_async_result_complete_in_idle (simple); g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple); g_object_unref (simple);
} }
static gssize static gssize
g_memory_output_stream_write_finish (GOutputStream *stream, g_memory_output_stream_write_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nwritten; gssize nwritten;
@@ -554,11 +546,11 @@ g_memory_output_stream_write_finish (GOutputStream *stream,
} }
static void static void
g_memory_output_stream_close_async (GOutputStream *stream, g_memory_output_stream_close_async (GOutputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer data) gpointer data)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@@ -573,13 +565,12 @@ g_memory_output_stream_close_async (GOutputStream *stream,
g_simple_async_result_complete_in_idle (simple); g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple); g_object_unref (simple);
} }
static gboolean static gboolean
g_memory_output_stream_close_finish (GOutputStream *stream, g_memory_output_stream_close_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@@ -588,12 +579,11 @@ g_memory_output_stream_close_finish (GOutputStream *stream,
g_assert (g_simple_async_result_get_source_tag (simple) == g_assert (g_simple_async_result_get_source_tag (simple) ==
g_memory_output_stream_close_async); g_memory_output_stream_close_async);
return TRUE; return TRUE;
} }
static goffset static goffset
g_memory_output_stream_tell (GSeekable *seekable) g_memory_output_stream_tell (GSeekable *seekable)
{ {
GMemoryOutputStream *stream; GMemoryOutputStream *stream;
GMemoryOutputStreamPrivate *priv; GMemoryOutputStreamPrivate *priv;
@@ -611,11 +601,11 @@ g_memory_output_stream_can_seek (GSeekable *seekable)
} }
static gboolean static gboolean
g_memory_output_stream_seek (GSeekable *seekable, g_memory_output_stream_seek (GSeekable *seekable,
goffset offset, goffset offset,
GSeekType type, GSeekType type,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GMemoryOutputStream *stream; GMemoryOutputStream *stream;
GMemoryOutputStreamPrivate *priv; GMemoryOutputStreamPrivate *priv;
@@ -624,8 +614,8 @@ g_memory_output_stream_seek (GSeekable *seekable,
stream = G_MEMORY_OUTPUT_STREAM (seekable); stream = G_MEMORY_OUTPUT_STREAM (seekable);
priv = stream->priv; priv = stream->priv;
switch (type) { switch (type)
{
case G_SEEK_CUR: case G_SEEK_CUR:
absolute = priv->pos + offset; absolute = priv->pos + offset;
break; break;
@@ -645,17 +635,18 @@ g_memory_output_stream_seek (GSeekable *seekable,
"Invalid GSeekType supplied"); "Invalid GSeekType supplied");
return FALSE; return FALSE;
} }
if (absolute < 0) { if (absolute < 0)
g_set_error (error, {
G_IO_ERROR, g_set_error (error,
G_IO_ERROR_INVALID_ARGUMENT, G_IO_ERROR,
"Invalid seek request"); G_IO_ERROR_INVALID_ARGUMENT,
return FALSE; "Invalid seek request");
} return FALSE;
}
if (! array_check_boundary (stream, absolute, error)) if (!array_check_boundary (stream, absolute, error))
return FALSE; return FALSE;
priv->pos = absolute; priv->pos = absolute;
@@ -670,10 +661,10 @@ g_memory_output_stream_can_truncate (GSeekable *seekable)
} }
static gboolean static gboolean
g_memory_output_stream_truncate (GSeekable *seekable, g_memory_output_stream_truncate (GSeekable *seekable,
goffset offset, goffset offset,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GMemoryOutputStream *ostream; GMemoryOutputStream *ostream;
GMemoryOutputStreamPrivate *priv; GMemoryOutputStreamPrivate *priv;
@@ -682,12 +673,10 @@ g_memory_output_stream_truncate (GSeekable *seekable,
priv = ostream->priv; priv = ostream->priv;
if (array_resize (ostream, offset, error) < 0) if (array_resize (ostream, offset, error) < 0)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
#define __G_MEMORY_OUTPUT_STREAM_C__ #define __G_MEMORY_OUTPUT_STREAM_C__
#include "gioaliasdef.c" #include "gioaliasdef.c"
/* vim: ts=2 sw=2 et */

View File

@@ -390,7 +390,7 @@ g_mount_operation_get_choice (GMountOperation *op)
**/ **/
void void
g_mount_operation_set_choice (GMountOperation *op, g_mount_operation_set_choice (GMountOperation *op,
int choice) int choice)
{ {
g_return_if_fail (G_IS_MOUNT_OPERATION (op)); g_return_if_fail (G_IS_MOUNT_OPERATION (op));
op->priv->choice = choice; op->priv->choice = choice;

View File

@@ -172,11 +172,11 @@ g_output_stream_init (GOutputStream *stream)
* Return value: Number of bytes written, or -1 on error * Return value: Number of bytes written, or -1 on error
**/ **/
gssize gssize
g_output_stream_write (GOutputStream *stream, g_output_stream_write (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
gssize res; gssize res;
@@ -235,7 +235,8 @@ g_output_stream_write (GOutputStream *stream,
* @stream: a #GOutputStream. * @stream: a #GOutputStream.
* @buffer: the buffer containing the data to write. * @buffer: the buffer containing the data to write.
* @count: the number of bytes to write * @count: the number of bytes to write
* @bytes_written: location to store the number of bytes that was written to the stream * @bytes_written: location to store the number of bytes that was
* written to the stream
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
@@ -255,12 +256,12 @@ g_output_stream_write (GOutputStream *stream,
* Return value: %TRUE on success, %FALSE if there was an error * Return value: %TRUE on success, %FALSE if there was an error
**/ **/
gboolean gboolean
g_output_stream_write_all (GOutputStream *stream, g_output_stream_write_all (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
gsize *bytes_written, gsize *bytes_written,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gsize _bytes_written; gsize _bytes_written;
gssize res; gssize res;
@@ -288,6 +289,7 @@ g_output_stream_write_all (GOutputStream *stream,
if (bytes_written) if (bytes_written)
*bytes_written = _bytes_written; *bytes_written = _bytes_written;
return TRUE; return TRUE;
} }
@@ -297,8 +299,8 @@ g_output_stream_write_all (GOutputStream *stream,
* @cancellable: optional cancellable object * @cancellable: optional cancellable object
* @error: location to store the error occuring, or %NULL to ignore * @error: location to store the error occuring, or %NULL to ignore
* *
* Flushed any outstanding buffers in the stream. Will block during the operation. * Flushed any outstanding buffers in the stream. Will block during
* Closing the stream will implicitly cause a flush. * the operation. Closing the stream will implicitly cause a flush.
* *
* This function is optional for inherited classes. * This function is optional for inherited classes.
* *
@@ -309,9 +311,9 @@ g_output_stream_write_all (GOutputStream *stream,
* Return value: %TRUE on success, %FALSE on error * Return value: %TRUE on success, %FALSE on error
**/ **/
gboolean gboolean
g_output_stream_flush (GOutputStream *stream, g_output_stream_flush (GOutputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
gboolean res; gboolean res;
@@ -365,11 +367,11 @@ g_output_stream_flush (GOutputStream *stream,
* Returns: a #gssize containig the size of the data spliced. * Returns: a #gssize containig the size of the data spliced.
**/ **/
gssize gssize
g_output_stream_splice (GOutputStream *stream, g_output_stream_splice (GOutputStream *stream,
GInputStream *source, GInputStream *source,
GOutputStreamSpliceFlags flags, GOutputStreamSpliceFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
gboolean res; gboolean res;
@@ -415,11 +417,11 @@ g_output_stream_splice (GOutputStream *stream,
} }
static gssize static gssize
g_output_stream_real_splice (GOutputStream *stream, g_output_stream_real_splice (GOutputStream *stream,
GInputStream *source, GInputStream *source,
GOutputStreamSpliceFlags flags, GOutputStreamSpliceFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gssize n_read, n_written; gssize n_read, n_written;
gssize bytes_copied; gssize bytes_copied;
@@ -576,9 +578,9 @@ g_output_stream_close (GOutputStream *stream,
} }
static void static void
async_ready_callback_wrapper (GObject *source_object, async_ready_callback_wrapper (GObject *source_object,
GAsyncResult *res, GAsyncResult *res,
gpointer user_data) gpointer user_data)
{ {
GOutputStream *stream = G_OUTPUT_STREAM (source_object); GOutputStream *stream = G_OUTPUT_STREAM (source_object);
@@ -589,9 +591,9 @@ async_ready_callback_wrapper (GObject *source_object,
} }
static void static void
async_ready_close_callback_wrapper (GObject *source_object, async_ready_close_callback_wrapper (GObject *source_object,
GAsyncResult *res, GAsyncResult *res,
gpointer user_data) gpointer user_data)
{ {
GOutputStream *stream = G_OUTPUT_STREAM (source_object); GOutputStream *stream = G_OUTPUT_STREAM (source_object);
@@ -607,33 +609,36 @@ async_ready_close_callback_wrapper (GObject *source_object,
* @stream: A #GOutputStream. * @stream: A #GOutputStream.
* @buffer: the buffer containing the data to write. * @buffer: the buffer containing the data to write.
* @count: the number of bytes to write * @count: the number of bytes to write
* @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, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied * @callback: callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: the data to pass to callback function
* *
* Request an asynchronous write of @count bytes from @buffer into the stream. * Request an asynchronous write of @count bytes from @buffer into
* When the operation is finished @callback will be called, giving the results. * the stream. When the operation is finished @callback will be called,
* giving the results.
* *
* During an async request no other sync and async calls are allowed, and will * During an async request no other sync and async calls are allowed,
* result in %G_IO_ERROR_PENDING errors. * and will result in %G_IO_ERROR_PENDING errors.
* *
* A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error. * A value of @count larger than %G_MAXSSIZE will cause a
* %G_IO_ERROR_INVALID_ARGUMENT error.
* *
* On success, the number of bytes written will be passed to the * On success, the number of bytes written will be passed to the
* @callback. It is not an error if this is not the same as the requested size, as it * @callback. It is not an error if this is not the same as the
* can happen e.g. on a partial i/o error, but generally we try to write * requested size, as it can happen e.g. on a partial I/O error,
* as many bytes as requested. * but generally we try to write as many bytes as requested.
* *
* Any outstanding i/o request with higher priority (lower numerical value) will * Any outstanding I/O request with higher priority (lower numerical
* be executed before an outstanding request with lower priority. Default * value) will be executed before an outstanding request with lower
* priority is %G_PRIORITY_DEFAULT. * priority. Default priority is %G_PRIORITY_DEFAULT.
* *
* The asyncronous methods have a default fallback that uses threads to implement * The asyncronous methods have a default fallback that uses threads
* asynchronicity, so they are optional for inheriting classes. However, if you * to implement asynchronicity, so they are optional for inheriting
* override one you must override all. * classes. However, if you override one you must override all.
* *
* For the synchronous, blocking version of this function, see g_output_stream_write(). * For the synchronous, blocking version of this function, see
* g_output_stream_write().
**/ **/
void void
g_output_stream_write_async (GOutputStream *stream, g_output_stream_write_async (GOutputStream *stream,
@@ -712,9 +717,9 @@ g_output_stream_write_async (GOutputStream *stream,
* Returns: a #gssize containing the number of bytes written to the stream. * Returns: a #gssize containing the number of bytes written to the stream.
**/ **/
gssize gssize
g_output_stream_write_finish (GOutputStream *stream, g_output_stream_write_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
GOutputStreamClass *class; GOutputStreamClass *class;
@@ -744,9 +749,9 @@ typedef struct {
} SpliceUserData; } SpliceUserData;
static void static void
async_ready_splice_callback_wrapper (GObject *source_object, async_ready_splice_callback_wrapper (GObject *source_object,
GAsyncResult *res, GAsyncResult *res,
gpointer _data) gpointer _data)
{ {
GOutputStream *stream = G_OUTPUT_STREAM (source_object); GOutputStream *stream = G_OUTPUT_STREAM (source_object);
SpliceUserData *data = _data; SpliceUserData *data = _data;
@@ -775,13 +780,13 @@ async_ready_splice_callback_wrapper (GObject *source_object,
* *
**/ **/
void void
g_output_stream_splice_async (GOutputStream *stream, g_output_stream_splice_async (GOutputStream *stream,
GInputStream *source, GInputStream *source,
GOutputStreamSpliceFlags flags, GOutputStreamSpliceFlags flags,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
SpliceUserData *data; SpliceUserData *data;
@@ -845,9 +850,9 @@ g_output_stream_splice_async (GOutputStream *stream,
* Returns: a #gssize of the number of bytes spliced. * Returns: a #gssize of the number of bytes spliced.
**/ **/
gssize gssize
g_output_stream_splice_finish (GOutputStream *stream, g_output_stream_splice_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
GOutputStreamClass *class; GOutputStreamClass *class;
@@ -879,10 +884,10 @@ g_output_stream_splice_finish (GOutputStream *stream,
**/ **/
void void
g_output_stream_flush_async (GOutputStream *stream, g_output_stream_flush_async (GOutputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@@ -941,9 +946,9 @@ g_output_stream_flush_async (GOutputStream *stream,
* Returns: %TRUE if flush operation suceeded, %FALSE otherwise. * Returns: %TRUE if flush operation suceeded, %FALSE otherwise.
**/ **/
gboolean gboolean
g_output_stream_flush_finish (GOutputStream *stream, g_output_stream_flush_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
GOutputStreamClass *klass; GOutputStreamClass *klass;
@@ -975,21 +980,22 @@ g_output_stream_flush_finish (GOutputStream *stream,
* @user_data: the data to pass to callback function * @user_data: the data to pass to callback function
* @cancellable: optional cancellable object * @cancellable: optional cancellable object
* *
* Requests an asynchronous close of the stream, releasing resources related to it. * Requests an asynchronous close of the stream, releasing resources
* When the operation is finished @callback will be called, giving the results. * related to it. When the operation is finished @callback will be
* called, giving the results.
* *
* For behaviour details see g_output_stream_close(). * For behaviour details see g_output_stream_close().
* *
* The asyncronous methods have a default fallback that uses threads to implement * The asyncronous methods have a default fallback that uses threads
* asynchronicity, so they are optional for inheriting classes. However, if you * to implement asynchronicity, so they are optional for inheriting
* override one you must override all. * classes. However, if you override one you must override all.
**/ **/
void void
g_output_stream_close_async (GOutputStream *stream, g_output_stream_close_async (GOutputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@@ -1037,9 +1043,9 @@ g_output_stream_close_async (GOutputStream *stream,
* Returns: %TRUE if stream was successfully closed, %FALSE otherwise. * Returns: %TRUE if stream was successfully closed, %FALSE otherwise.
**/ **/
gboolean gboolean
g_output_stream_close_finish (GOutputStream *stream, g_output_stream_close_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
GOutputStreamClass *class; GOutputStreamClass *class;
@@ -1102,8 +1108,8 @@ g_output_stream_has_pending (GOutputStream *stream)
* Sets the @stream as having pending actions if @pending is %TRUE. * Sets the @stream as having pending actions if @pending is %TRUE.
**/ **/
void void
g_output_stream_set_pending (GOutputStream *stream, g_output_stream_set_pending (GOutputStream *stream,
gboolean pending) gboolean pending)
{ {
g_return_if_fail (G_IS_OUTPUT_STREAM (stream)); g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
@@ -1123,8 +1129,8 @@ typedef struct {
static void static void
write_async_thread (GSimpleAsyncResult *res, write_async_thread (GSimpleAsyncResult *res,
GObject *object, GObject *object,
GCancellable *cancellable) GCancellable *cancellable)
{ {
WriteData *op; WriteData *op;
GOutputStreamClass *class; GOutputStreamClass *class;
@@ -1143,12 +1149,12 @@ write_async_thread (GSimpleAsyncResult *res,
static void static void
g_output_stream_real_write_async (GOutputStream *stream, g_output_stream_real_write_async (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *res; GSimpleAsyncResult *res;
WriteData *op; WriteData *op;
@@ -1164,9 +1170,9 @@ g_output_stream_real_write_async (GOutputStream *stream,
} }
static gssize static gssize
g_output_stream_real_write_finish (GOutputStream *stream, g_output_stream_real_write_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
WriteData *op; WriteData *op;
@@ -1184,8 +1190,8 @@ typedef struct {
static void static void
splice_async_thread (GSimpleAsyncResult *result, splice_async_thread (GSimpleAsyncResult *result,
GObject *object, GObject *object,
GCancellable *cancellable) GCancellable *cancellable)
{ {
SpliceData *op; SpliceData *op;
GOutputStreamClass *class; GOutputStreamClass *class;
@@ -1213,13 +1219,13 @@ splice_async_thread (GSimpleAsyncResult *result,
} }
static void static void
g_output_stream_real_splice_async (GOutputStream *stream, g_output_stream_real_splice_async (GOutputStream *stream,
GInputStream *source, GInputStream *source,
GOutputStreamSpliceFlags flags, GOutputStreamSpliceFlags flags,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *res; GSimpleAsyncResult *res;
SpliceData *op; SpliceData *op;
@@ -1238,9 +1244,9 @@ g_output_stream_real_splice_async (GOutputStream *stream,
} }
static gssize static gssize
g_output_stream_real_splice_finish (GOutputStream *stream, g_output_stream_real_splice_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
SpliceData *op; SpliceData *op;
@@ -1251,11 +1257,10 @@ g_output_stream_real_splice_finish (GOutputStream *stream,
} }
static void static void
flush_async_thread (GSimpleAsyncResult *res, flush_async_thread (GSimpleAsyncResult *res,
GObject *object, GObject *object,
GCancellable *cancellable) GCancellable *cancellable)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
gboolean result; gboolean result;
@@ -1275,10 +1280,10 @@ flush_async_thread (GSimpleAsyncResult *res,
static void static void
g_output_stream_real_flush_async (GOutputStream *stream, g_output_stream_real_flush_async (GOutputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *res; GSimpleAsyncResult *res;
@@ -1289,17 +1294,17 @@ g_output_stream_real_flush_async (GOutputStream *stream,
} }
static gboolean static gboolean
g_output_stream_real_flush_finish (GOutputStream *stream, g_output_stream_real_flush_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
return TRUE; return TRUE;
} }
static void static void
close_async_thread (GSimpleAsyncResult *res, close_async_thread (GSimpleAsyncResult *res,
GObject *object, GObject *object,
GCancellable *cancellable) GCancellable *cancellable)
{ {
GOutputStreamClass *class; GOutputStreamClass *class;
GError *error = NULL; GError *error = NULL;
@@ -1320,11 +1325,11 @@ close_async_thread (GSimpleAsyncResult *res,
} }
static void static void
g_output_stream_real_close_async (GOutputStream *stream, g_output_stream_real_close_async (GOutputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *res; GSimpleAsyncResult *res;
@@ -1337,9 +1342,9 @@ g_output_stream_real_close_async (GOutputStream *stream,
} }
static gboolean static gboolean
g_output_stream_real_close_finish (GOutputStream *stream, g_output_stream_real_close_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
g_assert (g_simple_async_result_get_source_tag (simple) == g_output_stream_real_close_async); g_assert (g_simple_async_result_get_source_tag (simple) == g_output_stream_real_close_async);

View File

@@ -75,7 +75,8 @@ g_poll_file_monitor_init (GPollFileMonitor* poll_monitor)
} }
static int static int
safe_strcmp (const char *a, const char *b) safe_strcmp (const char *a,
const char *b)
{ {
if (a == NULL && b == NULL) if (a == NULL && b == NULL)
return 0; return 0;
@@ -112,9 +113,9 @@ calc_event_type (GFileInfo *last,
} }
static void static void
got_new_info (GObject *source_object, got_new_info (GObject *source_object,
GAsyncResult *res, GAsyncResult *res,
gpointer user_data) gpointer user_data)
{ {
GPollFileMonitor* poll_monitor = user_data; GPollFileMonitor* poll_monitor = user_data;
GFileInfo *info; GFileInfo *info;
@@ -176,9 +177,9 @@ schedule_poll_timeout (GPollFileMonitor* poll_monitor)
} }
static void static void
got_initial_info (GObject *source_object, got_initial_info (GObject *source_object,
GAsyncResult *res, GAsyncResult *res,
gpointer user_data) gpointer user_data)
{ {
GPollFileMonitor* poll_monitor = user_data; GPollFileMonitor* poll_monitor = user_data;
GFileInfo *info; GFileInfo *info;

View File

@@ -45,7 +45,7 @@ g_seekable_get_type (void)
{ {
static GType seekable_type = 0; static GType seekable_type = 0;
if (! seekable_type) if (!seekable_type)
{ {
static const GTypeInfo seekable_info = static const GTypeInfo seekable_info =
{ {
@@ -131,8 +131,8 @@ g_seekable_can_seek (GSeekable *seekable)
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* *
* Returns: %TRUE if successful. If an error * Returns: %TRUE if successful. If an error
* has occured, this function will return %FALSE and set @error * has occured, this function will return %FALSE and set @error
* appropriately if present. * appropriately if present.
**/ **/
gboolean gboolean
g_seekable_seek (GSeekable *seekable, g_seekable_seek (GSeekable *seekable,
@@ -187,8 +187,8 @@ g_seekable_can_truncate (GSeekable *seekable)
* partial result will be returned, without an error. * partial result will be returned, without an error.
* *
* Returns: %TRUE if successful. If an error * Returns: %TRUE if successful. If an error
* has occured, this function will return %FALSE and set @error * has occured, this function will return %FALSE and set @error
* appropriately if present. * appropriately if present.
**/ **/
gboolean gboolean
g_seekable_truncate (GSeekable *seekable, g_seekable_truncate (GSeekable *seekable,

View File

@@ -65,26 +65,27 @@
* asynchronous functions and their finishing functions are used together * asynchronous functions and their finishing functions are used together
* correctly. * correctly.
* *
* To create a new #GSimpleAsyncResult, call g_simple_async_result_new(). If * To create a new #GSimpleAsyncResult, call g_simple_async_result_new().
* the result needs to be created for a #GError, use * If the result needs to be created for a #GError, use
* g_simple_async_result_new_from_error(). If a #GError is not available (e.g. * g_simple_async_result_new_from_error(). If a #GError is not available
* the asynchronous operation's doesn't take a #GError argument), but the result * (e.g. the asynchronous operation's doesn't take a #GError argument),
* still needs to be created for an error condition, use * but the result still needs to be created for an error condition, use
* g_simple_async_result_new_error() (or g_simple_async_result_set_error_va() * g_simple_async_result_new_error() (or g_simple_async_result_set_error_va()
* if your application or binding requires passing a variable argument list * if your application or binding requires passing a variable argument list
* directly), and the error can then be propegated through the use of * directly), and the error can then be propegated through the use of
* g_simple_async_result_propagate_error(). * g_simple_async_result_propagate_error().
* *
* An asynchronous operation can be made to ignore a cancellation event by calling * An asynchronous operation can be made to ignore a cancellation event by
* g_simple_async_result_set_handle_cancellation() with a #GSimpleAsyncResult * calling g_simple_async_result_set_handle_cancellation() with a
* for the operation and %FALSE. * #GSimpleAsyncResult for the operation and %FALSE.
* *
* GSimpleAsyncResult can integrate into GLib's Main Event Loop <!-- TODO: Crosslink -->, * GSimpleAsyncResult can integrate into GLib's Main Event Loop
* or it can use #GThread<!-- -->s if available. g_simple_async_result_complete() * <!-- TODO: Crosslink -->, or it can use #GThread<!-- -->s if available.
* will finish an I/O task directly within the main event loop. * g_simple_async_result_complete() will finish an I/O task directly within
* g_simple_async_result_complete_in_idle() will integrate the I/O task into the * the main event loop. g_simple_async_result_complete_in_idle() will
* main event loop as an idle function and g_simple_async_result_run_in_thread() * integrate the I/O task into the main event loop as an idle function and
* will run the job in a separate thread. * g_simple_async_result_run_in_thread() will run the job in a separate
* thread.
* *
* To set the results of an asynchronous function, * To set the results of an asynchronous function,
* g_simple_async_result_set_op_res_gpointer(), * g_simple_async_result_set_op_res_gpointer(),
@@ -181,10 +182,10 @@ g_simple_async_result_init (GSimpleAsyncResult *simple)
* Returns: a #GSimpleAsyncResult. * Returns: a #GSimpleAsyncResult.
**/ **/
GSimpleAsyncResult * GSimpleAsyncResult *
g_simple_async_result_new (GObject *source_object, g_simple_async_result_new (GObject *source_object,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data, gpointer user_data,
gpointer source_tag) gpointer source_tag)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@@ -211,10 +212,10 @@ g_simple_async_result_new (GObject *source_object,
* Returns: a #GSimpleAsyncResult. * Returns: a #GSimpleAsyncResult.
**/ **/
GSimpleAsyncResult * GSimpleAsyncResult *
g_simple_async_result_new_from_error (GObject *source_object, g_simple_async_result_new_from_error (GObject *source_object,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data, gpointer user_data,
GError *error) GError *error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@@ -236,20 +237,20 @@ g_simple_async_result_new_from_error (GObject *source_object,
* @domain: a #GQuark. * @domain: a #GQuark.
* @code: an error code. * @code: an error code.
* @format: a string with format characters. * @format: a string with format characters.
* @Varargs: a list of values to insert into @format. * @...: a list of values to insert into @format.
* *
* Creates a new #GSimpleAsyncResult with a set error. * Creates a new #GSimpleAsyncResult with a set error.
* *
* Returns: a #GSimpleAsyncResult. * Returns: a #GSimpleAsyncResult.
**/ **/
GSimpleAsyncResult * GSimpleAsyncResult *
g_simple_async_result_new_error (GObject *source_object, g_simple_async_result_new_error (GObject *source_object,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data, gpointer user_data,
GQuark domain, GQuark domain,
gint code, gint code,
const char *format, const char *format,
...) ...)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
va_list args; va_list args;
@@ -301,7 +302,7 @@ g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface)
**/ **/
void void
g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple, g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
gboolean handle_cancellation) gboolean handle_cancellation)
{ {
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple)); g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
simple->handle_cancellation = handle_cancellation; simple->handle_cancellation = handle_cancellation;
@@ -333,8 +334,8 @@ g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple)
* Returns: %TRUE if the error was propegated to @dest. %FALSE otherwise. * Returns: %TRUE if the error was propegated to @dest. %FALSE otherwise.
**/ **/
gboolean gboolean
g_simple_async_result_propagate_error (GSimpleAsyncResult *simple, g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
GError **dest) GError **dest)
{ {
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE); g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
@@ -344,6 +345,7 @@ g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
simple->error = NULL; simple->error = NULL;
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
@@ -356,9 +358,9 @@ g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
* Sets the operation result within the asynchronous result to a pointer. * Sets the operation result within the asynchronous result to a pointer.
**/ **/
void void
g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple, g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
gpointer op_res, gpointer op_res,
GDestroyNotify destroy_op_res) GDestroyNotify destroy_op_res)
{ {
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple)); g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
@@ -375,7 +377,7 @@ g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
* Returns: a pointer from the result. * Returns: a pointer from the result.
**/ **/
gpointer gpointer
g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple) g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
{ {
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), NULL); g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), NULL);
return simple->op_res.v_pointer; return simple->op_res.v_pointer;
@@ -386,11 +388,12 @@ g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
* @simple: a #GSimpleAsyncResult. * @simple: a #GSimpleAsyncResult.
* @op_res: a #gssize. * @op_res: a #gssize.
* *
* Sets the operation result within the asynchronous result to the given @op_res. * Sets the operation result within the asynchronous result to
* the given @op_res.
**/ **/
void void
g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple, g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
gssize op_res) gssize op_res)
{ {
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple)); g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
simple->op_res.v_ssize = op_res; simple->op_res.v_ssize = op_res;
@@ -405,7 +408,7 @@ g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
* Returns: a gssize returned from the asynchronous function. * Returns: a gssize returned from the asynchronous function.
**/ **/
gssize gssize
g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple) g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
{ {
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), 0); g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), 0);
return simple->op_res.v_ssize; return simple->op_res.v_ssize;
@@ -417,11 +420,10 @@ g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
* @op_res: a #gboolean. * @op_res: a #gboolean.
* *
* Sets the operation result to a boolean within the asynchronous result. * Sets the operation result to a boolean within the asynchronous result.
*
**/ **/
void void
g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple, g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
gboolean op_res) gboolean op_res)
{ {
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple)); g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
simple->op_res.v_boolean = !!op_res; simple->op_res.v_boolean = !!op_res;
@@ -433,11 +435,11 @@ g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
* *
* Gets the operation result boolean from within the asynchronous result. * Gets the operation result boolean from within the asynchronous result.
* *
* Returns: %TRUE if the operation's result was %TRUE, %FALSE if the operation's * Returns: %TRUE if the operation's result was %TRUE, %FALSE
* result was %FALSE. * if the operation's result was %FALSE.
**/ **/
gboolean gboolean
g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple) g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
{ {
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE); g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
return simple->op_res.v_boolean; return simple->op_res.v_boolean;
@@ -452,7 +454,7 @@ g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
**/ **/
void void
g_simple_async_result_set_from_error (GSimpleAsyncResult *simple, g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
GError *error) GError *error)
{ {
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple)); g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
g_return_if_fail (error != NULL); g_return_if_fail (error != NULL);
@@ -462,10 +464,10 @@ g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
} }
static GError* static GError*
_g_error_new_valist (GQuark domain, _g_error_new_valist (GQuark domain,
gint code, gint code,
const char *format, const char *format,
va_list args) va_list args)
{ {
GError *error; GError *error;
char *message; char *message;
@@ -486,15 +488,15 @@ _g_error_new_valist (GQuark domain,
* @format: a formatted error reporting string. * @format: a formatted error reporting string.
* @args: va_list of arguments. * @args: va_list of arguments.
* *
* Sets an error within the asynchronous result without a #GError. Unless * Sets an error within the asynchronous result without a #GError.
* writing a binding, see g_simple_async_result_set_error(). * Unless writing a binding, see g_simple_async_result_set_error().
**/ **/
void void
g_simple_async_result_set_error_va (GSimpleAsyncResult *simple, g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
GQuark domain, GQuark domain,
gint code, gint code,
const char *format, const char *format,
va_list args) va_list args)
{ {
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple)); g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
g_return_if_fail (domain != 0); g_return_if_fail (domain != 0);
@@ -510,17 +512,16 @@ g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
* @domain: a #GQuark (usually #G_IO_ERROR). * @domain: a #GQuark (usually #G_IO_ERROR).
* @code: an error code. * @code: an error code.
* @format: a formatted error reporting string. * @format: a formatted error reporting string.
* @Varargs: a list of variables to fill in @format. * @...: a list of variables to fill in @format.
* *
* Sets an error within the asynchronous result without a #GError. * Sets an error within the asynchronous result without a #GError.
*
**/ **/
void void
g_simple_async_result_set_error (GSimpleAsyncResult *simple, g_simple_async_result_set_error (GSimpleAsyncResult *simple,
GQuark domain, GQuark domain,
gint code, gint code,
const char *format, const char *format,
...) ...)
{ {
va_list args; va_list args;
@@ -538,7 +539,6 @@ g_simple_async_result_set_error (GSimpleAsyncResult *simple,
* @simple: a #GSimpleAsyncResult. * @simple: a #GSimpleAsyncResult.
* *
* Completes an asynchronous I/O job. * Completes an asynchronous I/O job.
*
**/ **/
void void
g_simple_async_result_complete (GSimpleAsyncResult *simple) g_simple_async_result_complete (GSimpleAsyncResult *simple)
@@ -567,7 +567,6 @@ complete_in_idle_cb (gpointer data)
* *
* Completes an asynchronous function in the main event loop using * Completes an asynchronous function in the main event loop using
* an idle function. * an idle function.
*
**/ **/
void void
g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple) g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
@@ -593,27 +592,23 @@ typedef struct {
} RunInThreadData; } RunInThreadData;
static void static void
run_in_thread (GIOJob *job, run_in_thread (GIOJob *job,
GCancellable *c, GCancellable *c,
gpointer _data) gpointer _data)
{ {
RunInThreadData *data = _data; RunInThreadData *data = _data;
GSimpleAsyncResult *simple = data->simple; GSimpleAsyncResult *simple = data->simple;
if (simple->handle_cancellation && if (simple->handle_cancellation &&
g_cancellable_is_cancelled (c)) g_cancellable_is_cancelled (c))
{ g_simple_async_result_set_error (simple,
g_simple_async_result_set_error (simple, G_IO_ERROR,
G_IO_ERROR, G_IO_ERROR_CANCELLED,
G_IO_ERROR_CANCELLED, _("Operation was cancelled"));
_("Operation was cancelled"));
}
else else
{ data->func (simple,
data->func (simple, simple->source_object,
simple->source_object, c);
c);
}
g_simple_async_result_complete_in_idle (data->simple); g_simple_async_result_complete_in_idle (data->simple);
g_object_unref (data->simple); g_object_unref (data->simple);
@@ -628,13 +623,12 @@ run_in_thread (GIOJob *job,
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* *
* Runs the asynchronous job in a separated thread. * Runs the asynchronous job in a separated thread.
*
**/ **/
void void
g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple, g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
GSimpleAsyncThreadFunc func, GSimpleAsyncThreadFunc func,
int io_priority, int io_priority,
GCancellable *cancellable) GCancellable *cancellable)
{ {
RunInThreadData *data; RunInThreadData *data;
@@ -655,19 +649,18 @@ g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
* @domain: a #GQuark containing the error domain (usually #G_IO_ERROR). * @domain: a #GQuark containing the error domain (usually #G_IO_ERROR).
* @code: a specific error code. * @code: a specific error code.
* @format: a formatted error reporting string. * @format: a formatted error reporting string.
* @Varargs: a list of variables to fill in @format. * @...: a list of variables to fill in @format.
* *
* Reports an error in an idle function. * Reports an error in an idle function.
*
**/ **/
void void
g_simple_async_report_error_in_idle (GObject *object, g_simple_async_report_error_in_idle (GObject *object,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data, gpointer user_data,
GQuark domain, GQuark domain,
gint code, gint code,
const char *format, const char *format,
...) ...)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
va_list args; va_list args;

View File

@@ -37,7 +37,7 @@
* not provide actual pixmaps for icons, just the icon names. * not provide actual pixmaps for icons, just the icon names.
**/ **/
static void g_themed_icon_icon_iface_init (GIconIface *iface); static void g_themed_icon_icon_iface_init (GIconIface *iface);
struct _GThemedIcon struct _GThemedIcon
{ {
@@ -114,7 +114,8 @@ g_themed_icon_new (const char *iconname)
* Returns: a new #GThemedIcon. * Returns: a new #GThemedIcon.
**/ **/
GIcon * GIcon *
g_themed_icon_new_from_names (char **iconnames, int len) g_themed_icon_new_from_names (char **iconnames,
int len)
{ {
GThemedIcon *themed; GThemedIcon *themed;
int i; int i;
@@ -168,7 +169,7 @@ g_themed_icon_hash (GIcon *icon)
static gboolean static gboolean
g_themed_icon_equal (GIcon *icon1, g_themed_icon_equal (GIcon *icon1,
GIcon *icon2) GIcon *icon2)
{ {
GThemedIcon *themed1 = G_THEMED_ICON (icon1); GThemedIcon *themed1 = G_THEMED_ICON (icon1);
GThemedIcon *themed2 = G_THEMED_ICON (icon2); GThemedIcon *themed2 = G_THEMED_ICON (icon2);

View File

@@ -152,9 +152,9 @@ g_union_volume_monitor_class_init (GUnionVolumeMonitorClass *klass)
} }
static void static void
child_volume_mounted (GVolumeMonitor *child_monitor, child_volume_mounted (GVolumeMonitor *child_monitor,
GVolume *child_volume, GVolume *child_volume,
GUnionVolumeMonitor *union_monitor) GUnionVolumeMonitor *union_monitor)
{ {
g_signal_emit_by_name (union_monitor, g_signal_emit_by_name (union_monitor,
"volume_mounted", "volume_mounted",
@@ -162,9 +162,9 @@ child_volume_mounted (GVolumeMonitor *child_monitor,
} }
static void static void
child_volume_pre_unmount (GVolumeMonitor *child_monitor, child_volume_pre_unmount (GVolumeMonitor *child_monitor,
GVolume *child_volume, GVolume *child_volume,
GUnionVolumeMonitor *union_monitor) GUnionVolumeMonitor *union_monitor)
{ {
g_signal_emit_by_name (union_monitor, g_signal_emit_by_name (union_monitor,
"volume_pre_unmount", "volume_pre_unmount",
@@ -172,9 +172,9 @@ child_volume_pre_unmount (GVolumeMonitor *child_monitor,
} }
static void static void
child_volume_unmounted (GVolumeMonitor *child_monitor, child_volume_unmounted (GVolumeMonitor *child_monitor,
GVolume *child_volume, GVolume *child_volume,
GUnionVolumeMonitor *union_monitor) GUnionVolumeMonitor *union_monitor)
{ {
g_signal_emit_by_name (union_monitor, g_signal_emit_by_name (union_monitor,
"volume_unmounted", "volume_unmounted",
@@ -182,9 +182,9 @@ child_volume_unmounted (GVolumeMonitor *child_monitor,
} }
static void static void
child_drive_connected (GVolumeMonitor *child_monitor, child_drive_connected (GVolumeMonitor *child_monitor,
GDrive *child_drive, GDrive *child_drive,
GUnionVolumeMonitor *union_monitor) GUnionVolumeMonitor *union_monitor)
{ {
g_signal_emit_by_name (union_monitor, g_signal_emit_by_name (union_monitor,
"drive_connected", "drive_connected",
@@ -192,9 +192,9 @@ child_drive_connected (GVolumeMonitor *child_monitor,
} }
static void static void
child_drive_disconnected (GVolumeMonitor *child_monitor, child_drive_disconnected (GVolumeMonitor *child_monitor,
GDrive *child_drive, GDrive *child_drive,
GUnionVolumeMonitor *union_monitor) GUnionVolumeMonitor *union_monitor)
{ {
g_signal_emit_by_name (union_monitor, g_signal_emit_by_name (union_monitor,
"drive_disconnected", "drive_disconnected",
@@ -203,7 +203,7 @@ child_drive_disconnected (GVolumeMonitor *child_monitor,
static void static void
g_union_volume_monitor_add_monitor (GUnionVolumeMonitor *union_monitor, g_union_volume_monitor_add_monitor (GUnionVolumeMonitor *union_monitor,
GVolumeMonitor *volume_monitor) GVolumeMonitor *volume_monitor)
{ {
if (g_list_find (union_monitor->monitors, volume_monitor)) if (g_list_find (union_monitor->monitors, volume_monitor))
return; return;
@@ -221,7 +221,7 @@ g_union_volume_monitor_add_monitor (GUnionVolumeMonitor *union_monitor,
static void static void
g_union_volume_monitor_remove_monitor (GUnionVolumeMonitor *union_monitor, g_union_volume_monitor_remove_monitor (GUnionVolumeMonitor *union_monitor,
GVolumeMonitor *child_monitor) GVolumeMonitor *child_monitor)
{ {
GList *l; GList *l;

View File

@@ -126,8 +126,8 @@ type_to_icon (GUnixMountType type)
* Returns: a #GUnixDrive for the given #GUnixMountPoint. * Returns: a #GUnixDrive for the given #GUnixMountPoint.
**/ **/
GUnixDrive * GUnixDrive *
_g_unix_drive_new (GVolumeMonitor *volume_monitor, _g_unix_drive_new (GVolumeMonitor *volume_monitor,
GUnixMountPoint *mountpoint) GUnixMountPoint *mountpoint)
{ {
GUnixDrive *drive; GUnixDrive *drive;
@@ -170,8 +170,8 @@ _g_unix_drive_disconnected (GUnixDrive *drive)
* *
**/ **/
void void
_g_unix_drive_set_volume (GUnixDrive *drive, _g_unix_drive_set_volume (GUnixDrive *drive,
GUnixVolume *volume) GUnixVolume *volume)
{ {
if (drive->volume == volume) if (drive->volume == volume)
return; return;
@@ -192,8 +192,8 @@ _g_unix_drive_set_volume (GUnixDrive *drive,
* *
**/ **/
void void
_g_unix_drive_unset_volume (GUnixDrive *drive, _g_unix_drive_unset_volume (GUnixDrive *drive,
GUnixVolume *volume) GUnixVolume *volume)
{ {
if (drive->volume == volume) if (drive->volume == volume)
{ {
@@ -270,37 +270,37 @@ _g_unix_drive_has_mountpoint (GUnixDrive *drive,
} }
static void static void
g_unix_drive_mount (GDrive *drive, g_unix_drive_mount (GDrive *drive,
GMountOperation *mount_operation, GMountOperation *mount_operation,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
/* TODO */ /* TODO */
} }
static gboolean static gboolean
g_unix_drive_mount_finish (GDrive *drive, g_unix_drive_mount_finish (GDrive *drive,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
return TRUE; return TRUE;
} }
static void static void
g_unix_drive_eject (GDrive *drive, g_unix_drive_eject (GDrive *drive,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
/* TODO */ /* TODO */
} }
static gboolean static gboolean
g_unix_drive_eject_finish (GDrive *drive, g_unix_drive_eject_finish (GDrive *drive,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
return TRUE; return TRUE;
} }

View File

@@ -149,7 +149,7 @@ g_unix_input_stream_init (GUnixInputStream *unix_stream)
* Returns: a #GUnixInputStream. * Returns: a #GUnixInputStream.
**/ **/
GInputStream * GInputStream *
g_unix_input_stream_new (int fd, g_unix_input_stream_new (int fd,
gboolean close_fd_at_close) gboolean close_fd_at_close)
{ {
GUnixInputStream *stream; GUnixInputStream *stream;
@@ -165,11 +165,11 @@ g_unix_input_stream_new (int fd,
} }
static gssize static gssize
g_unix_input_stream_read (GInputStream *stream, g_unix_input_stream_read (GInputStream *stream,
void *buffer, void *buffer,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GUnixInputStream *unix_stream; GUnixInputStream *unix_stream;
gssize res; gssize res;
@@ -225,9 +225,9 @@ g_unix_input_stream_read (GInputStream *stream,
} }
static gboolean static gboolean
g_unix_input_stream_close (GInputStream *stream, g_unix_input_stream_close (GInputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GUnixInputStream *unix_stream; GUnixInputStream *unix_stream;
int res; int res;
@@ -242,12 +242,10 @@ g_unix_input_stream_close (GInputStream *stream,
/* This might block during the close. Doesn't seem to be a way to avoid it though. */ /* This might block during the close. Doesn't seem to be a way to avoid it though. */
res = close (unix_stream->priv->fd); res = close (unix_stream->priv->fd);
if (res == -1) if (res == -1)
{ g_set_error (error, G_IO_ERROR,
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
g_io_error_from_errno (errno), _("Error closing unix: %s"),
_("Error closing unix: %s"), g_strerror (errno));
g_strerror (errno));
}
break; break;
} }
@@ -265,8 +263,8 @@ typedef struct {
static gboolean static gboolean
read_async_cb (ReadAsyncData *data, read_async_cb (ReadAsyncData *data,
GIOCondition condition, GIOCondition condition,
int fd) int fd)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
GError *error = NULL; GError *error = NULL;
@@ -348,9 +346,9 @@ g_unix_input_stream_read_async (GInputStream *stream,
} }
static gssize static gssize
g_unix_input_stream_read_finish (GInputStream *stream, g_unix_input_stream_read_finish (GInputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nread; gssize nread;
@@ -375,9 +373,9 @@ g_unix_input_stream_skip_async (GInputStream *stream,
} }
static gssize static gssize
g_unix_input_stream_skip_finish (GInputStream *stream, g_unix_input_stream_skip_finish (GInputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
g_assert_not_reached (); g_assert_not_reached ();
/* TODO: Not implemented */ /* TODO: Not implemented */
@@ -419,12 +417,10 @@ close_async_cb (CloseAsyncData *data)
{ {
res = close (unix_stream->priv->fd); res = close (unix_stream->priv->fd);
if (res == -1) if (res == -1)
{ g_set_error (&error, G_IO_ERROR,
g_set_error (&error, G_IO_ERROR, g_io_error_from_errno (errno),
g_io_error_from_errno (errno), _("Error closing unix: %s"),
_("Error closing unix: %s"), g_strerror (errno));
g_strerror (errno));
}
break; break;
} }
@@ -450,11 +446,11 @@ close_async_cb (CloseAsyncData *data)
} }
static void static void
g_unix_input_stream_close_async (GInputStream *stream, g_unix_input_stream_close_async (GInputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSource *idle; GSource *idle;
CloseAsyncData *data; CloseAsyncData *data;
@@ -472,9 +468,9 @@ g_unix_input_stream_close_async (GInputStream *stream,
} }
static gboolean static gboolean
g_unix_input_stream_close_finish (GInputStream *stream, g_unix_input_stream_close_finish (GInputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
/* Failures handled in generic close_finish code */ /* Failures handled in generic close_finish code */
return TRUE; return TRUE;

View File

@@ -686,7 +686,8 @@ aix_fs_ignorespace (FILE *fd)
/* read one word from file */ /* read one word from file */
static int static int
aix_fs_getword (FILE *fd, char *word) aix_fs_getword (FILE *fd,
char *word)
{ {
int c; int c;
@@ -716,7 +717,8 @@ typedef struct {
/* read mount points properties */ /* read mount points properties */
static int static int
aix_fs_get (FILE *fd, AixMountTableEntry *prop) aix_fs_get (FILE *fd,
AixMountTableEntry *prop)
{ {
static char word[PATH_MAX] = { 0 }; static char word[PATH_MAX] = { 0 };
char value[PATH_MAX]; char value[PATH_MAX];
@@ -1069,11 +1071,11 @@ g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass)
} }
static void static void
fstab_file_changed (GFileMonitor* monitor, fstab_file_changed (GFileMonitor *monitor,
GFile* file, GFile *file,
GFile* other_file, GFile *other_file,
GFileMonitorEvent event_type, GFileMonitorEvent event_type,
gpointer user_data) gpointer user_data)
{ {
GUnixMountMonitor *mount_monitor; GUnixMountMonitor *mount_monitor;
@@ -1087,11 +1089,11 @@ fstab_file_changed (GFileMonitor* monitor,
} }
static void static void
mtab_file_changed (GFileMonitor* monitor, mtab_file_changed (GFileMonitor *monitor,
GFile* file, GFile *file,
GFile* other_file, GFile *other_file,
GFileMonitorEvent event_type, GFileMonitorEvent event_type,
gpointer user_data) gpointer user_data)
{ {
GUnixMountMonitor *mount_monitor; GUnixMountMonitor *mount_monitor;
@@ -1205,8 +1207,8 @@ strcmp_null (const char *str1,
* or less than @mount2, respectively. * or less than @mount2, respectively.
**/ **/
gint gint
g_unix_mount_compare (GUnixMount *mount1, g_unix_mount_compare (GUnixMount *mount1,
GUnixMount *mount2) GUnixMount *mount2)
{ {
int res; int res;

View File

@@ -137,7 +137,7 @@ g_unix_output_stream_init (GUnixOutputStream *unix_stream)
* @fd will be closed when the #GOutputStream is closed. * @fd will be closed when the #GOutputStream is closed.
**/ **/
GOutputStream * GOutputStream *
g_unix_output_stream_new (int fd, g_unix_output_stream_new (int fd,
gboolean close_fd_at_close) gboolean close_fd_at_close)
{ {
GUnixOutputStream *stream; GUnixOutputStream *stream;
@@ -153,11 +153,11 @@ g_unix_output_stream_new (int fd,
} }
static gssize static gssize
g_unix_output_stream_write (GOutputStream *stream, g_unix_output_stream_write (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GUnixOutputStream *unix_stream; GUnixOutputStream *unix_stream;
gssize res; gssize res;
@@ -214,9 +214,9 @@ g_unix_output_stream_write (GOutputStream *stream,
} }
static gboolean static gboolean
g_unix_output_stream_close (GOutputStream *stream, g_unix_output_stream_close (GOutputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GUnixOutputStream *unix_stream; GUnixOutputStream *unix_stream;
int res; int res;
@@ -254,8 +254,8 @@ typedef struct {
static gboolean static gboolean
write_async_cb (WriteAsyncData *data, write_async_cb (WriteAsyncData *data,
GIOCondition condition, GIOCondition condition,
int fd) int fd)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
GError *error = NULL; GError *error = NULL;
@@ -304,13 +304,13 @@ write_async_cb (WriteAsyncData *data,
} }
static void static void
g_unix_output_stream_write_async (GOutputStream *stream, g_unix_output_stream_write_async (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSource *source; GSource *source;
GUnixOutputStream *unix_stream; GUnixOutputStream *unix_stream;
@@ -337,9 +337,9 @@ g_unix_output_stream_write_async (GOutputStream *stream,
} }
static gssize static gssize
g_unix_output_stream_write_finish (GOutputStream *stream, g_unix_output_stream_write_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gssize nwritten; gssize nwritten;
@@ -409,11 +409,11 @@ close_async_cb (CloseAsyncData *data)
} }
static void static void
g_unix_output_stream_close_async (GOutputStream *stream, g_unix_output_stream_close_async (GOutputStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSource *idle; GSource *idle;
CloseAsyncData *data; CloseAsyncData *data;
@@ -431,9 +431,9 @@ g_unix_output_stream_close_async (GOutputStream *stream,
} }
static gboolean static gboolean
g_unix_output_stream_close_finish (GOutputStream *stream, g_unix_output_stream_close_finish (GOutputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
/* Failures handled in generic close_finish code */ /* Failures handled in generic close_finish code */
return TRUE; return TRUE;

View File

@@ -171,10 +171,8 @@ _g_unix_volume_new (GUnixMount *mount,
} }
if (volume_name == NULL) if (volume_name == NULL)
{ /* TODO: Use volume size as name? */
/* TODO: Use volume size as name? */ volume_name = g_strdup (_("Unknown volume"));
volume_name = g_strdup (_("Unknown volume"));
}
volume->name = volume_name; volume->name = volume_name;
@@ -193,8 +191,8 @@ _g_unix_volume_unmounted (GUnixVolume *volume)
} }
void void
_g_unix_volume_unset_drive (GUnixVolume *volume, _g_unix_volume_unset_drive (GUnixVolume *volume,
GUnixDrive *drive) GUnixDrive *drive)
{ {
if (volume->drive == drive) if (volume->drive == drive)
{ {
@@ -261,18 +259,18 @@ g_unix_volume_can_eject (GVolume *volume)
} }
static void static void
g_unix_volume_unmount (GVolume *volume, g_unix_volume_unmount (GVolume *volume,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
/* TODO */ /* TODO */
} }
static gboolean static gboolean
g_unix_volume_unmount_finish (GVolume *volume, g_unix_volume_unmount_finish (GVolume *volume,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
return TRUE; return TRUE;
} }

View File

@@ -140,7 +140,7 @@ g_unix_volume_monitor_class_init (GUnixVolumeMonitorClass *klass)
static void static void
mountpoints_changed (GUnixMountMonitor *mount_monitor, mountpoints_changed (GUnixMountMonitor *mount_monitor,
gpointer user_data) gpointer user_data)
{ {
GUnixVolumeMonitor *unix_monitor = user_data; GUnixVolumeMonitor *unix_monitor = user_data;
@@ -151,7 +151,7 @@ mountpoints_changed (GUnixMountMonitor *mount_monitor,
static void static void
mounts_changed (GUnixMountMonitor *mount_monitor, mounts_changed (GUnixMountMonitor *mount_monitor,
gpointer user_data) gpointer user_data)
{ {
GUnixVolumeMonitor *unix_monitor = user_data; GUnixVolumeMonitor *unix_monitor = user_data;
@@ -195,8 +195,11 @@ _g_unix_volume_monitor_new (void)
} }
static void static void
diff_sorted_lists (GList *list1, GList *list2, GCompareFunc compare, diff_sorted_lists (GList *list1,
GList **added, GList **removed) GList *list2,
GCompareFunc compare,
GList **added,
GList **removed)
{ {
int order; int order;
@@ -244,7 +247,7 @@ diff_sorted_lists (GList *list1, GList *list2, GCompareFunc compare,
**/ **/
GUnixDrive * GUnixDrive *
_g_unix_volume_monitor_lookup_drive_for_mountpoint (GUnixVolumeMonitor *monitor, _g_unix_volume_monitor_lookup_drive_for_mountpoint (GUnixVolumeMonitor *monitor,
const char *mountpoint) const char *mountpoint)
{ {
GList *l; GList *l;

View File

@@ -81,7 +81,7 @@ g_vfs_is_active (GVfs *vfs)
* Returns: a #GFile. * Returns: a #GFile.
**/ **/
GFile * GFile *
g_vfs_get_file_for_path (GVfs *vfs, g_vfs_get_file_for_path (GVfs *vfs,
const char *path) const char *path)
{ {
GVfsClass *class; GVfsClass *class;
@@ -109,7 +109,7 @@ g_vfs_get_file_for_path (GVfs *vfs,
* *
**/ **/
GFile * GFile *
g_vfs_get_file_for_uri (GVfs *vfs, g_vfs_get_file_for_uri (GVfs *vfs,
const char *uri) const char *uri)
{ {
GVfsClass *class; GVfsClass *class;
@@ -154,7 +154,7 @@ g_vfs_get_supported_uri_schemes (GVfs *vfs)
* Returns: a #GFile for the given @parse_name. * Returns: a #GFile for the given @parse_name.
**/ **/
GFile * GFile *
g_vfs_parse_name (GVfs *vfs, g_vfs_parse_name (GVfs *vfs,
const char *parse_name) const char *parse_name)
{ {
GVfsClass *class; GVfsClass *class;

View File

@@ -247,16 +247,15 @@ g_volume_can_eject (GVolume *volume)
* @callback: a #GAsyncReadyCallback. * @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Unmounts a volume. This is an asynchronous operation, and is finished by calling * Unmounts a volume. This is an asynchronous operation, and is
* g_volume_unmount_finish() with the @volume and #GAsyncResults data returned in the * finished by calling g_volume_unmount_finish() with the @volume
* @callback. * and #GAsyncResults data returned in the @callback.
*
**/ **/
void void
g_volume_unmount (GVolume *volume, g_volume_unmount (GVolume *volume,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GVolumeIface *iface; GVolumeIface *iface;
@@ -290,9 +289,9 @@ g_volume_unmount (GVolume *volume,
* Returns: %TRUE if the volume was successfully unmounted. %FALSE otherwise. * Returns: %TRUE if the volume was successfully unmounted. %FALSE otherwise.
**/ **/
gboolean gboolean
g_volume_unmount_finish (GVolume *volume, g_volume_unmount_finish (GVolume *volume,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GVolumeIface *iface; GVolumeIface *iface;
@@ -317,16 +316,15 @@ g_volume_unmount_finish (GVolume *volume,
* @callback: a #GAsyncReadyCallback. * @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback. * @user_data: user data passed to @callback.
* *
* Ejects a volume. This is an asynchronous operation, and is finished * Ejects a volume. This is an asynchronous operation, and is
* by calling g_volume_eject_finish() from the @callback with the @volume and * finished by calling g_volume_eject_finish() from the @callback
* #GAsyncResults returned in the callback. * with the @volume and #GAsyncResults returned in the callback.
*
**/ **/
void void
g_volume_eject (GVolume *volume, g_volume_eject (GVolume *volume,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GVolumeIface *iface; GVolumeIface *iface;
@@ -360,9 +358,9 @@ g_volume_eject (GVolume *volume,
* Returns: %TRUE if the volume was successfully ejected. %FALSE otherwise. * Returns: %TRUE if the volume was successfully ejected. %FALSE otherwise.
**/ **/
gboolean gboolean
g_volume_eject_finish (GVolume *volume, g_volume_eject_finish (GVolume *volume,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GVolumeIface *iface; GVolumeIface *iface;

View File

@@ -32,7 +32,6 @@
* @see_also: #GDirectoryMonitor, #GFileMonitor * @see_also: #GDirectoryMonitor, #GFileMonitor
* *
* Monitors a mounted volume for changes. * Monitors a mounted volume for changes.
*
**/ **/
G_DEFINE_TYPE (GVolumeMonitor, g_volume_monitor, G_TYPE_OBJECT); G_DEFINE_TYPE (GVolumeMonitor, g_volume_monitor, G_TYPE_OBJECT);
@@ -154,7 +153,7 @@ g_volume_monitor_init (GVolumeMonitor *monitor)
* Returns: a #GList of mounted #GVolumes. * Returns: a #GList of mounted #GVolumes.
**/ **/
GList * GList *
g_volume_monitor_get_mounted_volumes (GVolumeMonitor *volume_monitor) g_volume_monitor_get_mounted_volumes (GVolumeMonitor *volume_monitor)
{ {
GVolumeMonitorClass *class; GVolumeMonitorClass *class;

View File

@@ -183,7 +183,7 @@ g_win32_app_info_dup (GAppInfo *appinfo)
static gboolean static gboolean
g_win32_app_info_equal (GAppInfo *appinfo1, g_win32_app_info_equal (GAppInfo *appinfo1,
GAppInfo *appinfo2) GAppInfo *appinfo2)
{ {
GWin32AppInfo *info1 = G_WIN32_APP_INFO (appinfo1); GWin32AppInfo *info1 = G_WIN32_APP_INFO (appinfo1);
GWin32AppInfo *info2 = G_WIN32_APP_INFO (appinfo2); GWin32AppInfo *info2 = G_WIN32_APP_INFO (appinfo2);
@@ -239,10 +239,10 @@ g_win32_app_info_get_icon (GAppInfo *appinfo)
} }
static gboolean static gboolean
g_win32_app_info_launch (GAppInfo *appinfo, g_win32_app_info_launch (GAppInfo *appinfo,
GList *files, GList *files,
GAppLaunchContext *launch_context, GAppLaunchContext *launch_context,
GError **error) GError **error)
{ {
GWin32AppInfo *info = G_WIN32_APP_INFO (appinfo); GWin32AppInfo *info = G_WIN32_APP_INFO (appinfo);
ASSOCF flags; ASSOCF flags;
@@ -256,11 +256,11 @@ g_win32_app_info_launch (GAppInfo *appinfo,
if (info->id_is_exename) if (info->id_is_exename)
flags |= ASSOCF_INIT_BYEXENAME; flags |= ASSOCF_INIT_BYEXENAME;
if (AssocQueryKeyW(flags, if (AssocQueryKeyW (flags,
ASSOCKEY_SHELLEXECCLASS, ASSOCKEY_SHELLEXECCLASS,
info->id, info->id,
NULL, NULL,
&class_key) != S_OK) &class_key) != S_OK)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Can't find application")); g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Can't find application"));
return FALSE; return FALSE;
@@ -320,17 +320,19 @@ g_win32_app_info_supports_uris (GAppInfo *appinfo)
} }
static gboolean static gboolean
g_win32_app_info_launch_uris (GAppInfo *appinfo, g_win32_app_info_launch_uris (GAppInfo *appinfo,
GList *uris, GList *uris,
GAppLaunchContext *launch_context, GAppLaunchContext *launch_context,
GError **error) GError **error)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("URIs not supported")); g_set_error (error, G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("URIs not supported"));
return FALSE; return FALSE;
} }
static gboolean static gboolean
g_win32_app_info_should_show (GAppInfo *appinfo, g_win32_app_info_should_show (GAppInfo *appinfo,
const char *win32_env) const char *win32_env)
{ {
GWin32AppInfo *info = G_WIN32_APP_INFO (appinfo); GWin32AppInfo *info = G_WIN32_APP_INFO (appinfo);
@@ -343,20 +345,24 @@ g_win32_app_info_should_show (GAppInfo *appinfo,
static gboolean static gboolean
g_win32_app_info_set_as_default_for_type (GAppInfo *appinfo, g_win32_app_info_set_as_default_for_type (GAppInfo *appinfo,
const char *content_type, const char *content_type,
GError **error) GError **error)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("association changes not supported on win32")); g_set_error (error, G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("association changes not supported on win32"));
return FALSE; return FALSE;
} }
GAppInfo * GAppInfo *
g_app_info_create_from_commandline (const char *commandline, g_app_info_create_from_commandline (const char *commandline,
const char *application_name, const char *application_name,
GAppInfoCreateFlags flags, GAppInfoCreateFlags flags,
GError **error) GError **error)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("Association creation not supported on win32")); g_set_error (error, G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("Association creation not supported on win32"));
return NULL; return NULL;
} }
@@ -379,7 +385,7 @@ g_win32_app_info_iface_init (GAppInfoIface *iface)
} }
static void static void
enumerate_open_with_list (HKEY dir_key, enumerate_open_with_list (HKEY dir_key,
GList **prognames) GList **prognames)
{ {
DWORD index; DWORD index;
@@ -393,14 +399,14 @@ enumerate_open_with_list (HKEY dir_key,
index = 0; index = 0;
name_len = 256; name_len = 256;
nbytes = sizeof (data) - 2; nbytes = sizeof (data) - 2;
while (RegEnumValueW(dir_key, while (RegEnumValueW (dir_key,
index, index,
name, name,
&name_len, &name_len,
0, 0,
&type, &type,
(LPBYTE)data, (LPBYTE)data,
&nbytes) == ERROR_SUCCESS) &nbytes) == ERROR_SUCCESS)
{ {
data[nbytes/2] = '\0'; data[nbytes/2] = '\0';
if (type == REG_SZ && if (type == REG_SZ &&
@@ -418,14 +424,14 @@ enumerate_open_with_list (HKEY dir_key,
index = 0; index = 0;
name_len = 256; name_len = 256;
while (RegEnumKeyExW(dir_key, while (RegEnumKeyExW (dir_key,
index, index,
name, name,
&name_len, &name_len,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL) == ERROR_SUCCESS) NULL) == ERROR_SUCCESS)
{ {
*prognames = g_list_prepend (*prognames, g_memdup (name, (name_len + 1) * 2)); *prognames = g_list_prepend (*prognames, g_memdup (name, (name_len + 1) * 2));
index++; index++;
@@ -443,14 +449,14 @@ enumerate_open_with_progids (HKEY dir_key,
index = 0; index = 0;
name_len = 256; name_len = 256;
while (RegEnumValueW(dir_key, while (RegEnumValueW (dir_key,
index, index,
name, name,
&name_len, &name_len,
0, 0,
&type, &type,
NULL, NULL,
0) == ERROR_SUCCESS) 0) == ERROR_SUCCESS)
{ {
*progids = g_list_prepend (*progids, g_memdup (name, (name_len + 1) * 2)); *progids = g_list_prepend (*progids, g_memdup (name, (name_len + 1) * 2));
index++; index++;
@@ -459,7 +465,7 @@ enumerate_open_with_progids (HKEY dir_key,
} }
static void static void
enumerate_open_with_root (HKEY dir_key, enumerate_open_with_root (HKEY dir_key,
GList **progids, GList **progids,
GList **prognames) GList **prognames)
{ {
@@ -481,13 +487,14 @@ enumerate_open_with_root (HKEY dir_key,
} }
static gboolean static gboolean
app_info_in_list (GAppInfo *info, GList *l) app_info_in_list (GAppInfo *info,
GList *list)
{ {
while (l != NULL) while (list != NULL)
{ {
if (g_app_info_equal (info, l->data)) if (g_app_info_equal (info, list->data))
return TRUE; return TRUE;
l = l->next; list = list->next;
} }
return FALSE; return FALSE;
} }
@@ -577,7 +584,7 @@ g_app_info_get_all_for_type (const char *content_type)
GAppInfo * GAppInfo *
g_app_info_get_default_for_type (const char *content_type, g_app_info_get_default_for_type (const char *content_type,
gboolean must_support_uris) gboolean must_support_uris)
{ {
wchar_t *wtype; wchar_t *wtype;
wchar_t buffer[1024]; wchar_t buffer[1024];
@@ -587,12 +594,12 @@ g_app_info_get_default_for_type (const char *content_type,
/* Verify that we have some sort of app registered for this type */ /* Verify that we have some sort of app registered for this type */
buffer_size = 1024; buffer_size = 1024;
if (AssocQueryStringW(0, if (AssocQueryStringW (0,
REAL_ASSOCSTR_COMMAND, REAL_ASSOCSTR_COMMAND,
wtype, wtype,
NULL, NULL,
buffer, buffer,
&buffer_size) == S_OK) &buffer_size) == S_OK)
/* Takes ownership of wtype */ /* Takes ownership of wtype */
return g_desktop_app_info_new_from_id (wtype, FALSE); return g_desktop_app_info_new_from_id (wtype, FALSE);
@@ -624,14 +631,14 @@ g_app_info_get_all (void)
infos = NULL; infos = NULL;
index = 0; index = 0;
name_len = 256; name_len = 256;
while (RegEnumKeyExW(reg_key, while (RegEnumKeyExW (reg_key,
index, index,
name, name,
&name_len, &name_len,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL) == ERROR_SUCCESS) NULL) == ERROR_SUCCESS)
{ {
wchar_t *name_dup = g_memdup (name, (name_len+1)*2); wchar_t *name_dup = g_memdup (name, (name_len+1)*2);
/* name_dup ownership is taken */ /* name_dup ownership is taken */