aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--camel/camel-exception.c5
-rw-r--r--camel/camel-stream-fs.c46
-rw-r--r--camel/camel-stream-fs.h10
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c2
-rw-r--r--tests/test10.c6
6 files changed, 52 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 293dbe0b67..4031944400 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2000-01-24 bertrand <bertrand@helixcode.com>
+ * camel/camel-stream-fs.[ch]: converted all
+ gint64 variables into guint32.
+
+
+ * camel/camel-stream-fs.c (_read): fix stupid bug.
+ (_write): ditto.
+
+ * camel/camel-exception.c (camel_exception_new): don't
+ forget to clean the exception when creating it.
+
* camel/camel-recipient.c (camel_recipient_table_add_list):
add recipient_list to the recipients, not recipients_list.
I don't know what that variable was doing here.
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
index 0a4b92b8ef..a983150612 100644
--- a/camel/camel-exception.c
+++ b/camel/camel-exception.c
@@ -43,6 +43,11 @@ camel_exception_new ()
CamelException *ex;
ex = g_new (CamelException, 1);
+ ex->desc = NULL;
+
+ /* set the Exception Id to NULL */
+ ex->id = CAMEL_EXCEPTION_NONE;
+
return ex;
}
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index 4c5d12eb0c..905582aae2 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -52,10 +52,10 @@ static void _finalize (GtkObject *object);
static void _destroy (GtkObject *object);
static void _init_with_fd (CamelStreamFs *stream_fs, int fd);
-static void _init_with_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint64 sup_bound);
+static void _init_with_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint32 sup_bound);
static void _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode);
static void _init_with_name_and_bounds (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode,
- guint32 inf_bound, gint64 sup_bound);
+ guint32 inf_bound, gint32 sup_bound);
static void
camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class)
@@ -155,16 +155,25 @@ _finalize (GtkObject *object)
static void
-_set_bounds (CamelStreamFs *stream_fs, guint32 inf_bound, gint64 sup_bound)
+_set_bounds (CamelStreamFs *stream_fs, guint32 inf_bound, guint32 sup_bound)
{
+
+ printf ("sup_bounds = %u\n", sup_bound);
/* store the bounds */
stream_fs->inf_bound = inf_bound;
stream_fs->sup_bound = sup_bound;
/* go to the first position */
- lseek ((CAMEL_STREAM_FS (stream_fs))->fd, inf_bound, SEEK_SET);
+ lseek (stream_fs->fd, inf_bound, SEEK_SET);
stream_fs->cur_pos = inf_bound;
+
+ CAMEL_LOG_FULL_DEBUG ("In CamelStreamFs::_set_bounds, "
+ "setting inf bound to %u, "
+ "sup bound to %ld, current postion to %u from %u\n",
+ stream_fs->inf_bound, stream_fs->sup_bound,
+ stream_fs->cur_pos, inf_bound);
+
}
@@ -173,17 +182,17 @@ _set_bounds (CamelStreamFs *stream_fs, guint32 inf_bound, gint64 sup_bound)
static void
_init_with_fd (CamelStreamFs *stream_fs, int fd)
{
- /* no bounds by default */
- _set_bounds (stream_fs, 0, -1);
-
stream_fs->fd = fd;
+ stream_fs->inf_bound = 0;
+ stream_fs->sup_bound = -1;
+ stream_fs->cur_pos = 0;
}
static void
-_init_with_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint64 sup_bound)
+_init_with_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint32 sup_bound)
{
CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd);
@@ -231,20 +240,21 @@ _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode
stream_fs->name = g_strdup (name);
CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd);
- /* no bounds by default */
- _set_bounds (stream_fs, 0, -1);
-
-
}
static void
_init_with_name_and_bounds (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode,
- guint32 inf_bound, gint64 sup_bound)
+ guint32 inf_bound, gint32 sup_bound)
{
CSFS_CLASS (stream_fs)->init_with_name (stream_fs, name, mode);
- _set_bounds (stream_fs, inf_bound, sup_bound);
+ _set_bounds (stream_fs, inf_bound, (gint32)sup_bound);
+ CAMEL_LOG_FULL_DEBUG ("In CamelStreamFs::init_with_name_and_bounds, "
+ "setting inf bound to %u, "
+ "sup bound to %ld, current postion to %u\n",
+ stream_fs->inf_bound, stream_fs->sup_bound,
+ stream_fs->cur_pos);
}
@@ -264,7 +274,7 @@ camel_stream_fs_new_with_name (const gchar *name, CamelStreamFsMode mode)
CamelStream *
camel_stream_fs_new_with_name_and_bounds (const gchar *name, CamelStreamFsMode mode,
- guint32 inf_bound, gint64 sup_bound)
+ guint32 inf_bound, gint32 sup_bound)
{
CamelStreamFs *stream_fs;
stream_fs = gtk_type_new (camel_stream_fs_get_type ());
@@ -295,7 +305,7 @@ camel_stream_fs_new_with_fd (int fd)
CamelStream *
-camel_stream_fs_new_with_fd_and_bounds (int fd, guint32 inf_bound, gint64 sup_bound)
+camel_stream_fs_new_with_fd_and_bounds (int fd, guint32 inf_bound, gint32 sup_bound)
{
CamelStreamFs *stream_fs;
@@ -326,7 +336,7 @@ _read (CamelStream *stream, gchar *buffer, gint n)
gint nb_to_read;
if (stream_fs->sup_bound != -1)
- nb_to_read = stream_fs->sup_bound - stream_fs->cur_pos;
+ nb_to_read = MIN (stream_fs->sup_bound - stream_fs->cur_pos, n);
else
nb_to_read = n;
@@ -365,7 +375,7 @@ _write (CamelStream *stream, const gchar *buffer, gint n)
CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs:: entering write. n=%d\n", n);
if (stream_fs->sup_bound != -1)
- nb_to_write = stream_fs->sup_bound - stream_fs->cur_pos;
+ nb_to_write = MIN (stream_fs->sup_bound - stream_fs->cur_pos, n);;
else
nb_to_write = n;
diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h
index dc559bc7c9..7b5e7011c0 100644
--- a/camel/camel-stream-fs.h
+++ b/camel/camel-stream-fs.h
@@ -58,7 +58,7 @@ typedef struct
gint fd; /* file descriptor on the underlying file */
guint32 cur_pos; /* current postion in the stream */
guint32 inf_bound; /* first valid position */
- gint64 sup_bound; /* last valid position, -1 means, no sup bound */
+ gint32 sup_bound; /* last valid position, -1 means, no sup bound */
} CamelStreamFs;
@@ -69,10 +69,10 @@ typedef struct {
/* Virtual methods */
void (*init_with_fd) (CamelStreamFs *stream_fs, int fd);
- void (*init_with_fd_and_bounds) (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint64 sup_bound);
+ void (*init_with_fd_and_bounds) (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint32 sup_bound);
void (*init_with_name) (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode);
void (*init_with_name_and_bounds) (CamelStreamFs *stream_fs, const gchar *name,
- CamelStreamFsMode mode, guint32 inf_bound, gint64 sup_bound);
+ CamelStreamFsMode mode, guint32 inf_bound, gint32 sup_bound);
} CamelStreamFsClass;
@@ -85,10 +85,10 @@ GtkType camel_stream_fs_get_type (void);
/* public methods */
CamelStream *camel_stream_fs_new_with_name (const gchar *name, CamelStreamFsMode mode);
CamelStream *camel_stream_fs_new_with_name_and_bounds (const gchar *name, CamelStreamFsMode mode,
- guint32 inf_bound, gint64 sup_bound);
+ guint32 inf_bound, gint32 sup_bound);
CamelStream *camel_stream_fs_new_with_fd (int fd);
CamelStream *camel_stream_fs_new_with_fd_and_bounds (int fd,
- guint32 inf_bound, gint64 sup_bound);
+ guint32 inf_bound, gint32 sup_bound);
#ifdef __cplusplus
}
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index e47ad29215..917cc98781 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -172,7 +172,7 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException
CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::init_with_store\n");
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::init_with_store\n");
/* call parent method */
parent_class->init_with_store (folder, parent_store, ex);
diff --git a/tests/test10.c b/tests/test10.c
index fc8cc326cf..a8835861d6 100644
--- a/tests/test10.c
+++ b/tests/test10.c
@@ -86,14 +86,14 @@ main (int argc, char**argv)
folder = camel_store_get_folder (store, "Inbox", ex);
if (camel_exception_get_id (ex)) {
- printf ("Exception caught in camel_store_get_folder"
+ printf ("Exception caught in camel_store_get_folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
camel_folder_open (folder, FOLDER_OPEN_RW, ex);
if (camel_exception_get_id (ex)) {
- printf ("Exception caught when trying to open the folder"
+ printf ("Exception caught when trying to open the folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
@@ -101,7 +101,7 @@ main (int argc, char**argv)
message = create_sample_mime_message ();
camel_folder_append_message (folder, message, ex);
if (camel_exception_get_id (ex)) {
- printf ("Exception caught when trying to append a message to the folder"
+ printf ("Exception caught when trying to append a message to the folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}