aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-fs.c
diff options
context:
space:
mode:
authorbertrand <bertrand@helixcode.com>2000-03-03 10:54:25 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-03-03 10:54:25 +0800
commit2392d67981785dac17f56305f8ee3fc0b5884694 (patch)
tree40b56668dd5c95dbe50fd6f1b70c67d7ac2dac73 /camel/camel-stream-fs.c
parent9cf31d6b063eacf768ea835fad15377aaddf6dc1 (diff)
downloadgsoc2013-evolution-2392d67981785dac17f56305f8ee3fc0b5884694.tar.gz
gsoc2013-evolution-2392d67981785dac17f56305f8ee3fc0b5884694.tar.zst
gsoc2013-evolution-2392d67981785dac17f56305f8ee3fc0b5884694.zip
don't forget to set the state to 0 after 3. (my_read_encode): don't forget
2000-03-02 bertrand <bertrand@helixcode.com> * camel-stream-b64.c (my_read_encode): don't forget to set the state to 0 after 3. (my_read_encode): don't forget to encode, even in state 3. * camel-simple-data-wrapper.c: static functions are prefixed with my_ instead of _ * camel-multipart.c: static functions are prefixed with my_ instead of _ (my_write_to_stream): commented. (my_write_to_stream): warning in case the boudary is set but is a zero length string. * camel-mime-part.c (camel_mime_part_encoding_from_string): remove debug trace. * camel-mime-part.c: Replaced all static functions with name begining with _ by the same name begining with "my_" to prevent the possible conflicts with system symbols Dan warned us about. Mime mail generation works now, at least with b64 encoding. QP needs to be done now. svn path=/trunk/; revision=2016
Diffstat (limited to 'camel/camel-stream-fs.c')
-rw-r--r--camel/camel-stream-fs.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index f2aab64910..4455c40b2b 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -355,6 +355,7 @@ _read (CamelStream *stream, gchar *buffer, gint n)
do {
v = read ( (CAMEL_STREAM_FS (stream))->fd, buffer, nb_to_read);
} while (v == -1 && errno == EINTR);
+
if (v<0)
CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::read v=%d\n", v);
else
@@ -384,18 +385,20 @@ _write (CamelStream *stream, const gchar *buffer, gint n)
CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
int v;
gint nb_to_write;
+ gint nb_bytes_written = 0;
+ if (n <= 0)
+ return 0;
+
g_assert (stream);
g_assert (stream_fs->fd);
CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs:: entering write. n=%d\n", n);
- if (stream_fs->sup_bound != -1)
- nb_to_write = MIN (stream_fs->sup_bound - CAMEL_SEEKABLE_STREAM (stream)->cur_pos, n);
- else
- nb_to_write = n;
-
+ /* we do not take the end bounds into account as it does not
+ really make any sense in the case of a write operation */
do {
- v = write ( stream_fs->fd, buffer, nb_to_write);
+ v = write ( stream_fs->fd, buffer, n);
+ if (v>0) nb_bytes_written += v;
} while (v == -1 && errno == EINTR);
#if HARD_LOG_LEVEL >= FULL_DEBUG
@@ -405,10 +408,10 @@ _write (CamelStream *stream, const gchar *buffer, gint n)
}
#endif
- if (v>0)
- CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v;
+ if (nb_bytes_written>0)
+ CAMEL_SEEKABLE_STREAM (stream)->cur_pos += nb_bytes_written;
- return v;
+ return nb_bytes_written;
}