aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-12 12:30:18 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-12 12:30:18 +0800
commita406eacc7078359b8c0e84b70217d829aa81f526 (patch)
treeb8bc8b05296519f96df203e1122d78a5d2f36de1 /camel/camel-stream.c
parentbc22c33ee2e0648493d7dc5208f8fb12c466b716 (diff)
downloadgsoc2013-evolution-a406eacc7078359b8c0e84b70217d829aa81f526.tar
gsoc2013-evolution-a406eacc7078359b8c0e84b70217d829aa81f526.tar.gz
gsoc2013-evolution-a406eacc7078359b8c0e84b70217d829aa81f526.tar.bz2
gsoc2013-evolution-a406eacc7078359b8c0e84b70217d829aa81f526.tar.lz
gsoc2013-evolution-a406eacc7078359b8c0e84b70217d829aa81f526.tar.xz
gsoc2013-evolution-a406eacc7078359b8c0e84b70217d829aa81f526.tar.zst
gsoc2013-evolution-a406eacc7078359b8c0e84b70217d829aa81f526.zip
Use size_t and ssize_t for read/write methods
2000-07-12 Jeffrey Stedfast <fejj@helixcode.com> * camel-stream.c: Use size_t and ssize_t for read/write methods svn path=/trunk/; revision=4106
Diffstat (limited to 'camel/camel-stream.c')
-rw-r--r--camel/camel-stream.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
index 244b6cf9d8..2cdabacaba 100644
--- a/camel/camel-stream.c
+++ b/camel/camel-stream.c
@@ -84,8 +84,8 @@ camel_stream_get_type (void)
* Return value: number of bytes actually read, or -1 on error and
* set errno.
**/
-int
-camel_stream_read (CamelStream *stream, char *buffer, unsigned int n)
+ssize_t
+camel_stream_read (CamelStream *stream, char *buffer, size_t n)
{
g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
g_return_val_if_fail (n == 0 || buffer, -1);
@@ -104,8 +104,8 @@ camel_stream_read (CamelStream *stream, char *buffer, unsigned int n)
* Return value: the number of bytes actually written to the stream,
* or -1 on error.
**/
-int
-camel_stream_write (CamelStream *stream, const char *buffer, unsigned int n)
+ssize_t
+camel_stream_write (CamelStream *stream, const char *buffer, size_t n)
{
g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
g_return_val_if_fail (n == 0 || buffer, -1);
@@ -216,7 +216,7 @@ camel_stream_reset (CamelStream *stream)
*
* Return value: the number of characters output, -1 on error.
**/
-int
+ssize_t
camel_stream_write_string (CamelStream *stream, const char *string)
{
return camel_stream_write (stream, string, strlen (string));
@@ -231,7 +231,7 @@ camel_stream_write_string (CamelStream *stream, const char *string)
*
* Return value: the number of characters output, -1 on error.
**/
-int
+ssize_t
camel_stream_printf (CamelStream *stream, const char *fmt, ... )
{
va_list args;
@@ -263,13 +263,13 @@ camel_stream_printf (CamelStream *stream, const char *fmt, ... )
* Return value: Returns -1 on error, or the number of bytes succesfully
* copied across streams.
**/
-int
+ssize_t
camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream)
{
char tmp_buf[4096];
- int total = 0;
- int nb_read;
- int nb_written;
+ ssize_t total = 0;
+ ssize_t nb_read;
+ ssize_t nb_written;
g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
g_return_val_if_fail (CAMEL_IS_STREAM (output_stream), -1);
@@ -282,7 +282,8 @@ camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream)
nb_written = 0;
while (nb_written < nb_read) {
- int len = camel_stream_write (output_stream, tmp_buf + nb_written, nb_read - nb_written);
+ ssize_t len = camel_stream_write (output_stream, tmp_buf + nb_written,
+ nb_read - nb_written);
if (len < 0)
return -1;
nb_written += len;