aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-data-wrapper.c2
-rw-r--r--camel/camel-folder.c13
-rw-r--r--camel/camel-log.c2
-rw-r--r--camel/camel-mime-message.c6
-rw-r--r--camel/camel-mime-message.h91
-rw-r--r--camel/camel-mime-part.c2
-rw-r--r--camel/camel-mime-part.h44
-rw-r--r--camel/camel-service.c2
-rw-r--r--camel/camel-session.c2
-rw-r--r--camel/camel-simple-data-wrapper.c2
-rw-r--r--camel/camel-store.c2
-rw-r--r--camel/camel-stream-fs.c22
-rw-r--r--camel/camel-stream-fs.h1
-rw-r--r--camel/camel-stream.c142
-rw-r--r--camel/camel-stream.h22
-rw-r--r--camel/gmime-content-field.c4
-rw-r--r--camel/gmime-utils.c11
-rw-r--r--camel/gstring-util.c59
-rw-r--r--camel/gstring-util.h42
-rw-r--r--camel/url-util.c2
20 files changed, 255 insertions, 218 deletions
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 05d97d415d..b4ef2f9c36 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -23,7 +23,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-data-wrapper.h"
static GtkObjectClass *parent_class=NULL;
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index d7b54075be..63881d1422 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-folder.h"
#include "gstring-util.h"
@@ -362,12 +362,17 @@ _create(CamelFolder *folder)
g_assert(folder->parent_store);
g_assert(folder->name);
- if ( CF_CLASS(folder)->exists(folder) ) return TRUE;
+ if (CF_CLASS(folder)->exists(folder))
+ return TRUE;
+
sep = camel_store_get_separator(folder->parent_store);
- if (folder->parent_folder) camel_folder_create(folder->parent_folder);
+ if (folder->parent_folder)
+ camel_folder_create(folder->parent_folder);
else {
if (folder->full_name) {
- dich_result = g_string_dichotomy(folder->full_name, sep, &prefix, NULL, DICHOTOMY_STRIP_TRAILING | DICHOTOMY_RIGHT_DIR);
+ dich_result = g_string_dichotomy(
+ folder->full_name, sep, &prefix, NULL,
+ GSTRING_DICHOTOMY_STRIP_TRAILING | GSTRING_DICHOTOMY_RIGHT_DIR);
if (dich_result!='o') {
g_warning("I have to handle the case where the path is not OK\n");
return FALSE;
diff --git a/camel/camel-log.c b/camel/camel-log.c
index 59ce5573b2..a0dd8007b7 100644
--- a/camel/camel-log.c
+++ b/camel/camel-log.c
@@ -20,7 +20,7 @@
* USA
*/
-
+#include <config.h>
#include "camel-log.h"
int camel_debug_level = 10;
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index df65c127f6..61a4ca4c8d 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-mime-message.h"
#include <stdio.h>
#include "gmime-content-field.h"
@@ -564,7 +564,9 @@ _set_recipient_list_from_string (CamelMimeMessage *message, GString *recipient_t
{
GList *recipients_list;
CAMEL_LOG (FULL_DEBUG,"CamelMimeMessage::_set_recipient_list_from_string parsing ##%s##\n", recipients_string->str);
- recipients_list = g_string_split (recipients_string, ',', "\t ", TRIM_STRIP_TRAILING | TRIM_STRIP_LEADING);
+ recipients_list = g_string_split (
+ recipients_string, ',', "\t ",
+ GSTRING_TRIM_STRIP_TRAILING | GSTRING_TRIM_STRIP_LEADING);
g_hash_table_insert (message->recipients, recipient_type, recipients_list);
}
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
index 73d1cb9388..321f3fdade 100644
--- a/camel/camel-mime-message.h
+++ b/camel/camel-mime-message.h
@@ -81,24 +81,35 @@ typedef struct {
CamelMimePartClass parent_class;
/* Virtual methods */
- void (*set_received_date) (CamelMimeMessage *mime_message, GString *received_date);
+ void (*set_received_date) (CamelMimeMessage *mime_message,
+ GString *received_date);
GString * (*get_received_date) (CamelMimeMessage *mime_message);
- GString * (*get_sent_date) (CamelMimeMessage *mime_message);
- void (*set_reply_to) (CamelMimeMessage *mime_message, GString *reply_to);
- GString * (*get_reply_to) (CamelMimeMessage *mime_message);
- void (*set_subject) (CamelMimeMessage *mime_message, GString *subject);
- GString * (*get_subject) (CamelMimeMessage *mime_message);
- void (*set_from) (CamelMimeMessage *mime_message, GString *from);
- GString * (*get_from) (CamelMimeMessage *mime_message);
- void (*add_recipient) (CamelMimeMessage *mime_message, GString *recipient_type, GString *recipient);
- void (*remove_recipient) (CamelMimeMessage *mime_message, GString *recipient_type, GString *recipient);
- GList * (*get_recipients) (CamelMimeMessage *mime_message, GString *recipient_type);
- void (*set_flag) (CamelMimeMessage *mime_message, GString *flag, gboolean value);
- gboolean (*get_flag) (CamelMimeMessage *mime_message, GString *flag);
-
- void (*set_message_number) (CamelMimeMessage *mime_message, guint number);
- guint (*get_message_number) (CamelMimeMessage *mime_message);
-
+ GString * (*get_sent_date) (CamelMimeMessage *mime_message);
+ void (*set_reply_to) (CamelMimeMessage *mime_message,
+ GString *reply_to);
+ GString * (*get_reply_to) (CamelMimeMessage *mime_message);
+ void (*set_subject) (CamelMimeMessage *mime_message,
+ GString *subject);
+ GString * (*get_subject) (CamelMimeMessage *mime_message);
+ void (*set_from) (CamelMimeMessage *mime_message,
+ GString *from);
+ GString * (*get_from) (CamelMimeMessage *mime_message);
+ void (*add_recipient) (CamelMimeMessage *mime_message,
+ GString *recipient_type,
+ GString *recipient);
+ void (*remove_recipient) (CamelMimeMessage *mime_message,
+ GString *recipient_type,
+ GString *recipient);
+ GList * (*get_recipients) (CamelMimeMessage *mime_message,
+ GString *recipient_type);
+ void (*set_flag) (CamelMimeMessage *mime_message,
+ GString *flag, gboolean value);
+ gboolean (*get_flag) (CamelMimeMessage *mime_message,
+ GString *flag);
+
+ void (*set_message_number)(CamelMimeMessage *mime_message,
+ guint number);
+ guint (*get_message_number)(CamelMimeMessage *mime_message);
} CamelMimeMessageClass;
@@ -111,24 +122,34 @@ GtkType camel_mime_message_get_type (void);
CamelMimeMessage *camel_mime_message_new_with_session (CamelSession *session);
-void camel_mime_message_set_received_date (CamelMimeMessage *mime_message, GString *received_date);
-GString *camel_mime_message_get_received_date (CamelMimeMessage *mime_message);
-GString *camel_mime_message_get_sent_date (CamelMimeMessage *mime_message);
-void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, GString *reply_to);
-GString *camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
-void camel_mime_message_set_subject (CamelMimeMessage *mime_message, GString *subject);
-GString *camel_mime_message_get_subject (CamelMimeMessage *mime_message);
-void camel_mime_message_set_from (CamelMimeMessage *mime_message, GString *from);
-GString *camel_mime_message_get_from (CamelMimeMessage *mime_message);
-
-void camel_mime_message_add_recipient (CamelMimeMessage *mime_message, GString *recipient_type, GString *recipient);
-void camel_mime_message_remove_recipient (CamelMimeMessage *mime_message, GString *recipient_type, GString *recipient);
-GList *camel_mime_message_get_recipients (CamelMimeMessage *mime_message, GString *recipient_type);
-
-void camel_mime_message_set_flag (CamelMimeMessage *mime_message, GString *flag, gboolean value);
-gboolean camel_mime_message_get_flag (CamelMimeMessage *mime_message, GString *flag);
-
-guint camel_mime_message_get_message_number (CamelMimeMessage *mime_message);
+void camel_mime_message_set_received_date (CamelMimeMessage *mime_message,
+ GString *received_date);
+GString *camel_mime_message_get_received_date (CamelMimeMessage *mime_message);
+GString *camel_mime_message_get_sent_date (CamelMimeMessage *mime_message);
+void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message,
+ GString *reply_to);
+GString *camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
+void camel_mime_message_set_subject (CamelMimeMessage *mime_message,
+ GString *subject);
+GString *camel_mime_message_get_subject (CamelMimeMessage *mime_message);
+void camel_mime_message_set_from (CamelMimeMessage *mime_message, GString *from);
+GString *camel_mime_message_get_from (CamelMimeMessage *mime_message);
+
+void camel_mime_message_add_recipient (CamelMimeMessage *mime_message,
+ GString *recipient_type,
+ GString *recipient);
+void camel_mime_message_remove_recipient (CamelMimeMessage *mime_message,
+ GString *recipient_type,
+ GString *recipient);
+GList *camel_mime_message_get_recipients (CamelMimeMessage *mime_message,
+ GString *recipient_type);
+
+void camel_mime_message_set_flag (CamelMimeMessage *mime_message,
+ GString *flag, gboolean value);
+gboolean camel_mime_message_get_flag (CamelMimeMessage *mime_message,
+ GString *flag);
+
+guint camel_mime_message_get_message_number (CamelMimeMessage *mime_message);
#ifdef __cplusplus
}
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 0fdf749d38..aa40144acf 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-mime-part.h"
#include <stdio.h>
#include "gmime-content-field.h"
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index ad3ce17d2f..9f364c427c 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -104,23 +104,33 @@ GtkType camel_mime_part_get_type (void);
/* public methods */
-void camel_mime_part_add_header (CamelMimePart *mime_part, GString *header_name, GString *header_value);
-void camel_mime_part_remove_header (CamelMimePart *mime_part, GString *header_name);
-GString *camel_mime_part_get_header (CamelMimePart *mime_part, GString *header_name);
-void camel_mime_part_set_description (CamelMimePart *mime_part, GString *description);
-GString *camel_mime_part_get_description (CamelMimePart *mime_part);
-void camel_mime_part_set_disposition (CamelMimePart *mime_part, GString *disposition);
-GString *camel_mime_part_get_disposition (CamelMimePart *mime_part);
-void camel_mime_part_set_filename (CamelMimePart *mime_part, GString *filename);
-GString *camel_mime_part_get_filename (CamelMimePart *mime_part);
-GString *camel_mime_part_get_content_id (CamelMimePart *mime_part);
-GString *camel_mime_part_get_content_MD5 (CamelMimePart *mime_part);
-void camel_mime_part_set_encoding (CamelMimePart *mime_part, GString *encoding);
-GString *camel_mime_part_get_encoding (CamelMimePart *mime_part);
-void camel_mime_part_set_content_languages (CamelMimePart *mime_part, GList *content_languages);
-GList *camel_mime_part_get_content_languages (CamelMimePart *mime_part);
-void camel_mime_part_set_header_lines (CamelMimePart *mime_part, GList *header_lines);
-GList *camel_mime_part_get_header_lines (CamelMimePart *mime_part);
+void camel_mime_part_add_header (CamelMimePart *mime_part,
+ GString *header_name,
+ GString *header_value);
+void camel_mime_part_remove_header (CamelMimePart *mime_part,
+ GString *header_name);
+GString *camel_mime_part_get_header (CamelMimePart *mime_part,
+ GString *header_name);
+void camel_mime_part_set_description (CamelMimePart *mime_part,
+ GString *description);
+GString *camel_mime_part_get_description (CamelMimePart *mime_part);
+void camel_mime_part_set_disposition (CamelMimePart *mime_part,
+ GString *disposition);
+GString *camel_mime_part_get_disposition (CamelMimePart *mime_part);
+void camel_mime_part_set_filename (CamelMimePart *mime_part,
+ GString *filename);
+GString *camel_mime_part_get_filename (CamelMimePart *mime_part);
+GString *camel_mime_part_get_content_id (CamelMimePart *mime_part);
+GString *camel_mime_part_get_content_MD5 (CamelMimePart *mime_part);
+void camel_mime_part_set_encoding (CamelMimePart *mime_part,
+ GString *encoding);
+GString *camel_mime_part_get_encoding (CamelMimePart *mime_part);
+void camel_mime_part_set_content_languages (CamelMimePart *mime_part,
+ GList *content_languages);
+GList *camel_mime_part_get_content_languages (CamelMimePart *mime_part);
+void camel_mime_part_set_header_lines (CamelMimePart *mime_part,
+ GList *header_lines);
+GList *camel_mime_part_get_header_lines (CamelMimePart *mime_part);
#ifdef __cplusplus
}
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 2ca3d6f352..645eaf3f09 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-service.h"
static GtkObjectClass *parent_class=NULL;
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 42f681f626..5238b8d5eb 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-session.h"
#include "gstring-util.h"
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
index 2d81fa62a9..775cf5ca58 100644
--- a/camel/camel-simple-data-wrapper.c
+++ b/camel/camel-simple-data-wrapper.c
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-simple-data-wrapper.h"
static CamelDataWrapperClass *parent_class=NULL;
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 61c5216780..cedd452c44 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-store.h"
static GtkObjectClass *parent_class=NULL;
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index 09b193b229..0b70802943 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-stream-fs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -32,7 +32,7 @@
static CamelStreamClass *parent_class=NULL;
-/* Returns the class for a CamelMimeMessage */
+/* Returns the class for a CamelStreamFS */
#define CS_CLASS(so) CAMEL_STREAM_FS_CLASS (GTK_OBJECT(so)->klass)
static gint _read (CamelStream *stream, gchar *buffer, gint n);
@@ -101,13 +101,17 @@ camel_stream_fs_new_with_name (GString *name, CamelStreamFsMode mode)
CAMEL_LOG (FULL_DEBUG, "Entering CamelStream::new_with_name, name=\"%s\", mode=%d\n", name->str, mode);
v = stat (name->str, &s);
- if (mode & CAMEL_STREAM_FS_READ)
- if (mode & CAMEL_STREAM_FS_WRITE) flags = O_RDWR | O_CREAT;
- else flags = O_RDONLY;
- else
- if (mode & CAMEL_STREAM_FS_WRITE) flags = O_WRONLY | O_CREAT;
- else return NULL;
-
+ if (mode & CAMEL_STREAM_FS_READ){
+ if (mode & CAMEL_STREAM_FS_WRITE)
+ flags = O_RDWR | O_CREAT;
+ else
+ flags = O_RDONLY;
+ } else {
+ if (mode & CAMEL_STREAM_FS_WRITE)
+ flags = O_WRONLY | O_CREAT;
+ else
+ return NULL;
+ }
if ( (mode & CAMEL_STREAM_FS_READ) && !(mode & CAMEL_STREAM_FS_WRITE) )
if (v == -1) return NULL;
diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h
index 046e90d26c..3570e8a9f9 100644
--- a/camel/camel-stream-fs.h
+++ b/camel/camel-stream-fs.h
@@ -52,7 +52,6 @@ typedef struct
CamelStream parent_object;
GString *name;
int fd;
-
} CamelStreamFs;
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
index 9f9e912bd8..5554b8fe38 100644
--- a/camel/camel-stream.c
+++ b/camel/camel-stream.c
@@ -21,22 +21,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-stream.h"
-static CamelStreamClass *parent_class=NULL;
+static CamelStreamClass *parent_class = NULL;
/* Returns the class for a CamelMimeMessage */
#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
+static void
+default_camel_flush (CamelStream *stream)
+{
+ /* nothing */
+}
+static void
+default_camel_close (CamelStream *stream)
+{
+ /* nothing */
+}
static void
camel_stream_class_init (CamelStreamClass *camel_stream_class)
@@ -45,19 +49,16 @@ camel_stream_class_init (CamelStreamClass *camel_stream_class)
parent_class = gtk_type_class (gtk_object_get_type ());
/* virtual method definition */
- camel_stream_class->read = _read;
- camel_stream_class->write = _write;
- camel_stream_class->flush = _flush;
- camel_stream_class->available = _available;
- camel_stream_class->eos = _eos;
- camel_stream_class->close = _close;
+ camel_stream_class->read = NULL;
+ camel_stream_class->write = NULL;
+ camel_stream_class->flush = default_camel_flush;
+ camel_stream_class->available = NULL;
+ camel_stream_class->eos = NULL;
+ camel_stream_class->close = default_camel_close;
/* virtual method overload */
-
}
-
-
GtkType
camel_stream_get_type (void)
{
@@ -82,24 +83,17 @@ camel_stream_get_type (void)
return camel_stream_type;
}
-
-
/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
+ * camel_stream_read:
+ * @stream: a CamelStream.
+ * @buffer: buffer where bytes pulled from the stream are stored.
+ * @n: max number of bytes to read.
*
+ * Read at most @n bytes from the @stream object and stores them
+ * in the buffer pointed at by @buffer.
*
* Return value: number of bytes actually read.
**/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
-
-}
-
gint
camel_stream_read (CamelStream *stream, gchar *buffer, gint n)
{
@@ -107,98 +101,84 @@ camel_stream_read (CamelStream *stream, gchar *buffer, gint n)
}
/**
- * _write: read bytes to a stream
- * @stream: the stream
- * @buffer: byte buffer
+ * camel_stream_write:
+ * @stream: a CamelStream object.
+ * @buffer: buffer to write.
* @n: number of bytes to write
- *
- *
- *
+ *
+ * Write @n bytes from the buffer pointed at by @buffer into @stream.
+ *
* Return value: the number of bytes actually written
* in the stream.
**/
-static gint
-_write (CamelStream *stream, gchar *buffer, gint n)
-{
-
-}
-
gint
camel_stream_write (CamelStream *stream, gchar *buffer, gint n)
{
- CS_CLASS (stream)->write (stream, buffer, n);
+ return CS_CLASS (stream)->write (stream, buffer, n);
}
-
-
/**
- * _flush: flush pending changes
- * @stream: the stream
- *
+ * camel_stream_flush:
+ * @stream: a CamelStream object
*
+ * Flushes the contents of the stream to its backing store.
**/
-static void
-_flush (CamelStream *stream)
+void
+camel_stream_flush (CamelStream *stream)
{
-
+ return CS_CLASS (stream)->flush (stream);
}
-
-
/**
- * _available: return the number of bytes available for reading
- * @stream: the stream
- *
- * Return the number of bytes available without blocking.
+ * camel_stream_available:
+ * @stream: a CamelStream object
*
- * Return value: the number of bytes available
+ * Return value: the number of bytes available.
**/
static gint
-_available (CamelStream *stream)
+camel_stream_available (CamelStream *stream)
{
-
+ return CS_CLASS (stream)->available (stream);
}
-
/**
- * _eos: test if there are bytes left to read
- * @stream: the stream
- *
+ * camle_stream_eos:
+ * @stream: a CamelStream object
*
+ * Test if there are bytes left to read on the @stream object.
*
- * Return value: true if all stream has been read
+ * Return value: %TRUE if all the contents on the stream has been read, or
+ * %FALSE if information is still available.
**/
static gboolean
-_eos (CamelStream *stream)
+camel_stream_eos (CamelStream *stream)
{
-
+ return CS_CLASS (stream)->eos (stream);
}
/**
- * _close: close a stream
- * @stream: the stream
- *
+ * camel_stram_close:
+ * @stream: a CamelStream object.
*
+ * Close the @stream object.
**/
-static void
-_close (CamelStream *stream)
-{
-
-}
-
void
camel_stream_close (CamelStream *stream)
{
CS_CLASS (stream)->close (stream);
}
-
-
-
-
/***************** Utility functions ********************/
+/**
+ * came_stream_write_strings:
+ * @stream: a CamelStream object.
+ * @...: A %NULL terminated list of strings.
+ *
+ * This is a utility function that writes the list of
+ * strings into the @stream object.
+ */
void
camel_stream_write_strings (CamelStream *stream, ... )
{
@@ -209,7 +189,7 @@ camel_stream_write_strings (CamelStream *stream, ... )
string = va_arg (args, char *);
while (string) {
- camel_stream_write_string(stream, string);
+ camel_stream_write_string (stream, string);
string = va_arg (args, char *);
}
va_end (args);
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
index 5fff22a24a..8434002757 100644
--- a/camel/camel-stream.h
+++ b/camel/camel-stream.h
@@ -52,13 +52,12 @@ typedef struct {
GtkObjectClass parent_class;
/* Virtual methods */
-gint (*read) (CamelStream *stream, gchar *buffer, gint n);
-gint (*write) (CamelStream *stream, gchar *buffer, gint n);
-void (*flush) (CamelStream *stream);
-gint (*available) (CamelStream *stream);
-gboolean (*eos) (CamelStream *stream);
-void (*close) (CamelStream *stream);
-
+ gint (*read) (CamelStream *stream, gchar *buffer, gint n);
+ gint (*write) (CamelStream *stream, gchar *buffer, gint n);
+ void (*flush) (CamelStream *stream);
+ gint (*available) (CamelStream *stream);
+ gboolean (*eos) (CamelStream *stream);
+ void (*close) (CamelStream *stream);
} CamelStreamClass;
@@ -68,9 +67,12 @@ GtkType camel_stream_get_type (void);
/* public methods */
-gint camel_stream_read (CamelStream *stream, gchar *buffer, gint n);
-gint camel_stream_write (CamelStream *stream, gchar *buffer, gint n);
-void camel_stream_close (CamelStream *stream);
+gint camel_stream_read (CamelStream *stream, gchar *buffer, gint n);
+gint camel_stream_write (CamelStream *stream, gchar *buffer, gint n);
+void camel_stream_flush (CamelStream *stream);
+gint camel_stream_available (CamelStream *stream);
+gboolean camel_stream_eos (CamelStream *stream);
+void camel_stream_close (CamelStream *stream);
/* utility macros and funcs */
#define camel_stream_write_string(stream, string) camel_stream_write ((stream), (string), strlen (string))
diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c
index 06e4384437..a86c7047ad 100644
--- a/camel/gmime-content-field.c
+++ b/camel/gmime-content-field.c
@@ -21,9 +21,7 @@
* USA
*/
-
-
-
+#include <config.h>
#include "gmime-content-field.h"
#include "gstring-util.h"
#include "camel-log.h"
diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c
index 1555d27e7b..8c3db96cd4 100644
--- a/camel/gmime-utils.c
+++ b/camel/gmime-utils.c
@@ -21,8 +21,7 @@
* USA
*/
-
-
+#include <config.h>
#include "gmime-utils.h"
#include "gstring-util.h"
#include "camel-log.h"
@@ -112,14 +111,18 @@ _store_header_pair_from_gstring (GHashTable *header_table, GString *header_line)
g_assert (header_table);
if ( (header_line) && (header_line->str) ) {
- dich_result = g_string_dichotomy(header_line, ':', &header_name, &header_value, DICHOTOMY_NONE);
+ dich_result = g_string_dichotomy (
+ header_line, ':', &header_name, &header_value,
+ GSTRING_DICHOTOMY_NONE);
if (dich_result != 'o')
camel_log(WARNING,
"store_header_pair_from_gstring : dichotomy result is %c"
"header line is :\n--\n%s\n--\n");
else {
- g_string_trim (header_value, " \t", TRIM_STRIP_LEADING | TRIM_STRIP_TRAILING);
+ g_string_trim (
+ header_value, " \t",
+ GSTRING_TRIM_STRIP_LEADING | GSTRING_TRIM_STRIP_TRAILING);
g_hash_table_insert (header_table, header_name, header_value);
}
}
diff --git a/camel/gstring-util.c b/camel/gstring-util.c
index c48a98d410..89cd263e85 100644
--- a/camel/gstring-util.c
+++ b/camel/gstring-util.c
@@ -23,7 +23,7 @@
-
+#include <config.h>
#include "gstring-util.h"
#include "camel-log.h"
@@ -64,7 +64,14 @@ g_string_clone(GString *string)
/**
- * g_string_dichotomy : return the strings before and/or after
+ * g_string_dichotomy:
+ * @sep : separator
+ * @prefix: pointer to be field by the prefix object
+ * the prefix is not returned when the given pointer is NULL
+ * @suffix: pointer to be field by the suffix object
+ * the suffix is not returned when the given pointer is NULL
+ *
+ * Return the strings before and/or after
* the last occurence of the specified separator
*
* This routine returns the string before and/or after
@@ -75,17 +82,12 @@ g_string_clone(GString *string)
* suffix is set to NULL and result is set to 'n'
* When the operation succedeed, the return value is 'o'
*
- * @sep : separator
- * @prefix: pointer to be field by the prefix object
- * the prefix is not returned when the given pointer is NULL
- * @suffix: pointer to be field by the suffix object
- * the suffix is not returned when the given pointer is NULL
- *
* @Return Value : result of the operation ('o', 'l' or 'n')
*
**/
gchar
-g_string_dichotomy (GString *string, gchar sep, GString **prefix, GString **suffix, DichotomyOption options)
+g_string_dichotomy (GString *string, gchar sep, GString **prefix, GString **suffix,
+ GStringDichotomyOption options)
{
gchar *str, *tmp;
gint pos, len, first;
@@ -96,17 +98,19 @@ g_string_dichotomy (GString *string, gchar sep, GString **prefix, GString **suff
g_assert( tmp=string->str );
len = strlen(tmp);
if (!len) {
- if (prefix) *prefix=NULL;
- if (suffix) *suffix=NULL;
+ if (prefix)
+ *prefix=NULL;
+ if (suffix)
+ *suffix=NULL;
CAMEL_LOG(FULL_DEBUG,"string_dichotomy: string is empty\n");
return 'n';
}
first = 0;
- if ( (options & DICHOTOMY_STRIP_LEADING ) && (tmp[first] == sep) )
+ if ( (options & GSTRING_DICHOTOMY_STRIP_LEADING ) && (tmp[first] == sep) )
do {first++;} while ( (first<len) && (tmp[first] == sep) );
- if (options & DICHOTOMY_STRIP_TRAILING )
+ if (options & GSTRING_DICHOTOMY_STRIP_TRAILING )
while (tmp[len-1] == sep)
len--;
@@ -117,7 +121,7 @@ g_string_dichotomy (GString *string, gchar sep, GString **prefix, GString **suff
return 'n';
}
- if (options & DICHOTOMY_RIGHT_DIR) {
+ if (options & GSTRING_DICHOTOMY_RIGHT_DIR) {
pos = len;
do {
@@ -253,7 +257,7 @@ g_string_list_free (GList *string_list)
GList *
-g_string_split (GString *string, char sep, gchar *trim_chars, TrimOption trim_options)
+g_string_split (GString *string, char sep, gchar *trim_chars, GStringTrimOption trim_options)
{
GList *result = NULL;
gint first, last, pos;
@@ -296,10 +300,8 @@ g_string_split (GString *string, char sep, gchar *trim_chars, TrimOption trim_op
}
-
-
void
-g_string_trim (GString *string, gchar *chars, TrimOption options)
+g_string_trim (GString *string, gchar *chars, GStringTrimOption options)
{
gint first_ok;
gint last_ok;
@@ -308,24 +310,31 @@ g_string_trim (GString *string, gchar *chars, TrimOption options)
CAMEL_LOG(FULL_DEBUG,"**\nentering g_string_trim::\n");
- if ((!string) || (!string->str)) return;
+ if ((!string) || (!string->str))
+ return;
str = string->str;
length = strlen (str);
- if (!length) return;
+ if (!length)
+ return;
first_ok = 0;
last_ok = length - 1;
CAMEL_LOG (FULL_DEBUG,"g_string_trim:: trim_options:%d\n", options);
- if (options & TRIM_STRIP_LEADING)
+ if (options & GSTRING_TRIM_STRIP_LEADING)
while ( (first_ok <= last_ok) && (strchr (chars, str[first_ok])) )
first_ok++;
- if (options & TRIM_STRIP_TRAILING)
+ if (options & GSTRING_TRIM_STRIP_TRAILING)
while ( (first_ok <= last_ok) && (strchr (chars, str[last_ok])) )
last_ok++;
- CAMEL_LOG (FULL_DEBUG,"g_string_trim::\n\t\"%s\":first ok:%d last_ok:%d\n", string->str, first_ok, last_ok);
- if (first_ok>0) g_string_erase (string, 0, first_ok);
- if (last_ok<length-1) g_string_truncate (string, last_ok - first_ok +1);
+ CAMEL_LOG (FULL_DEBUG,"g_string_trim::\n\t\"%s\":first ok:%d last_ok:%d\n",
+ string->str, first_ok, last_ok);
+
+ if (first_ok > 0)
+ g_string_erase (string, 0, first_ok);
+
+ if (last_ok < length-1)
+ g_string_truncate (string, last_ok - first_ok +1);
}
diff --git a/camel/gstring-util.h b/camel/gstring-util.h
index 419895831c..7a82f9ab01 100644
--- a/camel/gstring-util.h
+++ b/camel/gstring-util.h
@@ -35,33 +35,37 @@ extern "C" {
#include <glib.h>
typedef enum {
- DICHOTOMY_NONE = 0,
- DICHOTOMY_RIGHT_DIR = 1,
- DICHOTOMY_STRIP_TRAILING = 2,
- DICHOTOMY_STRIP_LEADING = 4,
+ GSTRING_DICHOTOMY_NONE = 0,
+ GSTRING_DICHOTOMY_RIGHT_DIR = 1,
+ GSTRING_DICHOTOMY_STRIP_TRAILING = 2,
+ GSTRING_DICHOTOMY_STRIP_LEADING = 4,
-} DichotomyOption;
+} GStringDichotomyOption;
typedef enum {
- TRIM_NONE = 0,
- TRIM_STRIP_TRAILING = 1,
- TRIM_STRIP_LEADING = 2,
-
-} TrimOption;
+ GSTRING_TRIM_NONE = 0,
+ GSTRING_TRIM_STRIP_TRAILING = 1,
+ GSTRING_TRIM_STRIP_LEADING = 2,
+} GStringTrimOption;
-gboolean g_string_equals(GString *string1, GString *string2);
-GString *g_string_clone(GString *string);
-gchar g_string_dichotomy( GString *string, gchar sep, GString **prefix, GString **suffix, DichotomyOption options);
-void g_string_append_g_string(GString *dest_string, GString *other_string);
+gboolean g_string_equals (GString *string1, GString *string2);
+GString *g_string_clone (GString *string);
+gchar g_string_dichotomy (GString *string, gchar sep,
+ GString **prefix, GString **suffix,
+ GStringDichotomyOption options);
+void g_string_append_g_string (GString *dest_string,
+ GString *other_string);
-gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2);
+gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2);
gboolean g_string_equal_for_glist (gconstpointer v, gconstpointer v2);
-guint g_string_hash (gconstpointer v);
-void g_string_list_free (GList *string_list);
+guint g_string_hash (gconstpointer v);
+void g_string_list_free (GList *string_list);
-GList *g_string_split (GString *string, char sep, gchar *trim_chars, TrimOption trim_options);
-void g_string_trim (GString *string, gchar *chars, TrimOption options);
+GList *g_string_split (GString *string, char sep,
+ gchar *trim_chars, GStringTrimOption trim_options);
+void g_string_trim (GString *string, gchar *chars,
+ GStringTrimOption options);
#ifdef __cplusplus
}
diff --git a/camel/url-util.c b/camel/url-util.c
index 1b784385f5..b9ee4c653b 100644
--- a/camel/url-util.c
+++ b/camel/url-util.c
@@ -34,7 +34,7 @@
/*
XXX TODO: recover the words between #'s or ?'s after the path */
-
+#include <config.h>
#include "url-util.h"
/* general item finder */