Mostly dead assignments.
GError **error)
{
GBufferedOutputStream *bstream;
- GBufferedOutputStreamPrivate *priv;
GOutputStream *base_stream;
gboolean res;
bstream = G_BUFFERED_OUTPUT_STREAM (stream);
- priv = bstream->priv;
base_stream = G_FILTER_OUTPUT_STREAM (stream)->base_stream;
res = flush_buffer (bstream, cancellable, error);
GError **error)
{
GBufferedOutputStream *bstream;
- GBufferedOutputStreamPrivate *priv;
GOutputStream *base_stream;
gboolean res;
bstream = G_BUFFERED_OUTPUT_STREAM (stream);
- priv = bstream->priv;
base_stream = G_FILTER_OUTPUT_STREAM (bstream)->base_stream;
-
res = flush_buffer (bstream, cancellable, error);
if (g_filter_output_stream_get_close_base_stream (G_FILTER_OUTPUT_STREAM (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;
const char *stop_chars)
{
GBufferedInputStream *bstream;
- GDataInputStreamPrivate *priv;
const char *buffer;
gsize start, end, peeked;
int i;
- gssize found_pos;
gsize available, checked;
const char *stop_char;
- priv = stream->priv;
-
bstream = G_BUFFERED_INPUT_STREAM (stream);
checked = *checked_out;
- found_pos = -1;
-
+
start = checked;
buffer = (const char *)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
end = available;
}
static void
-g_string_append_encoded (GString *string,
+g_string_append_encoded (GString *string,
const char *encoded,
const char *reserved_chars_allowed)
{
unsigned char c;
- const char *end;
static const gchar hex[16] = "0123456789ABCDEF";
- end = encoded + strlen (encoded);
-
while ((c = *encoded) != 0)
{
if (is_valid (c, reserved_chars_allowed))
static void
g_input_stream_finalize (GObject *object)
{
- GInputStream *stream;
-
- stream = G_INPUT_STREAM (object);
-
G_OBJECT_CLASS (g_input_stream_parent_class)->finalize (object);
}
char buffer[8192];
GError *my_error;
- class = G_INPUT_STREAM_GET_CLASS (stream);
-
if (G_IS_SEEKABLE (stream) && g_seekable_can_seek (G_SEEKABLE (stream)))
{
if (g_seekable_seek (G_SEEKABLE (stream),
/* If not seekable, or seek failed, fall back to reading data: */
class = G_INPUT_STREAM_GET_CLASS (stream);
-
+
read_bytes = 0;
while (1)
{
my_error = NULL;
ret = class->read_fn (stream, buffer, MIN (sizeof (buffer), count),
- cancellable, &my_error);
+ cancellable, &my_error);
if (ret == -1)
{
if (read_bytes > 0 &&
g_error_free (my_error);
return read_bytes;
}
-
+
g_propagate_error (error, my_error);
return -1;
}
count -= ret;
read_bytes += ret;
-
+
if (ret == 0 || count == 0)
- return read_bytes;
+ return read_bytes;
}
}
static void
g_io_stream_finalize (GObject *object)
{
- GIOStream *stream;
-
- stream = G_IO_STREAM (object);
-
G_OBJECT_CLASS (g_io_stream_parent_class)->finalize (object);
}
char uid_str[32];
struct stat global_stat, trash_stat;
gboolean res;
- int statres;
-
+
if (g_once_init_enter (&home_dev_set))
{
struct stat home_stat;
-
+
g_stat (g_get_home_dir (), &home_stat);
home_dev = home_stat.st_dev;
g_once_init_leave (&home_dev_set, 1);
if (topdir == NULL)
return FALSE;
- globaldir = g_build_filename (topdir, ".Trash", NULL);
- statres = g_lstat (globaldir, &global_stat);
- if (g_lstat (globaldir, &global_stat) == 0 &&
+ globaldir = g_build_filename (topdir, ".Trash", NULL);
+ if (g_lstat (globaldir, &global_stat) == 0 &&
S_ISDIR (global_stat.st_mode) &&
(global_stat.st_mode & S_ISVTX) != 0)
{
/* No global trash dir, or it failed the tests, fall back to $topdir/.Trash-$uid */
uid = geteuid ();
g_snprintf (uid_str, sizeof (uid_str), "%lu", (unsigned long) uid);
-
+
tmpname = g_strdup_printf (".Trash-%s", uid_str);
trashdir = g_build_filename (topdir, tmpname, NULL);
g_free (tmpname);
{
g_free (topdir);
g_free (trashdir);
- return
- S_ISDIR (trash_stat.st_mode) &&
- trash_stat.st_uid == uid;
+ return S_ISDIR (trash_stat.st_mode) &&
+ trash_stat.st_uid == uid;
}
g_free (trashdir);
/* User specific trash didn't exist, can we create it? */
res = g_access (topdir, W_OK) == 0;
-
g_free (topdir);
-
+
return res;
}
static void
g_local_file_input_stream_finalize (GObject *object)
{
- GLocalFileInputStream *file;
-
- file = G_LOCAL_FILE_INPUT_STREAM (object);
-
G_OBJECT_CLASS (g_local_file_input_stream_parent_class)->finalize (object);
}
static void
g_output_stream_finalize (GObject *object)
{
- GOutputStream *stream;
-
- stream = G_OUTPUT_STREAM (object);
-
G_OBJECT_CLASS (g_output_stream_parent_class)->finalize (object);
}
* @stream: a #GOutputStream.
* @source: a #GInputStream.
* @flags: a set of #GOutputStreamSpliceFlags.
- * @cancellable: optional #GCancellable object, %NULL to ignore.
- * @error: a #GError location to store the error occuring, or %NULL to
+ * @cancellable: optional #GCancellable object, %NULL to ignore.
+ * @error: a #GError location to store the error occuring, or %NULL to
* ignore.
*
* Splices an input stream into an output stream.
*
- * Returns: a #gssize containing the size of the data spliced.
+ * Returns: a #gssize containing the size of the data spliced, or
+ * -1 if an error occurred.
**/
gssize
g_output_stream_splice (GOutputStream *stream,
GError **error)
{
GOutputStreamClass *class;
- gboolean res;
+ gssize bytes_copied;
g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), -1);
g_return_val_if_fail (G_IS_INPUT_STREAM (source), -1);
if (!g_output_stream_set_pending (stream, error))
return -1;
-
+
class = G_OUTPUT_STREAM_GET_CLASS (stream);
- res = TRUE;
if (cancellable)
g_cancellable_push_current (cancellable);
-
- res = class->splice (stream, source, flags, cancellable, error);
-
+
+ bytes_copied = class->splice (stream, source, flags, cancellable, error);
+
if (cancellable)
g_cancellable_pop_current (cancellable);
-
+
g_output_stream_clear_pending (stream);
- return res;
+ return bytes_copied;
}
static gssize
gboolean res;
bytes_copied = 0;
- if (class->write_fn == NULL)
+ if (class->write_fn == NULL)
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Output stream doesn't implement write"));
res = FALSE;
goto notsupported;
}
-
+
res = TRUE;
- do
+ do
{
n_read = g_input_stream_read (source, buffer, sizeof (buffer), cancellable, error);
if (n_read == -1)
res = FALSE;
break;
}
-
+
if (n_read == 0)
break;
static void
g_unix_input_stream_finalize (GObject *object)
{
- GUnixInputStream *stream;
-
- stream = G_UNIX_INPUT_STREAM (object);
-
G_OBJECT_CLASS (g_unix_input_stream_parent_class)->finalize (object);
}
static void
g_unix_output_stream_finalize (GObject *object)
{
- GUnixOutputStream *stream;
-
- stream = G_UNIX_OUTPUT_STREAM (object);
-
G_OBJECT_CLASS (g_unix_output_stream_parent_class)->finalize (object);
}
if (separator_len)
{
- while (start &&
- strncmp (start, separator, separator_len) == 0)
+ while (strncmp (start, separator, separator_len) == 0)
start += separator_len;
}
}
key_file->flags = flags;
- bytes_read = 0;
do
{
bytes_read = read (fd, read_buf, 4096);
return FALSE;
}
- g_key_file_parse_data (key_file,
+ g_key_file_parse_data (key_file,
read_buf, bytes_read,
&key_file_error);
}
g_match_info_next (GMatchInfo *match_info,
GError **error)
{
- gint opts;
gint prev_match_start;
gint prev_match_end;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (match_info->pos >= 0, FALSE);
- opts = match_info->regex->match_opts | match_info->match_opts;
-
prev_match_start = match_info->offsets[0];
prev_match_end = match_info->offsets[1];
match_info->string,
match_info->string_len,
match_info->pos,
- match_info->regex->match_opts |
- match_info->match_opts,
+ match_info->regex->match_opts | match_info->match_opts,
match_info->offsets,
match_info->n_offsets);
if (IS_PCRE_ERROR (match_info->matches))