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

View File

@@ -1184,7 +1184,8 @@ g_desktop_app_info_set_as_default_for_extension (GAppInfo *appinfo,
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;
contents =
@@ -2179,15 +2180,15 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type)
/* Go through all entries that support the mimetype */
for (dir_list = mime_info_cache->dirs;
dir_list != NULL;
dir_list = dir_list->next) {
dir_list = dir_list->next)
{
dir = dir_list->data;
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);
}
}
}
G_UNLOCK (mime_info_cache);

View File

@@ -270,7 +270,8 @@ g_dummy_file_contains_file (GFile *parent,
descendant_dummy->decoded_uri != NULL)
{
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);
if (remainder != NULL && *remainder == '/')
@@ -310,7 +311,8 @@ g_dummy_file_get_relative_path (GFile *parent,
descendant_dummy->decoded_uri != NULL)
{
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);
if (remainder != NULL && *remainder == '/')
@@ -464,9 +466,11 @@ unescape_string (const gchar *escaped_string,
result = g_malloc (escaped_string_end - escaped_string + 1);
out = result;
for (in = escaped_string; in < escaped_string_end; in++) {
for (in = escaped_string; in < escaped_string_end; in++)
{
character = *in;
if (*in == '%') {
if (*in == '%')
{
in++;
if (escaped_string_end - in < 2)
{

View File

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

View File

@@ -29,14 +29,13 @@
/**
* 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
* contains a very minimal interface for checking the equality of two icons
* and hashing of icons.
* #GIcon is a very minimal interface for icons. It provides functions
* for checking the equality of two icons and hashing of icons.
*
* #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).
*
* To obtain a hash of a #GIcon, see g_icon_hash().

View File

@@ -32,8 +32,7 @@
* @short_description: Loadable Icons
* @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,
@@ -122,7 +121,6 @@ g_loadable_icon_load (GLoadableIcon *icon,
iface = G_LOADABLE_ICON_GET_IFACE (icon);
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
* g_loadable_icon_load_finish(). For the synchronous, blocking
* version of this function, see g_loadable_icon_load().
*
**/
void
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->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);
return (* iface->load_finish) (icon, res, type, error);
}
/********************************************

View File

@@ -452,7 +452,8 @@ g_local_file_equal (GFile *file1,
}
static const char *
match_prefix (const char *path, const char *prefix)
match_prefix (const char *path,
const char *prefix)
{
int prefix_len;
@@ -553,7 +554,8 @@ get_fs_type (long f_type)
{
/* filesystem ids taken from linux manpage */
switch (f_type) {
switch (f_type)
{
case 0xadf5:
return "adfs";
case 0xADFF:
@@ -1139,7 +1141,8 @@ expand_symlink (const char *link)
}
static char *
get_parent (const char *path, dev_t *parent_dev)
get_parent (const char *path,
dev_t *parent_dev)
{
char *parent, *tmp;
struct stat parent_stat;
@@ -1209,7 +1212,8 @@ expand_all_symlinks (const char *path)
}
static char *
find_mountpoint_for (const char *file, dev_t dev)
find_mountpoint_for (const char *file,
dev_t dev)
{
char *dir, *parent;
dev_t dir_dev, parent_dev;
@@ -1217,7 +1221,8 @@ find_mountpoint_for (const char *file, dev_t dev)
dir = g_strdup (file);
dir_dev = dev;
while (1) {
while (1)
{
parent = get_parent (dir, &parent_dev);
if (parent == NULL)
return dir;
@@ -1247,7 +1252,8 @@ find_topdir_for (const char *file)
}
static char *
get_unique_filename (const char *basename, int id)
get_unique_filename (const char *basename,
int id)
{
const char *dot;
@@ -1262,7 +1268,8 @@ get_unique_filename (const char *basename, int id)
}
static gboolean
path_has_prefix (const char *path, const char *prefix)
path_has_prefix (const char *path,
const char *prefix)
{
int prefix_len;
@@ -1282,7 +1289,8 @@ path_has_prefix (const char *path, const char *prefix)
}
static char *
try_make_relative (const char *path, const char *base)
try_make_relative (const char *path,
const char *base)
{
char *path2, *base2;
char *relative;
@@ -1770,7 +1778,7 @@ g_local_file_move (GFile *source,
static GDirectoryMonitor*
g_local_file_monitor_dir (GFile* file,
g_local_file_monitor_dir (GFile *file,
GFileMonitorFlags flags,
GCancellable *cancellable)
{
@@ -1779,7 +1787,7 @@ g_local_file_monitor_dir (GFile* file,
}
static GFileMonitor*
g_local_file_monitor_file (GFile* file,
g_local_file_monitor_file (GFile *file,
GFileMonitorFlags flags,
GCancellable *cancellable)
{

View File

@@ -111,8 +111,10 @@ convert_file_to_io_error (GError **error,
new_code = G_IO_ERROR_FAILED;
if (file_error->domain == G_FILE_ERROR) {
switch (file_error->code) {
if (file_error->domain == G_FILE_ERROR)
{
switch (file_error->code)
{
case G_FILE_ERROR_NOENT:
new_code = G_IO_ERROR_NOT_FOUND;
break;
@@ -145,7 +147,8 @@ _g_local_file_enumerator_new (const char *filename,
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);
return NULL;

View File

@@ -202,7 +202,8 @@ name_is_valid (const char *str)
}
static char *
hex_escape_string (const char *str, gboolean *free_return)
hex_escape_string (const char *str,
gboolean *free_return)
{
int num_invalid, i;
char *escaped_str, *p;
@@ -248,7 +249,9 @@ hex_escape_string (const char *str, gboolean *free_return)
}
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;
char *unescaped_str, *p;
@@ -680,7 +683,6 @@ set_xattr (char *filename,
attribute = hex_unescape_string (escaped_attribute, NULL, &free_attribute);
value = hex_unescape_string (attr_value->u.string, &val_len, &free_value);
if (is_user)
a = g_strconcat ("user.", attribute, NULL);
else
@@ -807,7 +809,8 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher,
}
static void
set_info_from_stat (GFileInfo *info, struct stat *statbuf,
set_info_from_stat (GFileInfo *info,
struct stat *statbuf,
GFileAttributeMatcher *attribute_matcher)
{
GFileType file_type;
@@ -1161,7 +1164,8 @@ get_content_type (const char *basename,
}
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";
char *res;
@@ -1169,7 +1173,8 @@ thumb_digest_to_ascii (unsigned char digest[16], const char *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];
}
@@ -1682,7 +1687,9 @@ set_symlink (char *filename,
#endif
static int
lazy_stat (char *filename, struct stat *statbuf, gboolean *called_stat)
lazy_stat (char *filename,
struct stat *statbuf,
gboolean *called_stat)
{
int res;
@@ -1989,7 +1996,8 @@ thumb_md5 (const char *string, unsigned char digest[16])
* Note: this code is harmless on little-endian machines.
*/
static void
byteReverse(unsigned char *buf, unsigned longs)
byteReverse (unsigned char *buf,
unsigned longs)
{
guint32 t;
do {
@@ -2075,7 +2083,8 @@ thumb_md5_update (struct ThumbMD5Context *ctx,
* 1 0* (64-bit count of bits processed, MSB-first)
*/
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 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.
*/
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;

View File

@@ -213,12 +213,10 @@ g_local_file_input_stream_close (GInputStream *stream,
{
res = close (file->priv->fd);
if (res == -1)
{
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errno),
_("Error closing file: %s"),
g_strerror (errno));
}
break;
}

View File

@@ -198,7 +198,7 @@ get_default_local_file_monitor (gpointer data)
* Returns: a new #GFileMonitor for the given @pathname.
**/
GFileMonitor*
_g_local_file_monitor_new (const char* pathname,
_g_local_file_monitor_new (const char *pathname,
GFileMonitorFlags flags)
{
static GOnce once_init = G_ONCE_INIT;

View File

@@ -363,7 +363,7 @@ g_local_file_output_stream_truncate (GFileOutputStream *stream,
file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
restart:
res = ftruncate(file->priv->fd, size);
res = ftruncate (file->priv->fd, size);
if (res == -1)
{

View File

@@ -186,7 +186,8 @@ g_memory_input_stream_set_free_data (GMemoryInputStream *stream,
* Returns: new #GInputStream read from @data of @len bytes.
**/
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;
GMemoryInputStream *memory_stream;
@@ -411,8 +412,8 @@ g_memory_input_stream_seek (GSeekable *seekable,
memory_stream = G_MEMORY_INPUT_STREAM (seekable);
priv = memory_stream->priv;
switch (type) {
switch (type)
{
case G_SEEK_CUR:
absolute = priv->pos + offset;
break;
@@ -469,5 +470,3 @@ g_memory_input_stream_truncate (GSeekable *seekable,
#define __G_MEMORY_INPUT_STREAM_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;
if (data == NULL) {
if (data == NULL)
stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM, NULL);
} else {
else
stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM,
"data", data,
NULL);
}
return stream;
}
@@ -276,14 +275,14 @@ g_memory_output_stream_set_max_size (GMemoryOutputStream *ostream,
priv->max_size = max_size;
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);
if (priv->pos > priv->max_size) {
if (priv->pos > priv->max_size)
priv->pos = priv->max_size;
}
}
g_object_notify (G_OBJECT (ostream), "size-limit");
}
@@ -306,18 +305,18 @@ g_memory_output_stream_set_property (GObject *object,
{
case PROP_DATA:
if (priv->data && priv->free_data) {
if (priv->data && priv->free_data)
g_byte_array_free (priv->data, TRUE);
}
data = g_value_get_pointer (value);
if (data == NULL) {
if (data == NULL)
{
data = g_byte_array_new ();
priv->free_data = TRUE;
} else {
priv->free_data = FALSE;
}
else
priv->free_data = FALSE;
priv->data = data;
priv->pos = 0;
@@ -395,12 +394,11 @@ array_check_boundary (GMemoryOutputStream *stream,
priv = stream->priv;
if (! priv->max_size) {
if (!priv->max_size)
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,
@@ -436,7 +434,6 @@ array_resize (GMemoryOutputStream *stream,
if (size > old_len && priv->pos > old_len)
memset (priv->data->data + priv->pos, 0, size - old_len);
return priv->data->len - priv->pos;
}
@@ -465,9 +462,7 @@ g_memory_output_stream_write (GOutputStream *stream,
new_size = priv->pos + count;
if (priv->max_size > 0)
{
new_size = MIN (new_size, priv->max_size);
}
n = array_resize (ostream, new_size, error);
@@ -480,10 +475,8 @@ g_memory_output_stream_write (GOutputStream *stream,
return -1;
}
else if (n < 0)
{
return -1;
}
}
dest = priv->data->data + priv->pos;
memcpy (dest, buffer, n);
@@ -533,7 +526,6 @@ g_memory_output_stream_write_async (GOutputStream *stream,
g_simple_async_result_set_op_res_gssize (simple, nwritten);
g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple);
}
static gssize
@@ -573,7 +565,6 @@ g_memory_output_stream_close_async (GOutputStream *stream,
g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple);
}
static gboolean
@@ -588,7 +579,6 @@ g_memory_output_stream_close_finish (GOutputStream *stream,
g_assert (g_simple_async_result_get_source_tag (simple) ==
g_memory_output_stream_close_async);
return TRUE;
}
@@ -624,8 +614,8 @@ g_memory_output_stream_seek (GSeekable *seekable,
stream = G_MEMORY_OUTPUT_STREAM (seekable);
priv = stream->priv;
switch (type) {
switch (type)
{
case G_SEEK_CUR:
absolute = priv->pos + offset;
break;
@@ -647,7 +637,8 @@ g_memory_output_stream_seek (GSeekable *seekable,
return FALSE;
}
if (absolute < 0) {
if (absolute < 0)
{
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
@@ -655,7 +646,7 @@ g_memory_output_stream_seek (GSeekable *seekable,
return FALSE;
}
if (! array_check_boundary (stream, absolute, error))
if (!array_check_boundary (stream, absolute, error))
return FALSE;
priv->pos = absolute;
@@ -689,5 +680,3 @@ g_memory_output_stream_truncate (GSeekable *seekable,
#define __G_MEMORY_OUTPUT_STREAM_C__
#include "gioaliasdef.c"
/* vim: ts=2 sw=2 et */

View File

@@ -235,7 +235,8 @@ g_output_stream_write (GOutputStream *stream,
* @stream: a #GOutputStream.
* @buffer: the buffer containing the data 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.
* @error: location to store the error occuring, or %NULL to ignore
*
@@ -288,6 +289,7 @@ g_output_stream_write_all (GOutputStream *stream,
if (bytes_written)
*bytes_written = _bytes_written;
return TRUE;
}
@@ -297,8 +299,8 @@ g_output_stream_write_all (GOutputStream *stream,
* @cancellable: optional cancellable object
* @error: location to store the error occuring, or %NULL to ignore
*
* Flushed any outstanding buffers in the stream. Will block during the operation.
* Closing the stream will implicitly cause a flush.
* Flushed any outstanding buffers in the stream. Will block during
* the operation. Closing the stream will implicitly cause a flush.
*
* This function is optional for inherited classes.
*
@@ -607,33 +609,36 @@ async_ready_close_callback_wrapper (GObject *source_object,
* @stream: A #GOutputStream.
* @buffer: the buffer containing the data 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.
* @callback: callback to call when the request is satisfied
* @user_data: the data to pass to callback function
*
* Request an asynchronous write of @count bytes from @buffer into the stream.
* When the operation is finished @callback will be called, giving the results.
* Request an asynchronous write of @count bytes from @buffer into
* 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
* result in %G_IO_ERROR_PENDING errors.
* During an async request no other sync and async calls are allowed,
* 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
* @callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. on a partial i/o error, but generally we try to write
* as many bytes as requested.
* @callback. It is not an error if this is not the same as the
* requested size, as it can happen e.g. on a partial I/O error,
* but generally we try to write as many bytes as requested.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is %G_PRIORITY_DEFAULT.
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is %G_PRIORITY_DEFAULT.
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* The asyncronous methods have a default fallback that uses threads
* to implement asynchronicity, so they are optional for inheriting
* 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
g_output_stream_write_async (GOutputStream *stream,
@@ -975,14 +980,15 @@ g_output_stream_flush_finish (GOutputStream *stream,
* @user_data: the data to pass to callback function
* @cancellable: optional cancellable object
*
* Requests an asynchronous close of the stream, releasing resources related to it.
* When the operation is finished @callback will be called, giving the results.
* Requests an asynchronous close of the stream, releasing resources
* related to it. When the operation is finished @callback will be
* called, giving the results.
*
* For behaviour details see g_output_stream_close().
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* The asyncronous methods have a default fallback that uses threads
* to implement asynchronicity, so they are optional for inheriting
* classes. However, if you override one you must override all.
**/
void
g_output_stream_close_async (GOutputStream *stream,
@@ -1251,7 +1257,6 @@ g_output_stream_real_splice_finish (GOutputStream *stream,
}
static void
flush_async_thread (GSimpleAsyncResult *res,
GObject *object,

View File

@@ -75,7 +75,8 @@ g_poll_file_monitor_init (GPollFileMonitor* poll_monitor)
}
static int
safe_strcmp (const char *a, const char *b)
safe_strcmp (const char *a,
const char *b)
{
if (a == NULL && b == NULL)
return 0;

View File

@@ -45,7 +45,7 @@ g_seekable_get_type (void)
{
static GType seekable_type = 0;
if (! seekable_type)
if (!seekable_type)
{
static const GTypeInfo seekable_info =
{

View File

@@ -65,26 +65,27 @@
* asynchronous functions and their finishing functions are used together
* correctly.
*
* To create a new #GSimpleAsyncResult, call g_simple_async_result_new(). 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.
* the asynchronous operation's doesn't take a #GError argument), but the result
* still needs to be created for an error condition, use
* To create a new #GSimpleAsyncResult, call g_simple_async_result_new().
* 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. the asynchronous operation's doesn't take a #GError argument),
* 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()
* if your application or binding requires passing a variable argument list
* directly), and the error can then be propegated through the use of
* g_simple_async_result_propagate_error().
*
* An asynchronous operation can be made to ignore a cancellation event by calling
* g_simple_async_result_set_handle_cancellation() with a #GSimpleAsyncResult
* for the operation and %FALSE.
* An asynchronous operation can be made to ignore a cancellation event by
* calling g_simple_async_result_set_handle_cancellation() with a
* #GSimpleAsyncResult for the operation and %FALSE.
*
* GSimpleAsyncResult can integrate into GLib's Main Event Loop <!-- TODO: Crosslink -->,
* or it can use #GThread<!-- -->s if available. g_simple_async_result_complete()
* will finish an I/O task directly within the main event loop.
* g_simple_async_result_complete_in_idle() will integrate the I/O task into the
* main event loop as an idle function and g_simple_async_result_run_in_thread()
* will run the job in a separate thread.
* GSimpleAsyncResult can integrate into GLib's Main Event Loop
* <!-- TODO: Crosslink -->, or it can use #GThread<!-- -->s if available.
* g_simple_async_result_complete() will finish an I/O task directly within
* the main event loop. g_simple_async_result_complete_in_idle() will
* integrate the I/O task into the main event loop as an idle function and
* g_simple_async_result_run_in_thread() will run the job in a separate
* thread.
*
* To set the results of an asynchronous function,
* g_simple_async_result_set_op_res_gpointer(),
@@ -236,7 +237,7 @@ g_simple_async_result_new_from_error (GObject *source_object,
* @domain: a #GQuark.
* @code: an error code.
* @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.
*
@@ -344,6 +345,7 @@ g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
simple->error = NULL;
return TRUE;
}
return FALSE;
}
@@ -386,7 +388,8 @@ g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
* @simple: a #GSimpleAsyncResult.
* @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
g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
@@ -417,7 +420,6 @@ g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
* @op_res: a #gboolean.
*
* Sets the operation result to a boolean within the asynchronous result.
*
**/
void
g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
@@ -433,8 +435,8 @@ g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
*
* Gets the operation result boolean from within the asynchronous result.
*
* Returns: %TRUE if the operation's result was %TRUE, %FALSE if the operation's
* result was %FALSE.
* Returns: %TRUE if the operation's result was %TRUE, %FALSE
* if the operation's result was %FALSE.
**/
gboolean
g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
@@ -486,8 +488,8 @@ _g_error_new_valist (GQuark domain,
* @format: a formatted error reporting string.
* @args: va_list of arguments.
*
* Sets an error within the asynchronous result without a #GError. Unless
* writing a binding, see g_simple_async_result_set_error().
* Sets an error within the asynchronous result without a #GError.
* Unless writing a binding, see g_simple_async_result_set_error().
**/
void
g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
@@ -510,10 +512,9 @@ g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
* @domain: a #GQuark (usually #G_IO_ERROR).
* @code: an error code.
* @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.
*
**/
void
g_simple_async_result_set_error (GSimpleAsyncResult *simple,
@@ -538,7 +539,6 @@ g_simple_async_result_set_error (GSimpleAsyncResult *simple,
* @simple: a #GSimpleAsyncResult.
*
* Completes an asynchronous I/O job.
*
**/
void
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
* an idle function.
*
**/
void
g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
@@ -602,18 +601,14 @@ run_in_thread (GIOJob *job,
if (simple->handle_cancellation &&
g_cancellable_is_cancelled (c))
{
g_simple_async_result_set_error (simple,
G_IO_ERROR,
G_IO_ERROR_CANCELLED,
_("Operation was cancelled"));
}
else
{
data->func (simple,
simple->source_object,
c);
}
g_simple_async_result_complete_in_idle (data->simple);
g_object_unref (data->simple);
@@ -628,7 +623,6 @@ run_in_thread (GIOJob *job,
* @cancellable: optional #GCancellable object, %NULL to ignore.
*
* Runs the asynchronous job in a separated thread.
*
**/
void
g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
@@ -655,10 +649,9 @@ g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
* @domain: a #GQuark containing the error domain (usually #G_IO_ERROR).
* @code: a specific error code.
* @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.
*
**/
void
g_simple_async_report_error_in_idle (GObject *object,

View File

@@ -114,7 +114,8 @@ g_themed_icon_new (const char *iconname)
* Returns: a new #GThemedIcon.
**/
GIcon *
g_themed_icon_new_from_names (char **iconnames, int len)
g_themed_icon_new_from_names (char **iconnames,
int len)
{
GThemedIcon *themed;
int i;

View File

@@ -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. */
res = close (unix_stream->priv->fd);
if (res == -1)
{
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errno),
_("Error closing unix: %s"),
g_strerror (errno));
}
break;
}
@@ -419,12 +417,10 @@ close_async_cb (CloseAsyncData *data)
{
res = close (unix_stream->priv->fd);
if (res == -1)
{
g_set_error (&error, G_IO_ERROR,
g_io_error_from_errno (errno),
_("Error closing unix: %s"),
g_strerror (errno));
}
break;
}

View File

@@ -686,7 +686,8 @@ aix_fs_ignorespace (FILE *fd)
/* read one word from file */
static int
aix_fs_getword (FILE *fd, char *word)
aix_fs_getword (FILE *fd,
char *word)
{
int c;
@@ -716,7 +717,8 @@ typedef struct {
/* read mount points properties */
static int
aix_fs_get (FILE *fd, AixMountTableEntry *prop)
aix_fs_get (FILE *fd,
AixMountTableEntry *prop)
{
static char word[PATH_MAX] = { 0 };
char value[PATH_MAX];
@@ -1069,9 +1071,9 @@ g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass)
}
static void
fstab_file_changed (GFileMonitor* monitor,
GFile* file,
GFile* other_file,
fstab_file_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
gpointer user_data)
{
@@ -1087,9 +1089,9 @@ fstab_file_changed (GFileMonitor* monitor,
}
static void
mtab_file_changed (GFileMonitor* monitor,
GFile* file,
GFile* other_file,
mtab_file_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
gpointer user_data)
{

View File

@@ -171,10 +171,8 @@ _g_unix_volume_new (GUnixMount *mount,
}
if (volume_name == NULL)
{
/* TODO: Use volume size as name? */
volume_name = g_strdup (_("Unknown volume"));
}
volume->name = volume_name;

View File

@@ -195,8 +195,11 @@ _g_unix_volume_monitor_new (void)
}
static void
diff_sorted_lists (GList *list1, GList *list2, GCompareFunc compare,
GList **added, GList **removed)
diff_sorted_lists (GList *list1,
GList *list2,
GCompareFunc compare,
GList **added,
GList **removed)
{
int order;

View File

@@ -247,10 +247,9 @@ g_volume_can_eject (GVolume *volume)
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
*
* Unmounts a volume. This is an asynchronous operation, and is finished by calling
* g_volume_unmount_finish() with the @volume and #GAsyncResults data returned in the
* @callback.
*
* Unmounts a volume. This is an asynchronous operation, and is
* finished by calling g_volume_unmount_finish() with the @volume
* and #GAsyncResults data returned in the @callback.
**/
void
g_volume_unmount (GVolume *volume,
@@ -317,10 +316,9 @@ g_volume_unmount_finish (GVolume *volume,
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
*
* Ejects a volume. This is an asynchronous operation, and is finished
* by calling g_volume_eject_finish() from the @callback with the @volume and
* #GAsyncResults returned in the callback.
*
* Ejects a volume. This is an asynchronous operation, and is
* finished by calling g_volume_eject_finish() from the @callback
* with the @volume and #GAsyncResults returned in the callback.
**/
void
g_volume_eject (GVolume *volume,

View File

@@ -32,7 +32,6 @@
* @see_also: #GDirectoryMonitor, #GFileMonitor
*
* Monitors a mounted volume for changes.
*
**/
G_DEFINE_TYPE (GVolumeMonitor, g_volume_monitor, G_TYPE_OBJECT);

View File

@@ -256,7 +256,7 @@ g_win32_app_info_launch (GAppInfo *appinfo,
if (info->id_is_exename)
flags |= ASSOCF_INIT_BYEXENAME;
if (AssocQueryKeyW(flags,
if (AssocQueryKeyW (flags,
ASSOCKEY_SHELLEXECCLASS,
info->id,
NULL,
@@ -325,7 +325,9 @@ g_win32_app_info_launch_uris (GAppInfo *appinfo,
GAppLaunchContext *launch_context,
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;
}
@@ -346,7 +348,9 @@ g_win32_app_info_set_as_default_for_type (GAppInfo *appinfo,
const char *content_type,
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;
}
@@ -356,7 +360,9 @@ g_app_info_create_from_commandline (const char *commandline,
GAppInfoCreateFlags flags,
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;
}
@@ -393,7 +399,7 @@ enumerate_open_with_list (HKEY dir_key,
index = 0;
name_len = 256;
nbytes = sizeof (data) - 2;
while (RegEnumValueW(dir_key,
while (RegEnumValueW (dir_key,
index,
name,
&name_len,
@@ -418,7 +424,7 @@ enumerate_open_with_list (HKEY dir_key,
index = 0;
name_len = 256;
while (RegEnumKeyExW(dir_key,
while (RegEnumKeyExW (dir_key,
index,
name,
&name_len,
@@ -443,7 +449,7 @@ enumerate_open_with_progids (HKEY dir_key,
index = 0;
name_len = 256;
while (RegEnumValueW(dir_key,
while (RegEnumValueW (dir_key,
index,
name,
&name_len,
@@ -481,13 +487,14 @@ enumerate_open_with_root (HKEY dir_key,
}
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;
l = l->next;
list = list->next;
}
return FALSE;
}
@@ -587,7 +594,7 @@ g_app_info_get_default_for_type (const char *content_type,
/* Verify that we have some sort of app registered for this type */
buffer_size = 1024;
if (AssocQueryStringW(0,
if (AssocQueryStringW (0,
REAL_ASSOCSTR_COMMAND,
wtype,
NULL,
@@ -624,7 +631,7 @@ g_app_info_get_all (void)
infos = NULL;
index = 0;
name_len = 256;
while (RegEnumKeyExW(reg_key,
while (RegEnumKeyExW (reg_key,
index,
name,
&name_len,