~ubuntu-branches/ubuntu/wily/evolution-data-server/wily

« back to all changes in this revision

Viewing changes to camel/camel-stream.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2015-07-20 13:34:59 UTC
  • mfrom: (1.1.126) (1.2.48 sid)
  • Revision ID: package-import@ubuntu.com-20150720133459-g6y46hnu5ewtoz08
Tags: 3.16.4-0ubuntu2
debian/patches/0001-Bug-752373-Monthly-events-do-not-recur-correctly.patch:
Cherry-pick patch from upstream to fix events not recurring correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
 
/* camel-stream.c : abstract class for a stream */
3
 
 
4
 
/*
5
 
 * Author:
6
 
 *  Bertrand Guiheneuf <bertrand@helixcode.com>
 
2
/* camel-stream.c : abstract class for a stream
7
3
 *
8
4
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
9
5
 *
10
 
 * This library is free software you can redistribute it and/or modify it
 
6
 * This library is free software: you can redistribute it and/or modify it
11
7
 * under the terms of the GNU Lesser General Public License as published by
12
8
 * the Free Software Foundation.
13
9
 *
14
10
 * This library is distributed in the hope that it will be useful, but
15
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17
 
 *for more details.
 
12
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 
13
 * for more details.
18
14
 *
19
15
 * You should have received a copy of the GNU Lesser General Public License
20
 
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 
16
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
 
17
 *
 
18
 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
21
19
 */
22
20
 
23
21
#include "camel-stream.h"
149
147
              GError **error)
150
148
{
151
149
        GIOStream *base_stream;
152
 
        gssize n_bytes_written = (gssize) n;
 
150
        gssize n_bytes_written = -1;
153
151
 
154
152
        base_stream = camel_stream_ref_base_stream (stream);
155
153
 
156
154
        if (base_stream != NULL) {
157
155
                GOutputStream *output_stream;
 
156
                gsize n_written = 0;
158
157
 
159
158
                output_stream = g_io_stream_get_output_stream (base_stream);
160
159
                stream->eos = FALSE;
161
160
 
162
 
                n_bytes_written = g_output_stream_write (
163
 
                        output_stream, buffer, n, cancellable, error);
 
161
                if (g_output_stream_write_all (output_stream, buffer, n, &n_written, cancellable, error))
 
162
                        n_bytes_written = (gssize) n_written;
 
163
                else
 
164
                        n_bytes_written = -1;
164
165
 
165
166
                g_object_unref (base_stream);
 
167
        } else {
 
168
                g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot write with no base stream"));
166
169
        }
167
170
 
168
171
        return n_bytes_written;