+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-11-11 Matthew Barnes <mbarnes@redhat.com>
* camel-tcp-stream-ssl.c (enable_ssl):
const unsigned char *start, *end;
unsigned int mask;
- start = date;
+ start = (const unsigned char *)date;
while (*start) {
/* kill leading whitespace */
while (*start && isspace ((int) *start))
return -1;
for (wday = 0; wday < 7; wday++)
- if (!g_ascii_strncasecmp (in, tm_days[wday], 3))
+ if (!g_ascii_strncasecmp ((const char *)in, tm_days[wday], 3))
return wday;
return -1; /* unknown week day */
return -1;
for (i = 0; i < 12; i++)
- if (!g_ascii_strncasecmp (in, tm_months[i], 3))
+ if (!g_ascii_strncasecmp ((const char*)in, tm_months[i], 3))
return i;
return -1; /* unknown month */
if (len != inlen)
continue;
- if (!strncmp (inptr, tz_offsets[t].name, len))
+ if (!strncmp ((const char*)inptr, tz_offsets[t].name, len))
return tz_offsets[t].offset;
}
}
CAMEL_ARG_DBL = 0x20000000, /* double */
CAMEL_ARG_STR = 0x30000000, /* c string */
CAMEL_ARG_PTR = 0x40000000, /* ptr */
- CAMEL_ARG_BOO = 0x50000000, /* bool */
+ CAMEL_ARG_BOO = 0x50000000 /* bool */
};
typedef struct _CamelArg CamelArg;
bl = g_malloc0(sizeof(*bl));
bl->id = id;
if (lseek(bs->fd, id, SEEK_SET) == -1 ||
- camel_read (bs->fd, bl->data, CAMEL_BLOCK_SIZE) == -1) {
+ camel_read (bs->fd, (char *) bl->data, CAMEL_BLOCK_SIZE) == -1) {
block_file_unuse(bs);
CAMEL_BLOCK_FILE_UNLOCK(bs, cache_lock);
g_free(bl);
typedef struct _CamelCertDBClass CamelCertDBClass;
enum {
- CAMEL_CERTDB_DIRTY = (1 << 0),
+ CAMEL_CERTDB_DIRTY = (1 << 0)
};
enum {
CAMEL_CERT_STRING_ISSUER,
CAMEL_CERT_STRING_SUBJECT,
CAMEL_CERT_STRING_HOSTNAME,
- CAMEL_CERT_STRING_FINGERPRINT,
+ CAMEL_CERT_STRING_FINGERPRINT
};
typedef enum {
CAMEL_CERT_TRUST_NEVER,
CAMEL_CERT_TRUST_MARGINAL,
CAMEL_CERT_TRUST_FULLY,
- CAMEL_CERT_TRUST_ULTIMATE,
+ CAMEL_CERT_TRUST_ULTIMATE
} CamelCertTrust;
typedef struct {
CAMEL_CIPHER_VALIDITY_SIGN_GOOD,
CAMEL_CIPHER_VALIDITY_SIGN_BAD,
CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN,
- CAMEL_CIPHER_VALIDITY_SIGN_NEED_PUBLIC_KEY,
+ CAMEL_CIPHER_VALIDITY_SIGN_NEED_PUBLIC_KEY
} camel_cipher_validity_sign_t;
typedef enum _camel_cipher_validity_encrypt_t {
CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE,
CAMEL_CIPHER_VALIDITY_ENCRYPT_WEAK,
CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, /* encrypted, unknown strenght */
- CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG,
+ CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG
} camel_cipher_validity_encrypt_t;
typedef enum _camel_cipher_validity_mode_t {
CAMEL_CIPHER_VALIDITY_SIGN,
- CAMEL_CIPHER_VALIDITY_ENCRYPT,
+ CAMEL_CIPHER_VALIDITY_ENCRYPT
} camel_cipher_validity_mode_t;
struct _CamelCipherCertInfo {
CAMEL_DISCO_DIARY_FOLDER_EXPUNGE,
CAMEL_DISCO_DIARY_FOLDER_APPEND,
- CAMEL_DISCO_DIARY_FOLDER_TRANSFER,
+ CAMEL_DISCO_DIARY_FOLDER_TRANSFER
} CamelDiscoDiaryAction;
typedef enum {
enum {
CAMEL_DISCO_FOLDER_ARG_OFFLINE_SYNC = CAMEL_FOLDER_ARG_LAST,
-
CAMEL_DISCO_FOLDER_ARG_LAST = CAMEL_FOLDER_ARG_LAST + 0x100
};
enum {
- CAMEL_DISCO_FOLDER_OFFLINE_SYNC = CAMEL_DISCO_FOLDER_ARG_OFFLINE_SYNC | CAMEL_ARG_BOO,
+ CAMEL_DISCO_FOLDER_OFFLINE_SYNC = CAMEL_DISCO_FOLDER_ARG_OFFLINE_SYNC | CAMEL_ARG_BOO
};
struct _CamelDiscoFolder {
G_BEGIN_DECLS
enum {
- CAMEL_DISCO_STORE_ARG_FIRST = CAMEL_STORE_ARG_FIRST + 100,
+ CAMEL_DISCO_STORE_ARG_FIRST = CAMEL_STORE_ARG_FIRST + 100
};
typedef enum {
/* dont turn this off */
#define w(x) x
-/* i dont know why gthread_mutex stuff even exists, this is easier */
-
-/* also, i'm not convinced mutexes are needed here. But it
- doesn't really hurt either */
-static pthread_mutex_t exception_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-#define CAMEL_EXCEPTION_LOCK(e) (pthread_mutex_lock(&exception_mutex))
-#define CAMEL_EXCEPTION_UNLOCK(e) (pthread_mutex_unlock(&exception_mutex))
-
-static EMemChunk *exception_chunks = NULL;
/**
* camel_exception_new: allocate a new exception object.
{
CamelException *ex;
- CAMEL_EXCEPTION_LOCK(exception);
-
- if (exception_chunks == NULL)
- exception_chunks = e_memchunk_new(16, sizeof(CamelException));
-
- ex = e_memchunk_alloc(exception_chunks);
+ ex = g_slice_new (CamelException);
ex->desc = NULL;
/* set the Exception Id to NULL */
ex->id = CAMEL_EXCEPTION_NONE;
- CAMEL_EXCEPTION_UNLOCK(exception);
-
return ex;
}
if (!exception)
return;
- CAMEL_EXCEPTION_LOCK(exception);
-
if (exception->desc)
g_free (exception->desc);
exception->desc = NULL;
exception->id = CAMEL_EXCEPTION_NONE;
-
- CAMEL_EXCEPTION_UNLOCK(exception);
}
/**
if (exception->desc)
g_free (exception->desc);
- CAMEL_EXCEPTION_LOCK(exception);
-
- e_memchunk_free(exception_chunks, exception);
-
- CAMEL_EXCEPTION_UNLOCK(exception);
+ g_slice_free (CamelException, exception);
}
/**
camel_exception_set (CamelException *ex, ExceptionId id, const char *desc)
{
if (camel_debug("exception"))
- printf("CamelException.set(%p, %u, '%s')\n", ex, id, desc);
-
+ printf("CamelException.set(%p, %u, '%s')\n", (void *) ex, id, desc);
if (!ex)
return;
-
- CAMEL_EXCEPTION_LOCK(exception);
-
ex->id = id;
-
if (desc != ex->desc) {
g_free (ex->desc);
ex->desc = g_strdup (desc);
}
-
- CAMEL_EXCEPTION_UNLOCK(exception);
}
/**
va_end (args);
if (camel_debug("exception"))
- printf("CamelException.setv(%p, %u, '%s')\n", ex, id, desc);
+ printf("CamelException.setv(%p, %u, '%s')\n", (void *) ex, id, desc);
if (!ex) {
g_free(desc);
return;
}
- CAMEL_EXCEPTION_LOCK(exception);
-
g_free(ex->desc);
ex->desc = desc;
ex->id = id;
-
- CAMEL_EXCEPTION_UNLOCK(exception);
}
/**
return;
}
- CAMEL_EXCEPTION_LOCK(exception);
-
if (ex_dst->desc)
g_free (ex_dst->desc);
ex_src->desc = NULL;
ex_src->id = CAMEL_EXCEPTION_NONE;
-
- CAMEL_EXCEPTION_UNLOCK(exception);
}
/**
info = camel_message_info_new_from_header(NULL, ((CamelMimePart *)msg)->headers);
((CamelMessageInfoBase *)info)->size = camel_mime_parser_tell(mp) - last;
+
last = camel_mime_parser_tell(mp);
status = camel_filter_driver_filter_message (driver, msg, info, NULL, NULL, source_url,
original_source_url ? original_source_url : source_url, ex);
CAMEL_FILTER_STATUS_START, /* start of new message processed */
CAMEL_FILTER_STATUS_ACTION, /* an action performed */
CAMEL_FILTER_STATUS_PROGRESS, /* (an) extra update(s), if its taking longer to process */
- CAMEL_FILTER_STATUS_END, /* end of message */
+ CAMEL_FILTER_STATUS_END /* end of message */
};
typedef CamelFolder * (*CamelFilterGetFolderFunc) (CamelFilterDriver *driver, const char *uri,
}
}
} else {
- CamelMimeMessage *message = camel_filter_search_get_message (fms, f);
+ CamelMimeMessage *message;
struct _camel_header_raw *header;
const char *charset = NULL;
camel_search_t type = CAMEL_SEARCH_TYPE_ENCODED;
CamelContentType *ct;
+ message = camel_filter_search_get_message (fms, f);
+
/* FIXME: what about Resent-To, Resent-Cc and Resent-From? */
if (g_ascii_strcasecmp("to", name) == 0 || g_ascii_strcasecmp("cc", name) == 0 || g_ascii_strcasecmp("from", name) == 0)
type = CAMEL_SEARCH_TYPE_ADDRESS_ENCODED;
enum {
CAMEL_SEARCH_ERROR = -1,
CAMEL_SEARCH_NOMATCH = 0,
- CAMEL_SEARCH_MATCHED = 1,
+ CAMEL_SEARCH_MATCHED = 1
};
typedef CamelMimeMessage * (*CamelFilterSearchGetMessageFunc) (void *data, CamelException *ex);
GPtrArray *uids = key;
EMemPool *pool = value;
- g_warning("Search closed with outstanding result unfreed: %p", uids);
+ g_warning("Search closed with outstanding result unfreed: %p", (void *) uids);
g_ptr_array_free(uids, TRUE);
e_mempool_destroy(pool);
truth = TRUE;
} else if (how == CAMEL_SEARCH_MATCH_CONTAINS) {
/* doesn't make sense to split words on anything but contains i.e. we can't have an ending match different words */
- words = camel_search_words_split(argv[i]->value.string);
+ words = camel_search_words_split((const unsigned char *) argv[i]->value.string);
truth = TRUE;
for (j=0;j<words->len && truth;j++) {
truth = camel_search_header_match(header, words->words[j]->word, how, type, NULL);
camel_stream_write (CAMEL_STREAM (mem), "", 1);
for (i=0;i<words->len;i++) {
/* FIXME: This is horridly slow, and should use a real search algorithm */
- if (camel_ustrstrcase(mem->buffer->data, words->words[i]->word) != NULL) {
+ if (camel_ustrstrcase((const char *) mem->buffer->data, words->words[i]->word) != NULL) {
*mask |= (1<<i);
/* shortcut a match */
if (*mask == (1<<(words->len))-1)
} else {
for (i=0;i<argc && !truth;i++) {
if (argv[i]->type == ESEXP_RES_STRING) {
- words = camel_search_words_split(argv[i]->value.string);
+ words = camel_search_words_split((const unsigned char *) argv[i]->value.string);
truth = TRUE;
if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
for (j=0;j<words->len && truth;j++)
for (i=0;i<argc;i++) {
if (argv[i]->type == ESEXP_RES_STRING) {
- words = camel_search_words_split(argv[i]->value.string);
+ words = camel_search_words_split((const unsigned char *) argv[i]->value.string);
if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
matches = match_words_index(search, words, ex);
} else {
return NULL;
if (camel_file_util_decode_uint32(in, &count) == -1 || count > 500) {
- camel_folder_summary_content_info_free(s, ci);
+ camel_folder_summary_content_info_free (s, ci);
return NULL;
}
part->parent = ci;
} else {
d(fprintf (stderr, "Summary file format messed up?"));
- camel_folder_summary_content_info_free(s, ci);
+ camel_folder_summary_content_info_free (s, ci);
return NULL;
}
}
/* now write out each message ... */
/* we check ferorr when done for i/o errors */
+
count = s->messages->len;
for (i = 0; i < count; i++) {
mi = s->messages->pdata[i];
#ifdef G_OS_WIN32
g_unlink(s->summary_path);
#endif
+
if (g_rename(path, s->summary_path) == -1) {
i = errno;
g_unlink(path);
s->flags &= ~CAMEL_SUMMARY_DIRTY;
return 0;
- exception:
+exception:
i = errno;
-
fclose (out);
fclose (out_meta);
const char *uid;
CamelMessageInfo *mi;
- uid = camel_message_info_uid(info);
+ uid = camel_message_info_uid (info);
+
if (uid == NULL || uid[0] == 0) {
- g_free(info->uid);
+ g_free (info->uid);
uid = info->uid = camel_folder_summary_next_uid_string(s);
}
while ((mi = g_hash_table_lookup(s->messages_uid, uid))) {
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
+
if (mi == info)
return 0;
+
d(printf ("Trying to insert message with clashing uid (%s). new uid re-assigned", camel_message_info_uid(info)));
+
g_free(info->uid);
uid = info->uid = camel_folder_summary_next_uid_string(s);
+
camel_message_info_set_flags(info, CAMEL_MESSAGE_FOLDER_FLAGGED, CAMEL_MESSAGE_FOLDER_FLAGGED);
+
CAMEL_SUMMARY_LOCK(s, summary_lock);
}
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
camel_folder_summary_remove(s, oldinfo);
camel_message_info_free(oldinfo);
- } else {
+ } else {
CAMEL_SUMMARY_UNLOCK(s, ref_lock);
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
}
if (camel_file_util_decode_uint32(in, &count) == -1 || count > 500)
goto error;
- for (i=0;i<count;i++) {
+ for (i = 0; i < count; i++) {
char *name, *value;
camel_folder_summary_decode_token(in, &name);
camel_folder_summary_decode_token(in, &value);
camel_folder_summary_encode_token(out, ci->id);
camel_folder_summary_encode_token(out, ci->description);
camel_folder_summary_encode_token(out, ci->encoding);
+
return camel_file_util_encode_uint32(out, ci->size);
}
/* using the object types is more accurate than using the mime/types */
if (CAMEL_IS_MULTIPART(containee)) {
parts = camel_multipart_get_number(CAMEL_MULTIPART(containee));
+
for (i=0;i<parts;i++) {
CamelMimePart *part = camel_multipart_get_part(CAMEL_MULTIPART(containee), i);
g_assert(part);
*/
typedef enum _CamelFolderSummaryFlags {
- CAMEL_SUMMARY_DIRTY = 1<<0,
+ CAMEL_SUMMARY_DIRTY = 1<<0
} CamelFolderSummaryFlags;
struct _CamelFolderSummary {
c = c->next;
}
- printf("ERROR: removing node %p failed\n", node);
+ printf("ERROR: removing node %p failed\n", (void *) node);
}
static void
while (c) {
if (g_hash_table_lookup(info->visited, c)) {
- printf("WARNING: NODE REVISITED: %p\n", c);
+ printf("WARNING: NODE REVISITED: %p\n", (void *) c);
} else {
g_hash_table_insert(info->visited, c, c);
}
if (c->message) {
- printf("%s %p Subject: %s <%08x%08x>\n", p, c, camel_message_info_subject(c->message),
+ printf("%s %p Subject: %s <%08x%08x>\n", p, (void *) c, camel_message_info_subject(c->message),
camel_message_info_message_id(c->message)->id.part.hi, camel_message_info_message_id(c->message)->id.part.lo);
count += 1;
} else {
- printf("%s %p <empty>\n", p, c);
+ printf("%s %p <empty>\n", p, (void *) c);
}
if (c->child)
count += dump_tree_rec(info, c->child, depth+1);
const CamelMessageInfo *info, char **appended_uid,
CamelException *ex);
-
static GPtrArray *get_uids (CamelFolder *folder);
static void free_uids (CamelFolder *folder,
GPtrArray *array);
guint32 tag;
int unread = -1, deleted = 0, junked = 0, visible = 0, count = -1;
- for (i=0;i<args->argc;i++) {
+ for (i = 0; i < args->argc; i++) {
CamelArgGet *arg = &args->argv[i];
tag = arg->tag;
/* TODO: Locking? */
unread = 0;
- count = camel_folder_summary_count(folder->summary);
- for (j=0; j<count; j++) {
- if ((info = camel_folder_summary_index(folder->summary, j))) {
+ count = camel_folder_summary_count (folder->summary);
+ for (j = 0; j < count; j++) {
+ if ((info = camel_folder_summary_index (folder->summary, j))) {
guint32 flags = camel_message_info_flags(info);
if ((flags & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_JUNK)) == 0)
static CamelSessionThreadOps filter_ops = {
filter_filter,
- filter_free,
+ filter_free
};
struct _CamelFolderChangeInfoPrivate {
{
CamelFolderChangeInfo *info;
- info = g_malloc(sizeof(*info));
+ info = g_slice_new (CamelFolderChangeInfo);
info->uid_added = g_ptr_array_new();
info->uid_removed = g_ptr_array_new();
info->uid_changed = g_ptr_array_new();
info->uid_recent = g_ptr_array_new();
- info->priv = g_malloc0(sizeof(*info->priv));
+ info->priv = g_slice_new (struct _CamelFolderChangeInfoPrivate);
info->priv->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
info->priv->uid_source = NULL;
info->priv->uid_filter = g_ptr_array_new();
g_hash_table_destroy(p->uid_stored);
g_ptr_array_free(p->uid_filter, TRUE);
e_mempool_destroy(p->uid_pool);
- g_free(p);
+ g_slice_free (struct _CamelFolderChangeInfoPrivate, p);
g_ptr_array_free(info->uid_added, TRUE);
g_ptr_array_free(info->uid_removed, TRUE);
g_ptr_array_free(info->uid_changed, TRUE);
g_ptr_array_free(info->uid_recent, TRUE);
- g_free(info);
+ g_slice_free (CamelFolderChangeInfo, info);
}
CAMEL_FOLDER_ARG_UID_ARRAY,
CAMEL_FOLDER_ARG_INFO_ARRAY,
CAMEL_FOLDER_ARG_PROPERTIES,
- CAMEL_FOLDER_ARG_LAST = CAMEL_ARG_FIRST + 0x2000,
+ CAMEL_FOLDER_ARG_LAST = CAMEL_ARG_FIRST + 0x2000
};
enum {
CAMEL_FOLDER_INFO_ARRAY = CAMEL_FOLDER_ARG_INFO_ARRAY | CAMEL_ARG_PTR,
/* GSList of settable folder properties */
- CAMEL_FOLDER_PROPERTIES = CAMEL_FOLDER_ARG_PROPERTIES | CAMEL_ARG_PTR,
+ CAMEL_FOLDER_PROPERTIES = CAMEL_FOLDER_ARG_PROPERTIES | CAMEL_ARG_PTR
};
struct _CamelFolderChangeInfo {
#define CAMEL_FOLDER_HAS_BEEN_DELETED (1<<3)
#define CAMEL_FOLDER_IS_TRASH (1<<4)
#define CAMEL_FOLDER_IS_JUNK (1<<5)
-#define CAMEL_FOLDER_FILTER_JUNK (1<<6)
+#define CAMEL_FOLDER_FILTER_JUNK (1<<6)
typedef struct {
CamelObjectClass parent_class;
GPG_CTX_MODE_ENCRYPT,
GPG_CTX_MODE_DECRYPT,
GPG_CTX_MODE_IMPORT,
- GPG_CTX_MODE_EXPORT,
+ GPG_CTX_MODE_EXPORT
};
enum _GpgTrustMetric {
if (camel_debug("gpg:status"))
printf ("status: %s\n", status);
- if (strncmp (status, "[GNUPG:] ", 9) != 0) {
+ if (strncmp ((const char *) status, "[GNUPG:] ", 9) != 0) {
char *message;
- message = g_locale_to_utf8(status, -1, NULL, NULL, NULL);
+ message = g_locale_to_utf8((const gchar *) status, -1, NULL, NULL, NULL);
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Unexpected GnuPG status message encountered:\n\n%s"),
message);
_("Failed to unlock secret key: 3 bad passphrases given."));
return -1;
}
- } else if (!strncmp (status, "UNEXPECTED ", 11)) {
+ } else if (!strncmp ((const char *) status, "UNEXPECTED ", 11)) {
/* this is an error */
char *message;
- message = g_locale_to_utf8(status+11, -1, NULL, NULL, NULL);
+ message = g_locale_to_utf8((const gchar *) status+11, -1, NULL, NULL, NULL);
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Unexpected response from GnuPG: %s"),
message);
g_free(message);
return -1;
- } else if (!strncmp (status, "NODATA", 6)) {
+ } else if (!strncmp ((char *) status, "NODATA", 6)) {
/* this is an error */
/* But we ignore it anyway, we should get other response codes to say why */
gpg->nodata = TRUE;
CAMEL_HTML_PARSER_VAL, /* value */
CAMEL_HTML_PARSER_VAL_ENT, /* entity in value */
CAMEL_HTML_PARSER_EOD, /* end of current data */
- CAMEL_HTML_PARSER_EOF, /* end of file */
+ CAMEL_HTML_PARSER_EOF /* end of file */
} camel_html_parser_t;
struct _CamelHTMLParser {
/* parse the HTTP status code */
if (!g_ascii_strncasecmp (buffer, "HTTP/", 5)) {
- token = http_next_token (buffer);
+ token = http_next_token ((const unsigned char *) buffer);
http->statuscode = camel_header_decode_int (&token);
return http->statuscode;
}
basic = g_strdup_printf("%s:%s", http_stream->proxy->user?http_stream->proxy->user:"",
http_stream->proxy->passwd?http_stream->proxy->passwd:"");
- basic64 = g_base64_encode(basic, strlen(basic));
+ basic64 = g_base64_encode((const guchar *) basic, strlen(basic));
memset(basic, 0, strlen(basic));
g_free(basic);
camel_http_stream_set_proxy_authpass(http_stream, basic64);
typedef enum {
/*CAMEL_HTTP_METHOD_OPTIONS,*/
CAMEL_HTTP_METHOD_GET,
- CAMEL_HTTP_METHOD_HEAD,
+ CAMEL_HTTP_METHOD_HEAD
/*CAMEL_HTTP_METHOD_POST,*/
/*CAMEL_HTTP_METHOD_PUT,*/
/*CAMEL_HTTP_METHOD_DELETE,*/
CAMEL_LOCK_HELPER_STATUS_PROTOCOL,
CAMEL_LOCK_HELPER_STATUS_NOMEM,
CAMEL_LOCK_HELPER_STATUS_SYSTEM,
- CAMEL_LOCK_HELPER_STATUS_INVALID, /* not allowed to lock/doesn't exist etc */
+ CAMEL_LOCK_HELPER_STATUS_INVALID /* not allowed to lock/doesn't exist etc */
};
/* commands */
enum {
CAMEL_LOCK_HELPER_LOCK = 0xf0f,
- CAMEL_LOCK_HELPER_UNLOCK = 0xf0f0,
+ CAMEL_LOCK_HELPER_UNLOCK = 0xf0f0
};
/* seconds between lock refreshes */
typedef enum {
CAMEL_LOCK_READ,
- CAMEL_LOCK_WRITE,
+ CAMEL_LOCK_WRITE
} CamelLockType;
/* specific locking strategies */
/* wont go to more than 2x size (overly conservative) */
camel_mime_filter_set_size(mf, len*2+6, FALSE);
if (len > 0)
- newlen += g_base64_encode_step(in, len, TRUE, mf->outbuf, &f->state, &f->save);
+ newlen += g_base64_encode_step((const guchar *) in, len, TRUE, mf->outbuf, &f->state, &f->save);
newlen += g_base64_encode_close(TRUE, mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len*2+6);
break;
case CAMEL_MIME_FILTER_BASIC_QP_ENC:
/* *4 is definetly more than needed ... */
camel_mime_filter_set_size(mf, len*4+4, FALSE);
- newlen = camel_quoted_encode_close(in, len, mf->outbuf, &f->state, &f->save);
+ newlen = camel_quoted_encode_close((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len*4+4);
break;
case CAMEL_MIME_FILTER_BASIC_UU_ENC:
/* won't go to more than 2 * (x + 2) + 62 */
camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
- newlen = camel_uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, &f->save);
+ newlen = camel_uuencode_close ((unsigned char *) in, len, (unsigned char *) mf->outbuf, f->uubuf, &f->state, (guint32 *) &f->save);
g_assert (newlen <= (len + 2) * 2 + 62);
break;
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
/* output can't possibly exceed the input size */
camel_mime_filter_set_size(mf, len, FALSE);
- newlen = g_base64_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+ newlen = g_base64_decode_step(in, len, (guchar *) mf->outbuf, &f->state, (guint *) &f->save);
g_assert(newlen <= len);
break;
case CAMEL_MIME_FILTER_BASIC_QP_DEC:
/* output can't possibly exceed the input size, well unless its not really qp, then +2 max */
camel_mime_filter_set_size(mf, len+2, FALSE);
- newlen = camel_quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+ newlen = camel_quoted_decode_step((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (gint *) &f->save);
g_assert(newlen <= len+2);
break;
case CAMEL_MIME_FILTER_BASIC_UU_DEC:
if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) {
/* "begin <mode> <filename>\n" has been found, so we can now start decoding */
camel_mime_filter_set_size (mf, len + 3, FALSE);
- newlen = camel_uudecode_step (in, len, mf->outbuf, &f->state, &f->save);
+ newlen = camel_uudecode_step ((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (guint32 *) &f->save);
} else {
newlen = 0;
}
case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
/* wont go to more than 2x size (overly conservative) */
camel_mime_filter_set_size(mf, len*2+6, FALSE);
- newlen = g_base64_encode_step(in, len, TRUE, mf->outbuf, &f->state, &f->save);
+ newlen = g_base64_encode_step((const guchar *) in, len, TRUE, mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len*2+6);
break;
case CAMEL_MIME_FILTER_BASIC_QP_ENC:
/* *4 is overly conservative, but will do */
camel_mime_filter_set_size(mf, len*4+4, FALSE);
- newlen = camel_quoted_encode_step(in, len, mf->outbuf, &f->state, &f->save);
+ newlen = camel_quoted_encode_step((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (gint *) &f->save);
g_assert(newlen <= len*4+4);
break;
case CAMEL_MIME_FILTER_BASIC_UU_ENC:
/* won't go to more than 2 * (x + 2) + 62 */
camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
- newlen = camel_uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save);
+ newlen = camel_uuencode_step ((unsigned char *) in, len, (unsigned char *) mf->outbuf, f->uubuf, &f->state, (guint32 *) &f->save);
g_assert (newlen <= (len + 2) * 2 + 62);
break;
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
/* output can't possibly exceed the input size */
camel_mime_filter_set_size(mf, len+3, FALSE);
- newlen = g_base64_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+ newlen = g_base64_decode_step(in, len, (guchar *) mf->outbuf, &f->state, (guint *) &f->save);
g_assert(newlen <= len+3);
break;
case CAMEL_MIME_FILTER_BASIC_QP_DEC:
/* output can't possibly exceed the input size */
camel_mime_filter_set_size(mf, len + 2, FALSE);
- newlen = camel_quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+ newlen = camel_quoted_decode_step((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (gint *) &f->save);
g_assert(newlen <= len + 2);
break;
case CAMEL_MIME_FILTER_BASIC_UU_DEC:
if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) {
/* "begin <mode> <filename>\n" has been found, so we can now start decoding */
camel_mime_filter_set_size (mf, len + 3, FALSE);
- newlen = camel_uudecode_step (in, len, mf->outbuf, &f->state, &f->save);
+ newlen = camel_uudecode_step ((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (guint32 *) &f->save);
} else {
newlen = 0;
}
CAMEL_MIME_FILTER_BASIC_QP_ENC,
CAMEL_MIME_FILTER_BASIC_QP_DEC,
CAMEL_MIME_FILTER_BASIC_UU_ENC,
- CAMEL_MIME_FILTER_BASIC_UU_DEC,
+ CAMEL_MIME_FILTER_BASIC_UU_DEC
} CamelMimeFilterBasicType;
struct _CamelMimeFilterBasic {
/* do we treat 'lf' as if it were crlf? */
CAMEL_BESTENC_LF_IS_CRLF = 1<<8,
/* do we not allow "From " to appear at the start of a line in any part? */
- CAMEL_BESTENC_NO_FROM = 1<<9,
+ CAMEL_BESTENC_NO_FROM = 1<<9
} CamelBestencRequired;
typedef enum _CamelBestencEncoding {
CAMEL_BESTENC_BINARY,
/* is the content stream to be treated as text? */
- CAMEL_BESTENC_TEXT = 1<<8,
+ CAMEL_BESTENC_TEXT = 1<<8
} CamelBestencEncoding;
struct _CamelMimeFilterBestenc {
flags = ((CamelMimeFilterCanon *)f)->flags;
/* first, work out how much space we need */
- inptr = in;
- inend = in+len;
+ inptr = (unsigned char *)in;
+ inend = (const unsigned char *) (in+len);
while (inptr < inend)
if (*inptr++ == '\n')
lf++;
camel_mime_filter_set_size(f, len+lf*3+4, FALSE);
o = f->outbuf;
- inptr = in;
+ inptr = (unsigned char *)in;
start = inptr;
starto = o;
while (inptr < inend) {
if (flags & CAMEL_MIME_FILTER_CANON_FROM && c == 'F') {
inptr++;
if (inptr < inend-4) {
- if (strncmp(inptr, "rom ", 4) == 0) {
+ if (strncmp((char*)inptr, "rom ", 4) == 0) {
strcpy(o, "=46rom ");
inptr+=4;
o+= 7;
if (last) {
*outlen = o - f->outbuf;
} else {
- camel_mime_filter_backup(f, start, inend - start);
+ camel_mime_filter_backup(f, (const char*)start, inend - start);
*outlen = starto - f->outbuf;
}
enum {
CAMEL_MIME_FILTER_CANON_CRLF = (1<<0), /* canoncialise end of line to crlf, otherwise canonicalise to lf only */
CAMEL_MIME_FILTER_CANON_FROM = (1<<1), /* escape "^From " using quoted-printable semantics into "=46rom " */
- CAMEL_MIME_FILTER_CANON_STRIP = (1<<2), /* strip trailing space */
+ CAMEL_MIME_FILTER_CANON_STRIP = (1<<2) /* strip trailing space */
};
struct _CamelMimeFilterCanon {
typedef enum {
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS,
- CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY,
+ CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY
} CamelMimeFilterCRLFMode;
struct _CamelMimeFilterCRLF {
GZIP_FLAG_FCOMMENT = (1 << 4),
GZIP_FLAG_RESERVED0 = (1 << 5),
GZIP_FLAG_RESERVED1 = (1 << 6),
- GZIP_FLAG_RESERVED2 = (1 << 7),
+ GZIP_FLAG_RESERVED2 = (1 << 7)
};
#define GZIP_FLAG_RESERVED (GZIP_FLAG_RESERVED0 | GZIP_FLAG_RESERVED1 | GZIP_FLAG_RESERVED2)
memcpy (filter->outbuf, priv->hdr.buf, 10);
- priv->stream->next_out = filter->outbuf + 10;
+ priv->stream->next_out = (Bytef *) filter->outbuf + 10;
priv->stream->avail_out = filter->outsize - 10;
priv->state.zip.wrote_hdr = TRUE;
} else {
camel_mime_filter_set_size (filter, (len * 2) + 12, FALSE);
- priv->stream->next_out = filter->outbuf;
+ priv->stream->next_out = (Bytef *) filter->outbuf;
priv->stream->avail_out = filter->outsize;
}
- priv->stream->next_in = in;
+ priv->stream->next_in = (Bytef *) in;
priv->stream->avail_in = len;
do {
n = filter->outsize - priv->stream->avail_out;
camel_mime_filter_set_size (filter, n + (priv->stream->avail_in * 2) + 12, TRUE);
priv->stream->avail_out = filter->outsize - n;
- priv->stream->next_out = filter->outbuf + n;
+ priv->stream->next_out = (Bytef *) filter->outbuf + n;
if (priv->stream->avail_in == 0) {
guint32 val;
}
} else {
if (priv->stream->avail_in > 0)
- camel_mime_filter_backup (filter, priv->stream->next_in, priv->stream->avail_in);
+ camel_mime_filter_backup (filter, (const char *) priv->stream->next_in, priv->stream->avail_in);
break;
}
} while (1);
- priv->crc32 = crc32 (priv->crc32, in, len - priv->stream->avail_in);
+ priv->crc32 = crc32 (priv->crc32, (unsigned char *) in, len - priv->stream->avail_in);
priv->isize += len - priv->stream->avail_in;
*out = filter->outbuf;
camel_mime_filter_set_size (filter, (len * 2) + 12, FALSE);
- priv->stream->next_in = in;
+ priv->stream->next_in = (Bytef *) in;
priv->stream->avail_in = len - 8;
- priv->stream->next_out = filter->outbuf;
+ priv->stream->next_out = (Bytef *) filter->outbuf;
priv->stream->avail_out = filter->outsize;
do {
n = filter->outsize - priv->stream->avail_out;
camel_mime_filter_set_size (filter, n + (priv->stream->avail_in * 2) + 12, TRUE);
priv->stream->avail_out = filter->outsize - n;
- priv->stream->next_out = filter->outbuf + n;
+ priv->stream->next_out = (Bytef *) filter->outbuf + n;
} else {
priv->stream->avail_in += 8;
if (priv->stream->avail_in > 0)
- camel_mime_filter_backup (filter, priv->stream->next_in, priv->stream->avail_in);
+ camel_mime_filter_backup (filter, (char *) priv->stream->next_in, priv->stream->avail_in);
break;
}
PGP_PREFACE,
PGP_HEADER,
PGP_MESSAGE,
- PGP_FOOTER,
+ PGP_FOOTER
};
static void
case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
/* won't go to more than 2 * (x + 2) + 62 */
camel_mime_filter_set_size (filter, (len + 2) * 2 + 62, FALSE);
- newlen = camel_yencode_step (in, len, filter->outbuf, ¥c->state,
+ newlen = camel_yencode_step ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, ¥c->state,
¥c->pcrc, ¥c->crc);
g_assert (newlen <= (len + 2) * 2 + 62);
break;
if ((yenc->state & CAMEL_MIME_YDECODE_STATE_DECODE) && !(yenc->state & CAMEL_MIME_YDECODE_STATE_END)) {
/* all yEnc headers have been found so we can now start decoding */
camel_mime_filter_set_size (filter, len + 3, FALSE);
- newlen = camel_ydecode_step (in, len, filter->outbuf, ¥c->state, ¥c->pcrc, ¥c->crc);
+ newlen = camel_ydecode_step ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, ¥c->state, ¥c->pcrc, ¥c->crc);
g_assert (newlen <= len + 3);
} else {
newlen = 0;
case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
/* won't go to more than 2 * (x + 2) + 62 */
camel_mime_filter_set_size (filter, (len + 2) * 2 + 62, FALSE);
- newlen = camel_yencode_close (in, len, filter->outbuf, ¥c->state,
+ newlen = camel_yencode_close ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, ¥c->state,
¥c->pcrc, ¥c->crc);
g_assert (newlen <= (len + 2) * 2 + 62);
break;
if ((yenc->state & CAMEL_MIME_YDECODE_STATE_DECODE) && !(yenc->state & CAMEL_MIME_YDECODE_STATE_END)) {
/* all yEnc headers have been found so we can now start decoding */
camel_mime_filter_set_size (filter, len + 3, FALSE);
- newlen = camel_ydecode_step (in, len, filter->outbuf, ¥c->state,
+ newlen = camel_ydecode_step ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, ¥c->state,
¥c->pcrc, ¥c->crc);
g_assert (newlen <= len + 3);
} else {
return NULL;
if (array->len == 0 || array->data[array->len-1] != '\0')
- g_byte_array_append(array, "", 1);
+ g_byte_array_append(array, (guint8 *) "", 1);
return (const char *) array->data;
}
}
if (save)
- g_byte_array_append(save, s->inptr, inptr-s->inptr);
+ g_byte_array_append(save, (guint8 *) s->inptr, inptr-s->inptr);
s->inptr = inptr;
s->outptr = s->outbuf;
s->outend = s->outbuf+1024;
- s->realbuf = g_malloc(SCAN_BUF + SCAN_HEAD*2);
+ s->realbuf = g_malloc0 (SCAN_BUF + SCAN_HEAD*2);
s->inbuf = s->realbuf + SCAN_HEAD;
s->inptr = s->inbuf;
s->inend = s->inbuf;
if (h->prestage > 0) {
if (h->posttext == NULL)
h->posttext = g_byte_array_new();
- g_byte_array_append(h->posttext, *databuffer, *datalength);
+ g_byte_array_append(h->posttext, (guint8 *) *databuffer, *datalength);
} else {
if (h->pretext == NULL)
h->pretext = g_byte_array_new();
- g_byte_array_append(h->pretext, *databuffer, *datalength);
+ g_byte_array_append(h->pretext, (guint8 *) *databuffer, *datalength);
}
}
} while (hb==h && *datalength>0);
CAMEL_MIME_PARSER_STATE_HEADER_END, /* dummy value */
CAMEL_MIME_PARSER_STATE_BODY_END, /* end of message */
CAMEL_MIME_PARSER_STATE_MULTIPART_END, /* end of multipart */
- CAMEL_MIME_PARSER_STATE_MESSAGE_END, /* end of message */
+ CAMEL_MIME_PARSER_STATE_MESSAGE_END /* end of message */
} camel_mime_parser_state_t;
struct _CamelMimeParser {
buffer = g_byte_array_new ();
while (camel_mime_parser_step (mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_BODY_END) {
d(printf("appending o/p data: %d: %.*s\n", len, len, buf));
- g_byte_array_append (buffer, buf, len);
+ g_byte_array_append (buffer, (guint8 *) buf, len);
}
d(printf("message part kept in memory!\n"));
void
camel_mime_part_set_description (CamelMimePart *mime_part, const char *description)
{
- char *text = camel_header_encode_string (description);
+ char *text = camel_header_encode_string ((const unsigned char *) description);
camel_medium_set_header (CAMEL_MEDIUM (mime_part),
"Content-Description", text);
gsize bytes = 0;
if (inlen > 0)
- bytes += g_base64_encode_step (in, inlen, break_lines, out, state, save);
+ bytes += g_base64_encode_step (in, inlen, break_lines, (gchar *) out, state, save);
- bytes += g_base64_encode_close (break_lines, out, state, save);
+ bytes += g_base64_encode_close (break_lines, (gchar *) out, state, save);
return bytes;
}
size_t
camel_base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save)
{
- return g_base64_encode_step (in, len, break_lines, out, state, save);
+ return g_base64_encode_step (in, len, break_lines, (gchar *) out, state, save);
}
size_t
camel_base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save)
{
- return g_base64_decode_step (in, len, out, state, save);
+ return g_base64_decode_step ((gchar *) in, len, out, state, save);
}
char *
camel_base64_encode_simple (const char *data, size_t len)
{
- return g_base64_encode (data, len);
+ return g_base64_encode ((const guchar *) data, len);
}
decword = g_alloca (tmplen); /* this will always be more-than-enough room */
switch(toupper(inptr[0])) {
case 'Q':
- inlen = quoted_decode(inptr+2, tmplen, decword);
+ inlen = quoted_decode((const unsigned char *) inptr+2, tmplen, (unsigned char *) decword);
break;
case 'B': {
int state = 0;
unsigned int save = 0;
- inlen = camel_base64_decode_step((char *)inptr+2, tmplen, decword, &state, &save);
+ inlen = camel_base64_decode_step((unsigned char *) inptr+2, tmplen, (unsigned char *) decword, &state, &save);
/* if state != 0 then error? */
break;
}
else
*out++ = ' ';
out += sprintf (out, "=?%s?Q?", type);
- out += quoted_encode (buffer, enclen, out, safemask);
+ out += quoted_encode ((unsigned char *) buffer, enclen, (unsigned char *) out, safemask);
sprintf (out, "?=");
d(printf("converted part = %s\n", ascii));
GString *out;
char *outstr;
- g_return_val_if_fail (g_utf8_validate (in, -1, NULL), NULL);
+ g_return_val_if_fail (g_utf8_validate ((const gchar *) in, -1, NULL), NULL);
if (in == NULL)
return NULL;
inptr++;
}
if (*inptr == '\0')
- return g_strdup (in);
+ return g_strdup ((gchar *) in);
/* This gets each word out of the input, and checks to see what charset
can be used to encode it. */
const char *newinptr;
newinptr = g_utf8_next_char (inptr);
- c = g_utf8_get_char (inptr);
+ c = g_utf8_get_char ((gchar *) inptr);
if (newinptr == NULL || !g_unichar_validate (c)) {
w(g_warning ("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s",
(inptr-in), inptr[0], in));
/* we've reached the end of a 'word' */
if (word && !(last_was_encoded && encoding)) {
/* output lwsp between non-encoded words */
- g_string_append_len (out, start, word - start);
+ g_string_append_len (out, (const gchar *) start, word - start);
start = word;
}
switch (encoding) {
case 0:
- g_string_append_len (out, start, inptr - start);
+ g_string_append_len (out, (const char *) start, inptr - start);
last_was_encoded = FALSE;
break;
case 1:
if (last_was_encoded)
g_string_append_c (out, ' ');
- rfc2047_encode_word (out, start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
+ rfc2047_encode_word (out, (const char *) start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
last_was_encoded = TRUE;
break;
case 2:
if (last_was_encoded)
g_string_append_c (out, ' ');
- if (!(charset = camel_charset_best (start, inptr - start)))
+ if (!(charset = camel_charset_best ((const char *) start, inptr - start)))
charset = "UTF-8";
- rfc2047_encode_word (out, start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
+ rfc2047_encode_word (out, (const char *) start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
last_was_encoded = TRUE;
break;
}
if (!(c < 256 && camel_mime_is_lwsp (c)) && !word)
word = inptr;
- inptr = newinptr;
+ inptr = (const unsigned char *) newinptr;
}
if (inptr - start) {
if (word && !(last_was_encoded && encoding)) {
- g_string_append_len (out, start, word - start);
+ g_string_append_len (out, (const gchar *) start, word - start);
start = word;
}
switch (encoding) {
case 0:
- g_string_append_len (out, start, inptr - start);
+ g_string_append_len (out, (const gchar *) start, inptr - start);
break;
case 1:
if (last_was_encoded)
g_string_append_c (out, ' ');
- rfc2047_encode_word (out, start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
+ rfc2047_encode_word (out, (const char *) start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
break;
case 2:
if (last_was_encoded)
g_string_append_c (out, ' ');
- if (!(charset = camel_charset_best (start, inptr - start)))
+ if (!(charset = camel_charset_best ((const char *) start, inptr - start)))
charset = "UTF-8";
- rfc2047_encode_word (out, start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
+ rfc2047_encode_word (out, (const char *) start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
break;
}
}
const char *newinptr;
newinptr = g_utf8_next_char (inptr);
- c = g_utf8_get_char (inptr);
+ c = g_utf8_get_char ((gchar *) inptr);
if (!g_unichar_validate (c)) {
w(g_warning ("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s",
continue;
}
- inptr = newinptr;
+ inptr = (const unsigned char *) newinptr;
if (g_unichar_isspace (c)) {
if (count > 0) {
word = g_new0 (struct _phrase_word, 1);
if (last_word && !(last_word->type == WORD_2047 && word->type == WORD_2047)) {
/* one or both of the words are not encoded so we write the spaces out untouched */
len = word->start - last_word->end;
- out = g_string_append_len (out, last_word->end, len);
+ out = g_string_append_len (out, (char *) last_word->end, len);
}
switch (word->type) {
case WORD_ATOM:
- out = g_string_append_len (out, word->start, word->end - word->start);
+ out = g_string_append_len (out, (char *) word->start, word->end - word->start);
break;
case WORD_QSTRING:
- quote_word (out, TRUE, word->start, word->end - word->start);
+ quote_word (out, TRUE, (char *) word->start, word->end - word->start);
break;
case WORD_2047:
if (last_word && last_word->type == WORD_2047) {
/* include the whitespace chars between these 2 words in the
resulting rfc2047 encoded word. */
len = word->end - last_word->end;
- start = last_word->end;
+ start = (const char *) last_word->end;
/* encoded words need to be separated by linear whitespace */
g_string_append_c (out, ' ');
} else {
len = word->end - word->start;
- start = word->start;
+ start = (const char *) word->start;
}
if (word->encoding == 1) {
static char *
hex_decode (const char *in, size_t len)
{
- const unsigned char *inend = in + len;
+ const unsigned char *inend = (const unsigned char *) (in + len);
unsigned char *inptr, *outptr;
char *outbuf;
- outptr = outbuf = g_malloc (len + 1);
+ outbuf = (char *) g_malloc (len + 1);
+ outptr = (unsigned char *) outbuf;
inptr = (unsigned char *) in;
while (inptr < inend) {
CamelContentType *
camel_content_type_new(const char *type, const char *subtype)
{
- CamelContentType *t = g_malloc(sizeof(*t));
+ CamelContentType *t;
+ t = g_slice_new (CamelContentType);
t->type = g_strdup(type);
t->subtype = g_strdup(subtype);
t->params = NULL;
t->refcount = 1;
+
return t;
}
camel_header_param_list_free(ct->params);
g_free(ct->type);
g_free(ct->subtype);
- g_free(ct);
+ g_slice_free (CamelContentType, ct);
ct = NULL;
} else {
ct->refcount--;
/* if we have really broken utf8 passed in, we just treat it as binary data */
- charset = camel_charset_best(in, strlen(in));
+ charset = camel_charset_best((char *) in, strlen((char *) in));
if (charset == NULL)
- return g_strdup(in);
+ return g_strdup((char *) in);
if (g_ascii_strcasecmp(charset, "UTF-8") != 0) {
- if ((outbuf = header_convert(charset, "UTF-8", in, strlen(in))))
+ if ((outbuf = (unsigned char *) header_convert(charset, "UTF-8", (const char *) in, strlen((char *) in))))
inptr = outbuf;
else
- return g_strdup(in);
+ return g_strdup((char *) in);
}
/* FIXME: set the 'language' as well, assuming we can get that info...? */
continue;
}
- value = header_encode_param (p->value, &encoded);
+ value = header_encode_param ((unsigned char *) p->value, &encoded);
if (!value) {
w(g_warning ("appending parameter %s=%s violates rfc2184", p->name, p->value));
value = g_strdup (p->value);
{
unsigned char *p;
- p = h->value;
+ p = (unsigned char *) h->value;
while (p && *p) {
if (!isascii(*p)) {
w(g_warning("Appending header violates rfc: %s: %s", h->name, h->value));
switch (a->type) {
case CAMEL_HEADER_ADDRESS_NAME:
if (encode)
- text = camel_header_encode_phrase (a->name);
+ text = camel_header_encode_phrase ((unsigned char *) a->name);
else
text = a->name;
if (text && *text)
break;
case CAMEL_HEADER_ADDRESS_GROUP:
if (encode)
- text = camel_header_encode_phrase (a->name);
+ text = camel_header_encode_phrase ((unsigned char *) a->name);
else
text = a->name;
g_string_append_printf (out, "%s: ", text);
CAMEL_MIME_IS_QPSAFE = 1<<6,
CAMEL_MIME_IS_ESAFE = 1<<7, /* encoded word safe */
CAMEL_MIME_IS_PSAFE = 1<<8, /* encoded word in phrase safe */
- CAMEL_MIME_IS_ATTRCHAR = 1<<9, /* attribute-char safe (rfc2184) */
+ CAMEL_MIME_IS_ATTRCHAR = 1<<9 /* attribute-char safe (rfc2184) */
};
extern unsigned short camel_mime_special_table[256];
/* 'handy' enums for getting the internal parts of the multipart */
enum {
CAMEL_MULTIPART_ENCRYPTED_VERSION,
- CAMEL_MULTIPART_ENCRYPTED_CONTENT,
+ CAMEL_MULTIPART_ENCRYPTED_CONTENT
};
struct _CamelMultipartEncrypted {
/* 'handy' enums for getting the internal parts of the multipart */
enum {
CAMEL_MULTIPART_SIGNED_CONTENT,
- CAMEL_MULTIPART_SIGNED_SIGNATURE,
+ CAMEL_MULTIPART_SIGNED_SIGNATURE
};
typedef struct _CamelMultipartSigned CamelMultipartSigned;
if (!boundary) {
/* Generate a fairly random boundary string. */
- bgen = g_strdup_printf ("%p:%lu:%lu", multipart,
+ bgen = g_strdup_printf ("%p:%lu:%lu", (void *) multipart,
(unsigned long) getpid(),
(unsigned long) time(NULL));
- md5_get_digest (bgen, strlen (bgen), digest);
+ md5_get_digest (bgen, strlen (bgen), (unsigned char *) digest);
g_free (bgen);
strcpy (bbuf, "=-");
p = bbuf + 2;
state = save = 0;
- p += g_base64_encode_step (digest, 16, FALSE, p, &state, &save);
+ p += g_base64_encode_step ((guchar *) digest, 16, FALSE, p, &state, &save);
*p = '\0';
boundary = bbuf;
msg->hostbufmem = g_malloc(msg->hostbuflen);
#endif
if (cs_waitinfo(cs_getaddrinfo, msg, _("Host lookup failed"), ex) == 0) {
- if (msg->result != 0)
+ if (msg->result != 0) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Host lookup failed: %s: %s"),
name, gai_strerror (msg->result));
+ }
cs_freeinfo(msg);
} else
/* ********************************************************************** */
-static pthread_mutex_t chunks_lock = PTHREAD_MUTEX_INITIALIZER;
-
-static EMemChunk *pair_chunks;
-static EMemChunk *hook_chunks;
-static unsigned int pair_id = 1;
-
/* type-lock must be recursive, for atomically creating classes */
static GStaticRecMutex type_lock = G_STATIC_REC_MUTEX_INIT;
/* ref-lock must be global :-( for object bags to work */
static GMutex *ref_lock;
static GHashTable *type_table;
-static EMemChunk *type_chunks;
/* fundamental types are accessed via global */
CamelType camel_object_type;
static struct _CamelHookPair *
pair_alloc(void)
{
+ static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ static guint next_id = 1;
CamelHookPair *pair;
- P_LOCK(chunks_lock);
- pair = e_memchunk_alloc(pair_chunks);
- pair->id = pair_id++;
- if (pair_id == 0)
- pair_id = 1;
- P_UNLOCK(chunks_lock);
+ pair = g_slice_new (CamelHookPair);
+
+ g_static_mutex_lock (&mutex);
+ pair->id = next_id++;
+ if (next_id == 0)
+ next_id = 1;
+ g_static_mutex_unlock (&mutex);
return pair;
}
static void
pair_free(CamelHookPair *pair)
{
- g_assert(pair_chunks != NULL);
-
- P_LOCK(chunks_lock);
- e_memchunk_free(pair_chunks, pair);
- P_UNLOCK(chunks_lock);
+ g_slice_free (CamelHookPair, pair);
}
static struct _CamelHookList *
hooks_alloc(void)
{
- CamelHookList *hooks;
-
- P_LOCK(chunks_lock);
- hooks = e_memchunk_alloc(hook_chunks);
- P_UNLOCK(chunks_lock);
-
- return hooks;
+ return g_slice_new0 (CamelHookList);
}
static void
hooks_free(CamelHookList *hooks)
{
- g_assert(hook_chunks != NULL);
-
- P_LOCK(chunks_lock);
- e_memchunk_free(hook_chunks, hooks);
- P_UNLOCK(chunks_lock);
+ g_slice_free (CamelHookList, hooks);
}
/* not checked locked, who cares, only required for people that want to redefine root objects */
return;
init = TRUE;
- pair_chunks = e_memchunk_new(16, sizeof(CamelHookPair));
- hook_chunks = e_memchunk_new(16, sizeof(CamelHookList));
- type_chunks = e_memchunk_new(32, sizeof(CamelType));
type_table = g_hash_table_new(NULL, NULL);
ref_lock = g_mutex_new();
}
switch(argv->argv[argv->argc].tag & CAMEL_ARG_TYPE) {
case CAMEL_ARG_INT:
case CAMEL_ARG_BOO:
- if (camel_file_util_decode_uint32(fp, &argv->argv[argv->argc].ca_int) == -1)
+ if (camel_file_util_decode_uint32(fp, (guint32 *) &argv->argv[argv->argc].ca_int) == -1)
goto cleanup;
break;
case CAMEL_ARG_STR:
size = offset + klass_size;
- klass = g_malloc0(size);
+ klass = g_slice_alloc0(size);
klass->klass_size = size;
klass->klass_data = offset;
return NULL;
}
- klass = g_malloc0(klass_size);
+ klass = g_slice_alloc (klass_size);
klass->klass_size = klass_size;
klass->object_size = object_size;
klass->lock = g_mutex_new();
- klass->instance_chunks = e_memchunk_new(8, object_size);
+ klass->hooks = NULL;
klass->parent = parent;
if (parent) {
CLASS_LOCK(type);
- o = e_memchunk_alloc0(type->instance_chunks);
+ o = g_slice_alloc0 (type->object_size);
#ifdef CAMEL_OBJECT_TRACK_INSTANCES
if (type->instances)
if (o->next)
o->next->prev = o->prev;
#endif
- e_memchunk_free(klass->instance_chunks, o);
+ g_slice_free1 (klass->object_size, o);
CLASS_UNLOCK(klass);
}
k = k->parent;
}
- g_warning("Object %p (class '%s') doesn't have '%s' in its hierarchy", o, o->klass->name, ctype->name);
+ g_warning("Object %p (class '%s') doesn't have '%s' in its hierarchy", (void *) o, o->klass->name, ctype->name);
return NULL;
}
camel_object_unget_hooks(obj);
g_warning("camel_object_unhook_event: cannot find hook/data pair %p/%p in an instance of `%s' attached to `%s'",
- func, data, obj->klass->name, name);
+ (void *) func, data, obj->klass->name, name);
}
void
/* also, no hooks, dont bother going further */
if (obj->hooks == NULL)
return;
+
trigger_interface:
/* lock the object for hook emission */
camel_object_ref(obj);
CamelHookPair *pair = root->hooks;
while (pair) {
- printf("%s event '%s' prep %p\n", p, pair->name, pair->func.prep);
+ printf("%s event '%s' prep %p\n", p, pair->name, (void *) pair->func.prep);
pair = pair->next;
}
}
+
#ifdef CAMEL_OBJECT_TRACK_INSTANCES
o = root->instances;
while (o) {
CAMEL_OBJECT_ARG_DESCRIPTION = CAMEL_ARG_FIRST, /* Get a copy of the meta-data list (should be freed) */
CAMEL_OBJECT_ARG_METADATA,
CAMEL_OBJECT_ARG_STATE_FILE,
- CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES,
+ CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES
};
enum {
/* sets where the persistent data should reside, otherwise it isn't persistent */
CAMEL_OBJECT_STATE_FILE = CAMEL_OBJECT_ARG_STATE_FILE | CAMEL_ARG_STR,
/* returns a GSList CamelProperties of persistent properties */
- CAMEL_OBJECT_PERSISTENT_PROPERTIES = CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES | CAMEL_ARG_PTR,
+ CAMEL_OBJECT_PERSISTENT_PROPERTIES = CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES | CAMEL_ARG_PTR
};
typedef enum _CamelObjectFlags {
- CAMEL_OBJECT_DESTROY = (1<<0),
+ CAMEL_OBJECT_DESTROY = (1<<0)
} CamelObjectFlags;
/* returned by get::CAMEL_OBJECT_METADATA */
};
enum {
- CAMEL_OFFLINE_FOLDER_SYNC_OFFLINE = CAMEL_OFFLINE_FOLDER_ARG_SYNC_OFFLINE | CAMEL_ARG_BOO,
+ CAMEL_OFFLINE_FOLDER_SYNC_OFFLINE = CAMEL_OFFLINE_FOLDER_ARG_SYNC_OFFLINE | CAMEL_ARG_BOO
};
struct _CamelOfflineFolder {
typedef struct _CamelOfflineStoreClass CamelOfflineStoreClass;
enum {
- CAMEL_OFFLINE_STORE_ARG_FIRST = CAMEL_STORE_ARG_FIRST + 100,
+ CAMEL_OFFLINE_STORE_ARG_FIRST = CAMEL_STORE_ARG_FIRST + 100
};
enum {
CAMEL_OFFLINE_STORE_NETWORK_AVAIL,
- CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL,
+ CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL
};
struct _CamelOfflineStore {
typedef enum _camel_operation_status_t {
CAMEL_OPERATION_START = -1,
- CAMEL_OPERATION_END = -2,
+ CAMEL_OPERATION_END = -2
} camel_operation_status_t;
/* main thread functions */
};
#define CAMEL_FOLDER_LOCK(f, l) \
- (g_static_mutex_lock(&((CamelFolder *)f)->priv->l))
+ (g_static_mutex_lock(&((CamelFolder *) (f))->priv->l))
#define CAMEL_FOLDER_UNLOCK(f, l) \
- (g_static_mutex_unlock(&((CamelFolder *)f)->priv->l))
+ (g_static_mutex_unlock(&((CamelFolder *) (f))->priv->l))
#define CAMEL_FOLDER_REC_LOCK(f, l) \
- (g_static_rec_mutex_lock(&((CamelFolder *)f)->priv->l))
+ (g_static_rec_mutex_lock(&((CamelFolder *) (f))->priv->l))
#define CAMEL_FOLDER_REC_UNLOCK(f, l) \
- (g_static_rec_mutex_unlock(&((CamelFolder *)f)->priv->l))
+ (g_static_rec_mutex_unlock(&((CamelFolder *) (f))->priv->l))
struct _CamelStorePrivate {
};
#define CAMEL_STORE_LOCK(f, l) \
- (g_static_rec_mutex_lock(&((CamelStore *)f)->priv->l))
+ (g_static_rec_mutex_lock(&((CamelStore *) (f))->priv->l))
#define CAMEL_STORE_UNLOCK(f, l) \
- (g_static_rec_mutex_unlock(&((CamelStore *)f)->priv->l))
+ (g_static_rec_mutex_unlock(&((CamelStore *) (f))->priv->l))
struct _CamelTransportPrivate {
GMutex *send_lock; /* for locking send operations */
};
-#define CAMEL_TRANSPORT_LOCK(f, l) (g_mutex_lock(((CamelTransport *)f)->priv->l))
-#define CAMEL_TRANSPORT_UNLOCK(f, l) (g_mutex_unlock(((CamelTransport *)f)->priv->l))
+#define CAMEL_TRANSPORT_LOCK(f, l) \
+ (g_mutex_lock(((CamelTransport *) (f))->priv->l))
+#define CAMEL_TRANSPORT_UNLOCK(f, l) \
+ (g_mutex_unlock(((CamelTransport *) (f))->priv->l))
struct _CamelServicePrivate {
};
#define CAMEL_SERVICE_LOCK(f, l) \
- (g_static_mutex_lock(&((CamelService *)f)->priv->l))
+ (g_static_mutex_lock(&((CamelService *) (f))->priv->l))
#define CAMEL_SERVICE_UNLOCK(f, l) \
- (g_static_mutex_unlock(&((CamelService *)f)->priv->l))
+ (g_static_mutex_unlock(&((CamelService *) (f))->priv->l))
#define CAMEL_SERVICE_REC_LOCK(f, l) \
- (g_static_rec_mutex_lock(&((CamelService *)f)->priv->l))
+ (g_static_rec_mutex_lock(&((CamelService *) (f))->priv->l))
#define CAMEL_SERVICE_REC_UNLOCK(f, l) \
- (g_static_rec_mutex_unlock(&((CamelService *)f)->priv->l))
+ (g_static_rec_mutex_unlock(&((CamelService *) (f))->priv->l))
+#define CAMEL_SERVICE_REC_TRYLOCK(f, l) \
+ (g_static_rec_mutex_trylock(&((CamelService *) (f))->priv->l))
struct _CamelSessionPrivate {
GHashTable *thread_msg_op;
};
-#define CAMEL_SESSION_LOCK(f, l) (g_mutex_lock(((CamelSession *)f)->priv->l))
-#define CAMEL_SESSION_UNLOCK(f, l) (g_mutex_unlock(((CamelSession *)f)->priv->l))
+#define CAMEL_SESSION_LOCK(f, l) \
+ (g_mutex_lock(((CamelSession *) (f))->priv->l))
+#define CAMEL_SESSION_UNLOCK(f, l) \
+ (g_mutex_unlock(((CamelSession *) (f))->priv->l))
/* most of this stuff really is private, but the lock can be used by subordinate classes */
GMutex *ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
};
-#define CAMEL_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelFolderSummary *)f)->priv->l))
-#define CAMEL_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelFolderSummary *)f)->priv->l))
+#define CAMEL_SUMMARY_LOCK(f, l) \
+ (g_mutex_lock(((CamelFolderSummary *) (f))->priv->l))
+#define CAMEL_SUMMARY_UNLOCK(f, l) \
+ (g_mutex_unlock(((CamelFolderSummary *) (f))->priv->l))
struct _CamelStoreSummaryPrivate {
GMutex *ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
};
-#define CAMEL_STORE_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelStoreSummary *)f)->priv->l))
-#define CAMEL_STORE_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelStoreSummary *)f)->priv->l))
+#define CAMEL_STORE_SUMMARY_LOCK(f, l) \
+ (g_mutex_lock(((CamelStoreSummary *) (f))->priv->l))
+#define CAMEL_STORE_SUMMARY_UNLOCK(f, l) \
+ (g_mutex_unlock(((CamelStoreSummary *) (f))->priv->l))
struct _CamelVeeFolderPrivate {
GMutex *changed_lock; /* for locking the folders-changed list */
};
-#define CAMEL_VEE_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelVeeFolder *)f)->priv->l))
-#define CAMEL_VEE_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelVeeFolder *)f)->priv->l))
+#define CAMEL_VEE_FOLDER_LOCK(f, l) \
+ (g_mutex_lock(((CamelVeeFolder *) (f))->priv->l))
+#define CAMEL_VEE_FOLDER_UNLOCK(f, l) \
+ (g_mutex_unlock(((CamelVeeFolder *) (f))->priv->l))
struct _CamelDataWrapperPrivate {
pthread_mutex_t stream_lock;
};
-#define CAMEL_DATA_WRAPPER_LOCK(dw, l) (pthread_mutex_lock(&((CamelDataWrapper *)dw)->priv->l))
-#define CAMEL_DATA_WRAPPER_UNLOCK(dw, l) (pthread_mutex_unlock(&((CamelDataWrapper *)dw)->priv->l))
+#define CAMEL_DATA_WRAPPER_LOCK(dw, l) \
+ (pthread_mutex_lock(&((CamelDataWrapper *) (dw))->priv->l))
+#define CAMEL_DATA_WRAPPER_UNLOCK(dw, l) \
+ (pthread_mutex_unlock(&((CamelDataWrapper *) (dw))->priv->l))
/* most of this stuff really is private, but the lock can be used by subordinate classes */
GMutex *ref_lock; /* for reffing/unreffing certs */
};
-#define CAMEL_CERTDB_LOCK(db, l) (g_mutex_lock (((CamelCertDB *) db)->priv->l))
-#define CAMEL_CERTDB_UNLOCK(db, l) (g_mutex_unlock (((CamelCertDB *) db)->priv->l))
+#define CAMEL_CERTDB_LOCK(db, l) \
+ (g_mutex_lock (((CamelCertDB *) (db))->priv->l))
+#define CAMEL_CERTDB_UNLOCK(db, l) \
+ (g_mutex_unlock (((CamelCertDB *) (db))->priv->l))
#ifdef G_OS_WIN32
int fsync (int fd);
}
camel_object_unref (cia);
ret = g_byte_array_new ();
- g_byte_array_append (ret, sasl_anon->trace_info, strlen (sasl_anon->trace_info));
+ g_byte_array_append (ret, (guint8 *) sasl_anon->trace_info, strlen (sasl_anon->trace_info));
break;
case CAMEL_SASL_ANON_TRACE_OPAQUE:
if (strchr (sasl_anon->trace_info, '@')) {
return NULL;
}
ret = g_byte_array_new ();
- g_byte_array_append (ret, sasl_anon->trace_info, strlen (sasl_anon->trace_info));
+ g_byte_array_append (ret, (guint8 *) sasl_anon->trace_info, strlen (sasl_anon->trace_info));
break;
case CAMEL_SASL_ANON_TRACE_EMPTY:
ret = g_byte_array_new ();
/* lowercase hexify that bad-boy... */
for (s = digest, p = md5asc; p < md5asc + 32; s++, p += 2)
- sprintf (p, "%.2x", *s);
+ sprintf ((char *) p, "%.2x", *s);
ret = g_byte_array_new ();
- g_byte_array_append (ret, sasl->service->url->user, strlen (sasl->service->url->user));
- g_byte_array_append (ret, " ", 1);
- g_byte_array_append (ret, md5asc, 32);
+ g_byte_array_append (ret, (guint8 *) sasl->service->url->user, strlen (sasl->service->url->user));
+ g_byte_array_append (ret, (guint8 *) " ", 1);
+ g_byte_array_append (ret, (guint8 *) md5asc, 32);
sasl->authenticated = TRUE;
/* lowercase hexify that bad-boy... */
for (s = digest, p = hex; p < hex + 32; s++, p += 2)
- sprintf (p, "%.2x", *s);
+ sprintf ((char *) p, "%.2x", *s);
}
static char *
/* compute A1 */
md5_init (&ctx);
- md5_update (&ctx, resp->username, strlen (resp->username));
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, resp->realm, strlen (resp->realm));
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, passwd, strlen (passwd));
+ md5_update (&ctx, (const guchar *) resp->username, strlen (resp->username));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) resp->realm, strlen (resp->realm));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) passwd, strlen (passwd));
md5_final (&ctx, digest);
md5_init (&ctx);
md5_update (&ctx, digest, 16);
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, resp->nonce, strlen (resp->nonce));
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) resp->nonce, strlen (resp->nonce));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) resp->cnonce, strlen (resp->cnonce));
if (resp->authzid) {
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, resp->authzid, strlen (resp->authzid));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) resp->authzid, strlen (resp->authzid));
}
/* hexify A1 */
md5_init (&ctx);
if (client) {
/* we are calculating the client response */
- md5_update (&ctx, "AUTHENTICATE:", strlen ("AUTHENTICATE:"));
+ md5_update (&ctx, (const guchar *) "AUTHENTICATE:", strlen ("AUTHENTICATE:"));
} else {
/* we are calculating the server rspauth */
- md5_update (&ctx, ":", 1);
+ md5_update (&ctx, (const guchar *) ":", 1);
}
buf = digest_uri_to_string (resp->uri);
- md5_update (&ctx, buf, strlen (buf));
+ md5_update (&ctx, (const guchar *) buf, strlen (buf));
g_free (buf);
if (resp->qop == QOP_AUTH_INT || resp->qop == QOP_AUTH_CONF)
- md5_update (&ctx, ":00000000000000000000000000000000", 33);
+ md5_update (&ctx, (const guchar *) ":00000000000000000000000000000000", 33);
/* now hexify A2 */
md5_final (&ctx, digest);
/* compute KD */
md5_init (&ctx);
- md5_update (&ctx, hex_a1, 32);
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, resp->nonce, strlen (resp->nonce));
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, resp->nc, 8);
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, qop_to_string (resp->qop), strlen (qop_to_string (resp->qop)));
- md5_update (&ctx, ":", 1);
- md5_update (&ctx, hex_a2, 32);
+ md5_update (&ctx, (const guchar *) hex_a1, 32);
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) resp->nonce, strlen (resp->nonce));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) resp->nc, 8);
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) resp->cnonce, strlen (resp->cnonce));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) qop_to_string (resp->qop), strlen (qop_to_string (resp->qop)));
+ md5_update (&ctx, (const guchar *) ":", 1);
+ md5_update (&ctx, (const guchar *) hex_a2, 32);
md5_final (&ctx, digest);
digest_hex (digest, out);
resp->nonce = g_strdup (challenge->nonce);
/* generate the cnonce */
- bgen = g_strdup_printf ("%p:%lu:%lu", resp,
+ bgen = g_strdup_printf ("%p:%lu:%lu", (void *) resp,
(unsigned long) getpid (),
(unsigned long) time (NULL));
- md5_get_digest (bgen, strlen (bgen), digest);
+ md5_get_digest (bgen, strlen (bgen), (guchar *) digest);
g_free (bgen);
/* take our recommended 64 bits of entropy */
- resp->cnonce = g_base64_encode (digest, 8);
+ resp->cnonce = g_base64_encode ((guchar *) digest, 8);
/* we don't support re-auth so the nonce count is always 1 */
strcpy (resp->nc, "00000001");
/* we don't really care about this... */
resp->authzid = NULL;
- compute_response (resp, passwd, TRUE, resp->resp);
+ compute_response (resp, passwd, TRUE, (guchar *) resp->resp);
return resp;
}
char *buf;
buffer = g_byte_array_new ();
- g_byte_array_append (buffer, "username=\"", 10);
+ g_byte_array_append (buffer, (guint8 *) "username=\"", 10);
if (resp->charset) {
/* Encode the username using the requested charset */
char *username, *outbuf;
if (cd != (iconv_t) -1)
e_iconv_close (cd);
- g_byte_array_append (buffer, username, strlen (username));
+ g_byte_array_append (buffer, (guint8 *) username, strlen (username));
g_free (username);
} else {
- g_byte_array_append (buffer, resp->username, strlen (resp->username));
+ g_byte_array_append (buffer, (guint8 *) resp->username, strlen (resp->username));
}
- g_byte_array_append (buffer, "\",realm=\"", 9);
- g_byte_array_append (buffer, resp->realm, strlen (resp->realm));
+ g_byte_array_append (buffer, (guint8 *) "\",realm=\"", 9);
+ g_byte_array_append (buffer, (guint8 *) resp->realm, strlen (resp->realm));
- g_byte_array_append (buffer, "\",nonce=\"", 9);
- g_byte_array_append (buffer, resp->nonce, strlen (resp->nonce));
+ g_byte_array_append (buffer, (guint8 *) "\",nonce=\"", 9);
+ g_byte_array_append (buffer, (guint8 *) resp->nonce, strlen (resp->nonce));
- g_byte_array_append (buffer, "\",cnonce=\"", 10);
- g_byte_array_append (buffer, resp->cnonce, strlen (resp->cnonce));
+ g_byte_array_append (buffer, (guint8 *) "\",cnonce=\"", 10);
+ g_byte_array_append (buffer, (guint8 *) resp->cnonce, strlen (resp->cnonce));
- g_byte_array_append (buffer, "\",nc=", 5);
- g_byte_array_append (buffer, resp->nc, 8);
+ g_byte_array_append (buffer, (guint8 *) "\",nc=", 5);
+ g_byte_array_append (buffer, (guint8 *) resp->nc, 8);
- g_byte_array_append (buffer, ",qop=", 5);
+ g_byte_array_append (buffer, (guint8 *) ",qop=", 5);
str = qop_to_string (resp->qop);
- g_byte_array_append (buffer, str, strlen (str));
+ g_byte_array_append (buffer, (guint8 *) str, strlen (str));
- g_byte_array_append (buffer, ",digest-uri=\"", 13);
+ g_byte_array_append (buffer, (guint8 *) ",digest-uri=\"", 13);
buf = digest_uri_to_string (resp->uri);
- g_byte_array_append (buffer, buf, strlen (buf));
+ g_byte_array_append (buffer, (guint8 *) buf, strlen (buf));
g_free (buf);
- g_byte_array_append (buffer, "\",response=", 11);
- g_byte_array_append (buffer, resp->resp, 32);
+ g_byte_array_append (buffer, (guint8 *) "\",response=", 11);
+ g_byte_array_append (buffer, (guint8 *) resp->resp, 32);
if (resp->maxbuf > 0) {
- g_byte_array_append (buffer, ",maxbuf=", 8);
+ g_byte_array_append (buffer, (guint8 *) ",maxbuf=", 8);
buf = g_strdup_printf ("%u", resp->maxbuf);
- g_byte_array_append (buffer, buf, strlen (buf));
+ g_byte_array_append (buffer, (guint8 *) buf, strlen (buf));
g_free (buf);
}
if (resp->charset) {
- g_byte_array_append (buffer, ",charset=", 9);
- g_byte_array_append (buffer, resp->charset, strlen (resp->charset));
+ g_byte_array_append (buffer, (guint8 *) ",charset=", 9);
+ g_byte_array_append (buffer, (guint8 *) resp->charset, strlen ((char *) resp->charset));
}
if (resp->cipher != CIPHER_INVALID) {
str = cipher_to_string (resp->cipher);
if (str) {
- g_byte_array_append (buffer, ",cipher=\"", 9);
- g_byte_array_append (buffer, str, strlen (str));
- g_byte_array_append (buffer, "\"", 1);
+ g_byte_array_append (buffer, (guint8 *) ",cipher=\"", 9);
+ g_byte_array_append (buffer, (guint8 *) str, strlen (str));
+ g_byte_array_append (buffer, (guint8 *) "\"", 1);
}
}
if (resp->authzid) {
- g_byte_array_append (buffer, ",authzid=\"", 10);
- g_byte_array_append (buffer, resp->authzid, strlen (resp->authzid));
- g_byte_array_append (buffer, "\"", 1);
+ g_byte_array_append (buffer, (guint8 *) ",authzid=\"", 10);
+ g_byte_array_append (buffer, (guint8 *) resp->authzid, strlen (resp->authzid));
+ g_byte_array_append (buffer, (guint8 *) "\"", 1);
}
return buffer;
return NULL;
}
- tokens = g_strndup (token->data, token->len);
+ tokens = g_strndup ((gchar *) token->data, token->len);
priv->challenge = parse_server_challenge (tokens, &abort);
g_free (tokens);
if (!priv->challenge || abort) {
break;
case STATE_FINAL:
if (token->len)
- tokens = g_strndup (token->data, token->len);
+ tokens = g_strndup ((gchar *) token->data, token->len);
else
tokens = NULL;
switch (priv->state) {
case LOGIN_USER:
buf = g_byte_array_new ();
- g_byte_array_append (buf, url->user, strlen (url->user));
+ g_byte_array_append (buf, (guint8 *) url->user, strlen (url->user));
break;
case LOGIN_PASSWD:
buf = g_byte_array_new ();
- g_byte_array_append (buf, url->passwd, strlen (url->passwd));
+ g_byte_array_append (buf, (guint8 *) url->passwd, strlen (url->passwd));
sasl->authenticated = TRUE;
break;
ret = g_byte_array_new ();
if (!token || !token->len) {
- g_byte_array_append (ret, NTLM_REQUEST,
+ g_byte_array_append (ret, (guint8 *) NTLM_REQUEST,
sizeof (NTLM_REQUEST) - 1);
return ret;
}
memcpy (nonce, token->data + NTLM_CHALLENGE_NONCE_OFFSET, 8);
- ntlm_lanmanager_hash (sasl->service->url->passwd, hash);
+ ntlm_lanmanager_hash (sasl->service->url->passwd, (char *) hash);
ntlm_calc_response (hash, nonce, lm_resp);
- ntlm_nt_hash (sasl->service->url->passwd, hash);
+ ntlm_nt_hash (sasl->service->url->passwd, (char *) hash);
ntlm_calc_response (hash, nonce, nt_resp);
ret = g_byte_array_new ();
NTLM_RESPONSE_FLAGS, sizeof (NTLM_RESPONSE_FLAGS) - 1);
ntlm_set_string (ret, NTLM_RESPONSE_DOMAIN_OFFSET,
- token->data + NTLM_CHALLENGE_DOMAIN_OFFSET,
- atoi (token->data + NTLM_CHALLENGE_DOMAIN_LEN_OFFSET));
+ (const char *) token->data + NTLM_CHALLENGE_DOMAIN_OFFSET,
+ atoi ((char *) token->data + NTLM_CHALLENGE_DOMAIN_LEN_OFFSET));
ntlm_set_string (ret, NTLM_RESPONSE_USER_OFFSET,
sasl->service->url->user,
strlen (sasl->service->url->user));
ntlm_set_string (ret, NTLM_RESPONSE_HOST_OFFSET,
"UNKNOWN", sizeof ("UNKNOWN") - 1);
ntlm_set_string (ret, NTLM_RESPONSE_LM_RESP_OFFSET,
- lm_resp, sizeof (lm_resp));
+ (const char *) lm_resp, sizeof (lm_resp));
ntlm_set_string (ret, NTLM_RESPONSE_NT_RESP_OFFSET,
- nt_resp, sizeof (nt_resp));
+ (const char *) nt_resp, sizeof (nt_resp));
sasl->authenticated = TRUE;
return ret;
memcpy (hash, LM_PASSWORD_MAGIC, 21);
setup_schedule (lm_password, ks);
- des (ks, hash);
+ des (ks, (unsigned char *) hash);
setup_schedule (lm_password + 7, ks);
- des (ks, hash + 8);
+ des (ks, (unsigned char *) hash + 8);
}
static void
*p++ = '\0';
}
- md4sum (buf, p - buf, hash);
+ md4sum (buf, p - buf, (unsigned char *) hash);
memset (hash + 16, 0, 5);
g_free (buf);
ba->data[offset + 1] = ba->data[offset + 3] = (len >> 8) & 0xFF;
ba->data[offset + 4] = ba->len & 0xFF;
ba->data[offset + 5] = (ba->len >> 8) & 0xFF;
- g_byte_array_append (ba, data, len);
+ g_byte_array_append (ba, (guint8 *) data, len);
}
/* FIXME: make sure these are "UTF8-SAFE" */
buf = g_byte_array_new ();
- g_byte_array_append (buf, "", 1);
- g_byte_array_append (buf, url->user, strlen (url->user));
- g_byte_array_append (buf, "", 1);
- g_byte_array_append (buf, url->passwd, strlen (url->passwd));
+ g_byte_array_append (buf, (guint8 *) "", 1);
+ g_byte_array_append (buf, (guint8 *) url->user, strlen (url->user));
+ g_byte_array_append (buf, (guint8 *) "", 1);
+ g_byte_array_append (buf, (guint8 *) url->passwd, strlen (url->passwd));
sasl->authenticated = TRUE;
/* from dan the man, if we have mixed case, perform a case-sensitive match,
otherwise not */
p = (const unsigned char *)match;
- while ((c = camel_utf8_getc(&p))) {
+ while ((c = camel_utf8_getc (&p))) {
if (g_unichar_isupper(c)) {
switch (how) {
case CAMEL_SEARCH_MATCH_EXACT:
CAMEL_SEARCH_MATCH_END = 1<<1,
CAMEL_SEARCH_MATCH_REGEX = 1<<2, /* disables the first 2 */
CAMEL_SEARCH_MATCH_ICASE = 1<<3,
- CAMEL_SEARCH_MATCH_NEWLINE = 1<<4,
+ CAMEL_SEARCH_MATCH_NEWLINE = 1<<4
} camel_search_flags_t;
typedef enum {
CAMEL_SEARCH_MATCH_CONTAINS,
CAMEL_SEARCH_MATCH_STARTS,
CAMEL_SEARCH_MATCH_ENDS,
- CAMEL_SEARCH_MATCH_SOUNDEX,
+ CAMEL_SEARCH_MATCH_SOUNDEX
} camel_search_match_t;
typedef enum {
CAMEL_SEARCH_TYPE_ENCODED,
CAMEL_SEARCH_TYPE_ADDRESS,
CAMEL_SEARCH_TYPE_ADDRESS_ENCODED,
- CAMEL_SEARCH_TYPE_MLIST, /* its a mailing list pseudo-header */
+ CAMEL_SEARCH_TYPE_MLIST /* its a mailing list pseudo-header */
} camel_search_t;
/* builds a regex that represents a string search */
typedef enum _camel_search_word_t {
CAMEL_SEARCH_WORD_SIMPLE = 1,
CAMEL_SEARCH_WORD_COMPLEX = 2,
- CAMEL_SEARCH_WORD_8BIT = 4,
+ CAMEL_SEARCH_WORD_8BIT = 4
} camel_search_word_t;
struct _camel_search_word {
if (camel_seekable_stream_tell (parent) == seekable_stream->position)
return TRUE;
- return camel_seekable_stream_seek (parent, seekable_stream->position, CAMEL_STREAM_SET) == seekable_stream->position;
+ return camel_seekable_stream_seek (parent, (off_t) seekable_stream->position, CAMEL_STREAM_SET) == seekable_stream->position;
}
static ssize_t
{
GList *ret;
+ g_return_val_if_fail (service != NULL, NULL);
+
/* note that we get the connect lock here, which means the callee
must not call the connect functions itself */
CAMEL_SERVICE_REC_LOCK (service, connect_lock);
CAMEL_SERVICE_ARG_AUTH,
CAMEL_SERVICE_ARG_HOSTNAME,
CAMEL_SERVICE_ARG_PORT,
- CAMEL_SERVICE_ARG_PATH,
+ CAMEL_SERVICE_ARG_PATH
};
#define CAMEL_SERVICE_USERNAME (CAMEL_SERVICE_ARG_USERNAME | CAMEL_ARG_STR)
CAMEL_SESSION_PASSWORD_REPROMPT = 1 << 0,
CAMEL_SESSION_PASSWORD_SECRET = 1 << 2,
CAMEL_SESSION_PASSWORD_STATIC = 1 << 3,
- CAMEL_SESSION_PASSPHRASE = 1 << 4,
+ CAMEL_SESSION_PASSPHRASE = 1 << 4
};
struct _CamelSession
NULL, NULL, /* password callback */
NULL, NULL); /* decrypt key callback */
- NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len);
+ NSS_CMSDecoder_Update(dec, (char *) istream->buffer->data, istream->buffer->len);
camel_object_unref(istream);
cmsg = NSS_CMSDecoder_Finish(dec);
goto fail;
}
- if (NSS_CMSEncoder_Update(enc, ((CamelStreamMem *)istream)->buffer->data, ((CamelStreamMem *)istream)->buffer->len) != SECSuccess) {
+ if (NSS_CMSEncoder_Update(enc, (char *) ((CamelStreamMem *)istream)->buffer->data, ((CamelStreamMem *)istream)->buffer->len) != SECSuccess) {
NSS_CMSEncoder_Cancel(enc);
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to add data to CMS encoder"));
goto fail;
NULL, NULL); /* decrypt key callback */
camel_data_wrapper_decode_to_stream(camel_medium_get_content_object((CamelMedium *)sigpart), (CamelStream *)mem);
- (void)NSS_CMSDecoder_Update(dec, mem->buffer->data, mem->buffer->len);
+ (void)NSS_CMSDecoder_Update(dec, (char *) mem->buffer->data, mem->buffer->len);
cmsg = NSS_CMSDecoder_Finish(dec);
if (cmsg == NULL) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Decoder failed"));
/* FIXME: Canonicalise the input? */
mem = (CamelStreamMem *)camel_stream_mem_new();
camel_data_wrapper_write_to_stream((CamelDataWrapper *)ipart, (CamelStream *)mem);
- if (NSS_CMSEncoder_Update(enc, mem->buffer->data, mem->buffer->len) != SECSuccess) {
+ if (NSS_CMSEncoder_Update(enc, (char *) mem->buffer->data, mem->buffer->len) != SECSuccess) {
NSS_CMSEncoder_Cancel(enc);
camel_object_unref(mem);
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to add data to encoder"));
NULL, NULL,
NULL, NULL); /* decrypt key callback */
- if (NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len) != SECSuccess) {
+ if (NSS_CMSDecoder_Update(dec, (char *) istream->buffer->data, istream->buffer->len) != SECSuccess) {
printf("decoder update failed\n");
}
camel_object_unref(istream);
CAMEL_SMIME_SIGNED = 1<<0,
CAMEL_SMIME_ENCRYPTED = 1<<1,
CAMEL_SMIME_CERTS = 1<<2,
- CAMEL_SMIME_CRLS = 1<<3,
+ CAMEL_SMIME_CRLS = 1<<3
} camel_smime_describe_t;
typedef struct _CamelSMIMEContext CamelSMIMEContext;
io(printf("** open error: %s\n", strerror (errno)));
return -1;
}
+
out = fdopen(fd, "wb");
if ( out == NULL ) {
i = errno;
{
CamelStoreInfo *info;
- CAMEL_STORE_SUMMARY_LOCK(s, alloc_lock);
- if (s->store_info_chunks == NULL)
- s->store_info_chunks = e_memchunk_new(32, s->store_info_size);
- info = e_memchunk_alloc0(s->store_info_chunks);
- CAMEL_STORE_SUMMARY_UNLOCK(s, alloc_lock);
+ info = g_slice_alloc0(s->store_info_size);
info->refcount = 1;
return info;
}
{
g_free(info->path);
g_free(info->uri);
- e_memchunk_free(s->store_info_chunks, info);
+ g_slice_free1(s->store_info_size, info);
}
static const char *
CAMEL_STORE_INFO_PATH = 0,
CAMEL_STORE_INFO_NAME,
CAMEL_STORE_INFO_URI,
- CAMEL_STORE_INFO_LAST,
+ CAMEL_STORE_INFO_LAST
};
struct _CamelStoreInfo {
typedef enum _CamelStoreSummaryFlags {
CAMEL_STORE_SUMMARY_DIRTY = 1<<0,
- CAMEL_STORE_SUMMARY_FRAGMENT = 1<<1, /* path name is stored in fragment rather than path */
+ CAMEL_STORE_SUMMARY_FRAGMENT = 1<<1 /* path name is stored in fragment rather than path */
} CamelStoreSummaryFlags;
struct _CamelStoreSummary {
{
CamelFolder *folder = NULL;
+ g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
g_return_val_if_fail (folder_name != NULL, NULL);
/* O_EXCL doesn't make sense if we aren't requesting to also create the folder if it doesn't exist */
if (camel_debug_start(":store")) {
char *u = camel_url_to_string(((CamelService *)store)->url, CAMEL_URL_HIDE_PASSWORD);
- printf("CamelStore('%s'):get_folder('%s', %u) = %p\n", u, folder_name, flags, folder);
+ printf("CamelStore('%s'):get_folder('%s', %u) = %p\n", u, folder_name, flags, (void *) folder);
if (ex && ex->id)
printf(" failed: '%s'\n", ex->desc);
g_free(u);
g_free (vinfo->uri);
} else {
/* There wasn't a Trash/Junk folder so create a new folder entry */
- vinfo = g_new0 (CamelFolderInfo, 1);
+ vinfo = camel_folder_info_new ();
g_assert(parent != NULL);
if (camel_debug_start("store:folder_info")) {
char *url = camel_url_to_string(((CamelService *)store)->url, CAMEL_URL_HIDE_ALL);
- printf("Get folder info(%p:%s, '%s') =\n", store, url, top?top:"<null>");
+ printf("Get folder info(%p:%s, '%s') =\n", (void *) store, url, top?top:"<null>");
g_free(url);
dump_fi(info, 2);
camel_debug_end();
g_free (fi->name);
g_free (fi->full_name);
g_free (fi->uri);
- g_free (fi);
+ g_slice_free (CamelFolderInfo, fi);
}
}
+/**
+ * camel_folder_info_new:
+ *
+ * Return value: a new empty CamelFolderInfo instance
+ **/
+CamelFolderInfo *
+camel_folder_info_new (void)
+{
+ return g_slice_new0 (CamelFolderInfo);
+}
+
static int
folder_info_cmp (const void *ap, const void *bp)
{
CamelURL *url;
char *sep;
- pfi = g_new0 (CamelFolderInfo, 1);
+ pfi = camel_folder_info_new ();
if (short_names) {
pfi->name = strrchr (pname, separator);
if (pfi->name)
{
CamelFolderInfo *info;
- info = g_malloc(sizeof(*info));
+ info = camel_folder_info_new ();
info->parent = parent;
info->uri = g_strdup(fi->uri);
info->name = g_strdup(fi->name);
G_BEGIN_DECLS
enum {
- CAMEL_STORE_ARG_FIRST = CAMEL_SERVICE_ARG_FIRST + 100,
+ CAMEL_STORE_ARG_FIRST = CAMEL_SERVICE_ARG_FIRST + 100
};
typedef struct _CamelFolderInfo {
void camel_store_free_folder_info_nop (CamelStore *store,
CamelFolderInfo *fi);
+CamelFolderInfo *camel_folder_info_new (void);
void camel_folder_info_free (CamelFolderInfo *fi);
CamelFolderInfo *camel_folder_info_build (GPtrArray *folders,
const char *namespace,
static CamelStreamClass *parent_class = NULL;
enum {
- BUF_USER = 1<<0, /* user-supplied buffer, do not free */
+ BUF_USER = 1<<0 /* user-supplied buffer, do not free */
};
#define BUF_SIZE 1024
g_free(sbf->buf);
}
if (buf) {
- sbf->buf = buf;
+ sbf->buf = (unsigned char *) buf;
sbf->flags |= BUF_USER;
} else {
sbf->buf = g_malloc(size);
bptr += bytes_read;
}
} else {
- bytes_read = camel_stream_read(sbf->stream, sbf->buf, sbf->size);
+ bytes_read = camel_stream_read(sbf->stream, (char *) sbf->buf, sbf->size);
if (bytes_read>0) {
size_t bytes_used = bytes_read > n ? n : bytes_read;
sbf->ptr = sbf->buf;
/* if we've filled the buffer, write it out, reset buffer */
if (left == todo) {
- if (stream_write_all(sbf->stream, sbf->buf, sbf->size) == -1)
+ if (stream_write_all(sbf->stream, (const char *) sbf->buf, sbf->size) == -1)
return -1;
sbf->ptr = sbf->buf;
if ((sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE) {
size_t len = sbf->ptr - sbf->buf;
- if (camel_stream_write (sbf->stream, sbf->buf, len) == -1)
+ if (camel_stream_write (sbf->stream, (const char *) sbf->buf, len) == -1)
return -1;
sbf->ptr = sbf->buf;
int bytes_read;
outptr = buf;
- inptr = sbf->ptr;
- inend = sbf->end;
+ inptr = (char *) sbf->ptr;
+ inend = (char *) sbf->end;
outend = buf+max-1; /* room for NUL */
do {
*outptr++ = c;
if (c == '\n') {
*outptr = 0;
- sbf->ptr = inptr;
+ sbf->ptr = (unsigned char *) inptr;
return outptr-buf;
}
}
if (outptr == outend)
break;
- bytes_read = camel_stream_read (sbf->stream, sbf->buf, sbf->size);
+ bytes_read = camel_stream_read (sbf->stream, (char *) sbf->buf, sbf->size);
if (bytes_read == -1) {
if (buf == outptr)
return -1;
else
bytes_read = 0;
}
- inptr = sbf->ptr = sbf->buf;
- inend = sbf->end = sbf->buf + bytes_read;
+ sbf->ptr = sbf->buf;
+ sbf->end = sbf->buf + bytes_read;
+ inptr = (char *) sbf->ptr;
+ inend = (char *) sbf->end;
} while (bytes_read>0);
- sbf->ptr = inptr;
+ sbf->ptr = (unsigned char *) inptr;
*outptr = 0;
return (int)(outptr - buf);
p = sbf->linebuf;
while (1) {
- nread = camel_stream_buffer_gets (sbf, p, sbf->linesize - (p - sbf->linebuf));
+ nread = camel_stream_buffer_gets (sbf, (char *) p, sbf->linesize - (p - sbf->linebuf));
if (nread <=0) {
if (p > sbf->linebuf)
break;
p--;
p[0] = 0;
- return g_strdup(sbf->linebuf);
+ return g_strdup((char *) sbf->linebuf);
}
timeout.tv_sec = 0;
timeout.tv_usec = TIMEOUT_USEC;
+
select (fdmax, &rdset, 0, 0, &timeout);
if (FD_ISSET (cancel_fd, &rdset)) {
fcntl (openssl->priv->sockfd, F_SETFL, flags);
fcntl (openssl->priv->sockfd, F_SETFL, flags | O_NONBLOCK);
fdmax = MAX (openssl->priv->sockfd, cancel_fd) + 1;
+
do {
FD_ZERO (&rdset);
FD_ZERO (&wrset);
md5len = sizeof (md5sum);
X509_digest (cert, EVP_md5 (), md5sum, &md5len);
for (i = 0, f = fingerprint; i < 16; i++, f += 3)
- sprintf (f, "%.2x%c", md5sum[i], i != 15 ? ':' : '\0');
+ sprintf ((char *) f, "%.2x%c", md5sum[i], i != 15 ? ':' : '\0');
#define GET_STRING(name) X509_NAME_oneline (name, buf, 256)
certdb = camel_certdb_get_default ();
if (certdb) {
- ccert = camel_certdb_get_cert (certdb, fingerprint);
+ ccert = camel_certdb_get_cert (certdb, (const char *) fingerprint);
if (ccert) {
if (ccert->trust != CAMEL_CERT_TRUST_UNKNOWN) {
ok = ccert->trust != CAMEL_CERT_TRUST_NEVER;
ccert = camel_certdb_cert_new (certdb);
camel_cert_set_issuer (certdb, ccert, GET_STRING (X509_get_issuer_name (cert)));
camel_cert_set_subject (certdb, ccert, GET_STRING (X509_get_subject_name (cert)));
- camel_cert_set_hostname (certdb, ccert, stream->priv->expected_host);
- camel_cert_set_fingerprint (certdb, ccert, fingerprint);
+ camel_cert_set_hostname (certdb, ccert, (const char *) stream->priv->expected_host);
+ camel_cert_set_fingerprint (certdb, ccert, (const char *) fingerprint);
camel_cert_set_trust (certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN);
/* Add the certificate to our db */
get_sockopt_level (data),
optname,
(void *) &data->value,
- &optlen);
+ (socklen_t *) &optlen);
}
static int
get_sockopt_level (data),
optname,
(void *) &data->value,
- &optlen);
+ (socklen_t *) &optlen);
}
static int
return -1;
}
- if (SSL_ForceHandshake (fd) == -1) {
+ if (SSL_ForceHandshake (fd) == SECFailure) {
set_errno (PR_GetError ());
return -1;
}
int i;
const char tohex[16] = "0123456789abcdef";
- md5_get_digest (cert->derCert.data, cert->derCert.len, md5sum);
+ md5_get_digest ((const char *) cert->derCert.data, cert->derCert.len, md5sum);
for (i=0,f = fingerprint; i<16; i++) {
unsigned int c = md5sum[i];
fingerprint[47] = 0;
- return g_strdup(fingerprint);
+ return g_strdup((char*) fingerprint);
}
/* lookup a cert uses fingerprint to index an on-disk file */
stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (stream != NULL) {
- if (camel_stream_write (stream, ccert->rawcert->data, ccert->rawcert->len) == -1) {
+ if (camel_stream_write (stream, (const char *) ccert->rawcert->data, ccert->rawcert->len) == -1) {
g_warning ("Could not save cert: %s: %s", path, strerror (errno));
g_unlink (path);
}
return NULL;
SSL_OptionSet (ssl_fd, SSL_SECURITY, PR_TRUE);
+
if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_SSL2) {
SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL2, PR_TRUE);
SSL_OptionSet (ssl_fd, SSL_V2_COMPATIBLE_HELLO, PR_TRUE);
SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL2, PR_FALSE);
SSL_OptionSet (ssl_fd, SSL_V2_COMPATIBLE_HELLO, PR_FALSE);
}
+
if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL3, PR_TRUE);
else
SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL3, PR_FALSE);
+
if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
SSL_OptionSet (ssl_fd, SSL_ENABLE_TLS, PR_TRUE);
else
CamelTextIndexNamePrivate *p = CIN_PRIVATE(idn);
const unsigned char *ptr, *ptrend;
guint32 c;
- unsigned char utf8[8];
- size_t utf8len;
+ char utf8[8];
+ int utf8len;
if (buffer == NULL) {
if (p->buffer->len) {
return 0;
}
- ptr = buffer;
- ptrend = buffer+len;
+ ptr = (const unsigned char *) buffer;
+ ptrend = (const unsigned char *) buffer+len;
while ((c = camel_utf8_next(&ptr, ptrend))) {
if (g_unichar_isalnum(c)) {
c = g_unichar_tolower(c);
G_BEGIN_DECLS
enum {
- CAMEL_TRANSPORT_ARG_FIRST = CAMEL_SERVICE_ARG_FIRST + 100,
+ CAMEL_TRANSPORT_ARG_FIRST = CAMEL_SERVICE_ARG_FIRST + 100
};
struct _CamelTransport
IS_SPACE = (1 << 4),
IS_SPECIAL = (1 << 5),
IS_DOMAIN = (1 << 6),
- IS_URLSAFE = (1 << 7),
+ IS_URLSAFE = (1 << 7)
};
#define is_ctrl(x) ((url_scanner_table[(unsigned char)(x)] & IS_CTRL) != 0)
#ifdef G_OS_WIN32
if (url->protocol && !strcmp(url->protocol, "file"))
return g_filename_to_uri(url->path, url->host, NULL);
-#endif
+#endif /* G_OS_WIN32 */
str = g_string_sized_new (20);
g_return_val_if_fail (in != NULL, NULL);
- out = g_malloc(sizeof(*out));
+ out = g_malloc0(sizeof(*out));
out->protocol = g_strdup(in->protocol);
out->user = g_strdup(in->user);
out->authmech = g_strdup(in->authmech);
camel_utf8_putc(&p, c);
*p = 0;
- g_string_append(out, (gchar *) buffer);
+ g_string_append(out, (const char *) buffer);
}
static const char utf7_alphabet[] =
{
MD5Context ctx;
unsigned char digest[16];
- unsigned int state = 0, save = 0;
+ int state = 0, save = 0;
char *tmp;
int i;
md5_init(&ctx);
tmp = camel_service_get_url((CamelService *)folder->parent_store);
- md5_update(&ctx, tmp, strlen(tmp));
+ md5_update(&ctx, (unsigned char*) tmp, strlen(tmp));
g_free(tmp);
- md5_update(&ctx, folder->full_name, strlen(folder->full_name));
+ md5_update(&ctx, (unsigned char*)folder->full_name, strlen(folder->full_name));
md5_final(&ctx, digest);
+
g_base64_encode_step(digest, 6, FALSE, buffer, &state, &save);
g_base64_encode_close(FALSE, buffer, &state, &save);
g_hash_table_insert(matches_hash, matches_changed->pdata[i], matches_changed->pdata[i]);
}
dd(printf("\n"));
+
for (i=0;i<changed->len;i++) {
uid = changed->pdata[i];
if (strlen(uid)+9 > vuidlen) {
const char *tmp;
CamelURL *url;
- fi = g_malloc0(sizeof(*fi));
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup(name);
tmp = strrchr(name, '/');
if (tmp == NULL)
if ((flags & CAMEL_STORE_FOLDER_INFO_FAST) == 0)
camel_folder_refresh_info((CamelFolder *)folder, NULL);
- info = g_malloc0(sizeof(*info));
+ info = camel_folder_info_new();
url = camel_url_new("vfolder:", NULL);
camel_url_set_path(url, ((CamelService *)((CamelFolder *)folder)->parent_store)->url->path);
camel_url_set_fragment(url, ((CamelFolder *)folder)->full_name);
/* and always add UNMATCHED, if scanning from top/etc */
if (top == NULL || top[0] == 0 || strncmp(top, CAMEL_UNMATCHED_NAME, strlen(CAMEL_UNMATCHED_NAME)) == 0) {
- info = g_malloc0(sizeof(*info));
+ info = camel_folder_info_new ();
url = camel_url_new("vfolder:", NULL);
camel_url_set_path(url, ((CamelService *)store)->url->path);
camel_url_set_fragment(url, CAMEL_UNMATCHED_NAME);
+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-09-29 Kjartan Maraas <kmaraas@gnome.org>
* camel-groupwise-folder.c: (gw_update_cache), (gw_update_summary),
CamelFolderInfo *fi;
CamelGroupwiseStorePrivate *priv = gw_store->priv;
- fi = g_malloc0(sizeof(*fi));
+ fi = camel_folder_info_new();
fi->unread = -1;
fi->total = -1;
id = e_gw_container_get_id (container);
type = e_gw_container_get_container_type (container);
- fi = g_new0 (CamelFolderInfo, 1);
+ fi = camel_folder_info_new ();
if (type == E_GW_CONTAINER_TYPE_INBOX)
fi->flags |= CAMEL_FOLDER_TYPE_INBOX;
+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-11-12 Milan Crha <mcrha@redhat.com>
** Fix for bug #495086
struct _CamelImapFolder {
CamelDiscoFolder parent_object;
- struct _CamelImapFolderPrivate *priv;
+ struct _CamelImapFolderPrivate *priv;
CamelFolderSearch *search;
CamelImapMessageCache *cache;
#endif
path = g_strdup_printf ("%s/%s.%s", cache->path, uid, part_spec);
key = strrchr (path, '/') + 1;
+
stream = g_hash_table_lookup (cache->parts, key);
if (stream) {
camel_stream_reset (CAMEL_STREAM (stream));
{
MD5Context ctx;
unsigned char digest[16];
- unsigned int state = 0, save = 0;
+ int state = 0, save = 0;
int i;
md5_init(&ctx);
for (i=0;i<argc;i++) {
if (argv[i]->type == ESEXP_RES_STRING)
- md5_update(&ctx, argv[i]->value.string, strlen(argv[i]->value.string));
+ md5_update(&ctx, (const guchar *) argv[i]->value.string, strlen(argv[i]->value.string));
}
md5_final(&ctx, digest);
/* TODO: Handle multiple search terms */
/* This handles multiple search words within a single term */
- words = camel_search_words_split (mr->terms[0]);
+ words = camel_search_words_split ((const unsigned char *) mr->terms[0]);
search = g_string_new ("");
g_string_append_printf (search, "UID %d:%d", mr->lastuid + 1, is->lastuid);
for (i = 0; i < words->len; i++) {
enum {
CAMEL_IMAP_STORE_INFO_FULL_NAME = CAMEL_STORE_INFO_LAST,
- CAMEL_IMAP_STORE_INFO_LAST,
+ CAMEL_IMAP_STORE_INFO_LAST
};
struct _CamelImapStoreInfo {
disco->diary = NULL;
}
- if (imap_store->custom_headers)
- g_free (imap_store->custom_headers);
+ g_free (imap_store->custom_headers);
}
static void
enum {
MODE_CLEAR,
MODE_SSL,
- MODE_TLS,
+ MODE_TLS
};
#ifdef HAVE_SSL
if (ssl_mode != MODE_CLEAR) {
#ifdef HAVE_SSL
- if (ssl_mode == MODE_TLS) {
+ if (ssl_mode == MODE_TLS)
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
- } else {
+ else
tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
- }
#else
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to %s: %s"),
- service->url->host, _("SSL unavailable"));
+ _("Could not connect to %s: %s"),
+ service->url->host, _("SSL unavailable"));
return FALSE;
+
#endif /* HAVE_SSL */
- } else {
+ } else
tcp_stream = camel_tcp_stream_raw_new ();
- }
if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai) == -1) {
if (errno == EINTR)
#ifdef HAVE_SSL
if (!(store->capabilities & IMAP_CAPABILITY_STARTTLS)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to IMAP server %s in secure mode: %s"),
- service->url->host, _("STARTTLS not supported"));
+ _("Failed to connect to IMAP server %s in secure mode: %s"),
+ service->url->host, _("STARTTLS not supported"));
goto exception;
}
if (store->capabilities & IMAP_CAPABILITY_LOGINDISABLED ) {
clean_quit = TRUE;
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to IMAP server %s in secure mode: %s"), service->url->host, _("Unknown error"));
+ _("Failed to connect to IMAP server %s in secure mode: %s"),
+ service->url->host, _("Unknown error"));
goto exception;
}
return TRUE;
- exception:
+exception:
if (clean_quit && store->connected) {
/* try to disconnect cleanly */
store->connected = FALSE;
return FALSE;
}
+
if (!strncmp(buf, "* PREAUTH", 9))
store->preauthed = TRUE;
g_free (buf);
&& (command = camel_url_get_param(service->url, "command")))
return connect_to_server_process(service, command, ex);
#endif
+
if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) {
for (i = 0; ssl_options[i].value; i++)
if (!strcmp (ssl_options[i].value, ssl_mode))
const char *name;
CamelFolderInfo *fi;
- fi = g_malloc0(sizeof(*fi));
-
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup(folder_name);
fi->unread = -1;
fi->total = -1;
if (service->url->authmech) {
if (!g_hash_table_lookup (store->authtypes, service->url->authmech)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("IMAP server %s does not support requested "
- "authentication type %s"),
- service->url->host,
- service->url->authmech);
+ _("IMAP server %s does not support requested "
+ "authentication type %s"),
+ service->url->host,
+ service->url->authmech);
return FALSE;
}
char *prompt;
prompt = g_strdup_printf (_("%sPlease enter the IMAP "
- "password for %s@%s"),
- errbuf ? errbuf : "",
- service->url->user,
- service->url->host);
+ "password for %s@%s"),
+ errbuf ? errbuf : "",
+ service->url->user,
+ service->url->host);
+
service->url->passwd =
camel_session_get_password (session, service, auth_domain,
- prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+ prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
g_free (prompt);
g_free (errbuf);
errbuf = NULL;
if (!service->url->passwd) {
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
- _("You did not enter a password."));
+ _("You did not enter a password."));
return FALSE;
}
}
if (!store->connected) {
/* Some servers (eg, courier) will disconnect on
- * a bad password. So reconnect here.
- */
+ * a bad password. So reconnect here. */
if (!connect_to_server_wrapper (service, ex))
return FALSE;
}
return FALSE;
errbuf = g_strdup_printf (_("Unable to authenticate "
- "to IMAP server.\n%s\n\n"),
- camel_exception_get_description (ex));
+ "to IMAP server.\n%s\n\n"),
+ camel_exception_get_description (ex));
camel_exception_clear (ex);
}
}
imap_parse_list_response (store, result, NULL, &store->dir_sep, NULL);
g_free (result);
}
- if (!store->dir_sep) {
+
+ if (!store->dir_sep)
store->dir_sep = '/'; /* Guess */
- }
+
}
/* canonicalize the namespace to end with dir_sep */
goto done;
get_folders_sync(store, "INBOX", ex);
}
+
store->refresh_stamp = time(NULL);
}
-
- done:
+done:
/* save any changes we had */
camel_store_summary_save((CamelStoreSummary *)store->summary);
return FALSE;
store->connected = !camel_exception_is_set (ex);
+
return store->connected;
}
camel_object_unref (imap_store->current_folder);
imap_store->current_folder = NULL;
}
+
response = camel_imap_command (imap_store, NULL, ex, "SELECT %F", folder_name);
if (!response) {
char *folder_real, *parent_name, *parent_real;
flags = (flags & ~CAMEL_FOLDER_SUBSCRIBED) | (si->info.flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED);
- fi = g_new0 (CamelFolderInfo, 1);
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup(camel_store_info_path(imap_store->summary, si));
if (!g_ascii_strcasecmp(fi->full_name, "inbox")) {
flags |= CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_TYPE_INBOX;
/* We do a LIST followed by LSUB, and merge the results. LSUB may not be a strict
subset of LIST for some servers, so we can't use either or separately */
present = g_hash_table_new(folder_hash, folder_eq);
+
for (j=0;j<2;j++) {
response = camel_imap_command (imap_store, NULL, ex,
"%s \"\" %G", j==1 ? "LSUB" : "LIST",
if (fi) {
hfi = g_hash_table_lookup(present, fi->full_name);
if (hfi == NULL) {
- if (j==1) {
+ if (j == 1) {
fi->flags |= CAMEL_STORE_INFO_FOLDER_SUBSCRIBED;
if ((fi->flags & (CAMEL_IMAP_FOLDER_MARKED | CAMEL_IMAP_FOLDER_UNMARKED)))
imap_store->capabilities |= IMAP_CAPABILITY_useful_lsub;
/* FIXME: we need to emit folder_create/subscribed/etc events for any new folders */
count = camel_store_summary_count((CamelStoreSummary *)imap_store->summary);
+
for (i=0;i<count;i++) {
si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
if (si == NULL)
/* folder_info_build will insert parent nodes as necessary and mark
* them as noselect, which is information we actually don't have at
* the moment. So let it do the right thing by bailing out if it's
- * not a folder we're explicitly interested in.
- */
+ * not a folder we're explicitly interested in. */
for (i=0;i<camel_store_summary_count((CamelStoreSummary *)imap_store->summary);i++) {
CamelStoreInfo *si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
&& ((imap_store->parameters & IMAP_PARAM_SUBSCRIPTIONS) == 0
|| (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) == 0
|| (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED))) {
+
fi = imap_build_folder_info(imap_store, camel_store_info_path((CamelStoreSummary *)imap_store->summary, si));
fi->unread = si->unread;
fi->total = si->total;
ba = g_byte_array_new ();
while ((nread = camel_stream_buffer_gets (stream, linebuf, sizeof (linebuf))) > 0) {
- g_byte_array_append (ba, linebuf, nread);
+ g_byte_array_append (ba, (const guint8 *) linebuf, nread);
if (linebuf[nread - 1] == '\n')
break;
}
CAMEL_IMAP_STORE_ARG_CHECK_ALL,
CAMEL_IMAP_STORE_ARG_FILTER_INBOX,
CAMEL_IMAP_STORE_ARG_FILTER_JUNK,
- CAMEL_IMAP_STORE_ARG_FILTER_JUNK_INBOX,
+ CAMEL_IMAP_STORE_ARG_FILTER_JUNK_INBOX
};
#define CAMEL_IMAP_STORE_NAMESPACE (CAMEL_IMAP_STORE_ARG_NAMESPACE | CAMEL_ARG_STR)
}
/* decode IMAP's modified UTF-7 into UTF-8 */
- node->prefix = imap_mailbox_decode (astring, len);
+ node->prefix = imap_mailbox_decode ((const unsigned char *) astring, len);
g_free (astring);
if (!node->prefix) {
g_free (node);
*folder = astring;
- mailbox = imap_mailbox_decode (astring, strlen (astring));
+ mailbox = imap_mailbox_decode ((const unsigned char *) astring, strlen (astring));
g_free (astring);
if (!mailbox)
return FALSE;
/* size */
size = strtoul ((const char *) inptr, &p, 10);
+
/* check if the size wasn't negative */
if (p) {
while (inptr < p && *inptr != '-')
+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-06-04 Jeffrey Stedfast <fejj@gnome.org>
* camel-imap4-summary.c (imap4_fetch_all_update): Don't iterate
CamelFolderInfo *fi;
const char *name;
- fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (camel_store_info_path (s, si));
fi->uri = g_strdup (camel_store_info_uri (s, si));
fi->flags = si->flags;
c = strrchr (folder_name, '/');
- fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->name = g_strdup (c ? c + 1: folder_name);
fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
p = strrchr (folder_name, '/');
- fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->name = g_strdup (p ? p + 1: folder_name);
fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
- fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi = camel_folder_info_new ();
p = name = camel_utf7_utf8 (list->name);
while (*p != '\0') {
p = strrchr (folder_name, '/');
- fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->name = g_strdup (p ? p + 1: folder_name);
fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
p = strrchr (folder_name, '/');
- fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->name = g_strdup (p ? p + 1: folder_name);
fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
static void
camel_imap4_summary_finalize (CamelObject *object)
{
- ;
}
sprintf(path, "/%s", full_name);
camel_url_set_path(base, path);
- fi = g_malloc0(sizeof(*fi));
+ fi = camel_folder_info_new();
fi->uri = camel_url_to_string(base, CAMEL_URL_HIDE_ALL);
fi->name = g_strdup(name);
fi->full_name = full_name;
CamelURL *uri = camel_url_copy(((CamelService *)store)->url);
camel_url_set_path(uri, "/INBOX");
- fi = g_malloc0(sizeof(*fi));
+ fi = camel_folder_info_new();
fi->url = camel_url_to_string(uri, CAMEL_URL_HIDE_ALL);
camel_url_free(uri);
fi->name = g_strdup("INBOX");
+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-09-07 Kjartan Maraas <kmaraas@gnome.org>
* camel-maildir-summary.c: (maildir_summary_next_uid_string),
folder->summary = NULL;
}
- if (local_folder->search) {
+ if (local_folder->search)
camel_object_unref((CamelObject *)local_folder->search);
- }
if (local_folder->index)
camel_object_unref((CamelObject *)local_folder->index);
url = camel_url_copy (((CamelService *) parent_store)->url);
camel_url_set_fragment (url, full_name);
- fi = g_new0 (CamelFolderInfo, 1);
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (full_name);
fi->name = g_strdup (name);
fi->uri = camel_url_to_string (url, 0);
};
enum {
- CAMEL_LOCAL_FOLDER_INDEX_BODY = CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY | CAMEL_ARG_BOO,
+ CAMEL_LOCAL_FOLDER_INDEX_BODY = CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY | CAMEL_ARG_BOO
};
typedef struct {
#include "camel-local-folder.h"
#include "camel-local-store.h"
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
+#define d(x)
/* Returns the class for a CamelLocalStore */
#define CLOCALS_CLASS(so) CAMEL_LOCAL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
g_free(oldibex);
if (folder)
- camel_object_unref(folder);
+ camel_object_unref (folder);
return;
g_free (str);
g_free (name);
- fi = g_new0 (CamelFolderInfo, 1);
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (folder_name);
fi->name = g_path_get_basename (folder_name);
fi->uri = g_strdup_printf ("%s:%s#%s", ((CamelService *) store)->url->protocol,
enum {
CAMEL_MESSAGE_FOLDER_NOXEV = 1<<17,
CAMEL_MESSAGE_FOLDER_XEVCHANGE = 1<<18,
- CAMEL_MESSAGE_FOLDER_NOTSEEN = 1<<19, /* have we seen this in processing this loop? */
+ CAMEL_MESSAGE_FOLDER_NOTSEEN = 1<<19 /* have we seen this in processing this loop? */
};
typedef struct _CamelLocalMessageInfo CamelLocalMessageInfo;
g_free (dest);
}
-static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
+static CamelMimeMessage *
+maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
{
CamelLocalFolder *lf = (CamelLocalFolder *)folder;
CamelStream *message_stream = NULL;
char *tmp, *cur, *new;
struct stat st;
- fi = g_malloc0(sizeof(*fi));
+ fi = camel_folder_info_new();
fi->full_name = g_strdup(full);
fi->name = g_strdup(name);
camel_url_set_fragment(url, fi->full_name);
fi->uri = camel_url_to_string(url, 0);
+
fi->unread = -1;
fi->total = -1;
+
/* we only calculate nochildren properly if we're recursive */
if (((flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) != 0))
fi->flags = CAMEL_FOLDER_NOCHILDREN;
*
* Return value: A new #CamelMaildirSummary object.
**/
-CamelMaildirSummary *camel_maildir_summary_new(struct _CamelFolder *folder, const char *filename, const char *maildirdir, CamelIndex *index)
+CamelMaildirSummary
+*camel_maildir_summary_new(struct _CamelFolder *folder, const char *filename, const char *maildirdir, CamelIndex *index)
{
CamelMaildirSummary *o = (CamelMaildirSummary *)camel_object_new(camel_maildir_summary_get_type ());
if (info->info.info.flags & flagbits[i].flagbit)
*p++ = flagbits[i].flag;
}
+
*p = 0;
return g_strdup(buf);
/*guint32 all = 0;*/ /* all flags */
int i;
- p = strstr(name, ":2,");
+ p = strstr (name, ":2,");
+
if (p) {
p+=3;
while ((c = *p++)) {
/* we could assume that the flags are in order, but its just as easy not to require */
- for (i=0;i<sizeof(flagbits)/sizeof(flagbits[0]);i++) {
+ for (i=0; i < sizeof(flagbits)/sizeof(flagbits[0]);i++) {
if (flagbits[i].flag == c && (info->info.info.flags & flagbits[i].flagbit) == 0) {
set |= flagbits[i].flagbit;
}
/* FIXME:
both 'new' and 'add' will try and set the filename, this is not ideal ...
*/
-static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *changes, CamelException *ex)
+static CamelMessageInfo *
+maildir_summary_add (CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *changes, CamelException *ex)
{
CamelMaildirMessageInfo *mi;
}
-static void message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
+static void
+message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
{
#if !defined (DOEPOOLV) && !defined (DOESTRV)
CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *)mi;
dir = opendir(cur);
if (dir == NULL) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot open maildir directory path: %s: %s"),
- cls->folder_path, g_strerror (errno));
+ _("Cannot open maildir directory path: %s: %s"),
+ cls->folder_path, g_strerror (errno));
g_free(cur);
return -1;
}
return ret;
}
-static int camel_maildir_summary_add(CamelLocalSummary *cls, const char *name, int forceindex)
+static int
+camel_maildir_summary_add (CamelLocalSummary *cls, const char *name, int forceindex)
{
CamelMaildirSummary *maildirs = (CamelMaildirSummary *)cls;
char *filename = g_strdup_printf("%s/cur/%s", cls->folder_path, name);
dir = opendir(cur);
if (dir == NULL) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot open maildir directory path: %s: %s"),
- cls->folder_path, g_strerror (errno));
+ _("Cannot open maildir directory path: %s: %s"),
+ cls->folder_path, g_strerror (errno));
g_free(cur);
g_free(new);
camel_operation_end(NULL);
info = camel_folder_summary_uid((CamelFolderSummary *)cls, uid);
if (info == NULL) {
/* must be a message incorporated by another client, this is not a 'recent' uid */
- if (camel_maildir_summary_add(cls, d->d_name, forceindex) == 0)
+ if (camel_maildir_summary_add (cls, d->d_name, forceindex) == 0)
if (changes)
camel_folder_change_info_add_uid(changes, uid);
} else {
/* FIXME: This should probably use link/unlink */
if (rename(src, dest) == 0) {
- camel_maildir_summary_add(cls, destfilename, forceindex);
+ camel_maildir_summary_add (cls, destfilename, forceindex);
if (changes) {
camel_folder_change_info_add_uid(changes, destname);
camel_folder_change_info_recent_uid(changes, destname);
enum {
CAMEL_MAILDIR_INFO_FILENAME = CAMEL_MESSAGE_INFO_LAST,
- CAMEL_MAILDIR_INFO_LAST,
+ CAMEL_MAILDIR_INFO_LAST
};
typedef struct _CamelMaildirMessageInfo {
g_free(path);
g_free(name);
- fi = g_new0(CamelFolderInfo, 1);
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup(folder_name);
fi->name = g_path_get_basename(folder_name);
fi->uri = g_strdup_printf("mbox:%s#%s",((CamelService *) store)->url->path, folder_name);
fi->flags &= ~CAMEL_FOLDER_NOSELECT;
}
} else {
- fi = g_new0(CamelFolderInfo, 1);
+ fi = camel_folder_info_new ();
fi->parent = parent;
camel_url_set_fragment (url, full_name);
url = camel_url_copy (((CamelService *) store)->url);
camel_url_set_fragment (url, top);
- fi = g_new0(CamelFolderInfo, 1);
+ fi = camel_folder_info_new ();
fi->parent = NULL;
fi->uri = camel_url_to_string (url, 0);
fi->name = basename;
io(printf("saving mbox message info\n"));
if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_save(s, out, mi) == -1
- || camel_file_util_encode_off_t(out, mbi->frompos) == -1)
+ || camel_file_util_encode_off_t (out, mbi->frompos) == -1)
return -1;
return 0;
}
#endif
if (len == -1) {
- d(printf("Writing to temporary mailbox failed\n"));
+ d(printf("Error writing to temporary mailbox\n"));
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Writing to temporary mailbox failed: %s"),
g_strerror (errno));
UPDATE_NONE,
UPDATE_ADD,
UPDATE_REMOVE,
- UPDATE_RENAME,
+ UPDATE_RENAME
};
/* update the .folders file if it exists, or create it if it doesn't */
camel_url_set_fragment (url, path);
/* Build the folder info structure. */
- fi = g_malloc0(sizeof(*fi));
+ fi = camel_folder_info_new();
fi->uri = camel_url_to_string (url, 0);
fi->full_name = g_strdup(path);
fi->name = g_strdup(base?base+1:path);
G_BEGIN_DECLS
enum {
- CAMEL_MH_DOTFOLDERS = (1<<0), /* update/use .folders file */
+ CAMEL_MH_DOTFOLDERS = (1<<0) /* update/use .folders file */
};
typedef struct {
else
name = full;
- fi = g_malloc0(sizeof(*fi));
+ fi = camel_folder_info_new();
url = camel_url_copy(((CamelService *)store)->url);
camel_url_set_fragment(url, full);
fi->uri = camel_url_to_string(url, 0);
typedef enum _camel_spool_store_t {
CAMEL_SPOOL_STORE_MBOX, /* a single mbox */
- CAMEL_SPOOL_STORE_ELM, /* elm/pine/etc tree of mbox files in folders */
+ CAMEL_SPOOL_STORE_ELM /* elm/pine/etc tree of mbox files in folders */
} camel_spool_store_t;
typedef struct {
+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-05-14 Jules Colding <colding@omesc.com>
* camel-nntp-newsrc.c (camel_nntp_newsrc_read_for_server): Fix file descriptor leak
enum {
CAMEL_NNTP_STORE_INFO_FULL_NAME = CAMEL_STORE_INFO_LAST,
- CAMEL_NNTP_STORE_INFO_LAST,
+ CAMEL_NNTP_STORE_INFO_LAST
};
struct _CamelNNTPStoreInfo {
/* supported command */
while ((ret = camel_nntp_stream_line(store->stream, (unsigned char **)&line, &len)) > 0) {
- p = line;
+ p = (unsigned char *) line;
xover = g_malloc0(sizeof(*xover));
last->next = xover;
last = xover;
for (i=0;i<sizeof(headers)/sizeof(headers[0]);i++) {
if (strcmp(line, headers[i].name) == 0) {
xover->name = headers[i].name;
- if (strncmp(p, "full", 4) == 0)
+ if (strncmp((char *) p, "full", 4) == 0)
xover->skip = strlen(xover->name)+1;
else
xover->skip = 0;
enum {
MODE_CLEAR,
MODE_SSL,
- MODE_TLS,
+ MODE_TLS
};
#ifdef HAVE_SSL
goto fail;
}
- len = strtoul (buf, (char **) &buf, 10);
+ len = strtoul ((char *) buf, (char **) &buf, 10);
if (len != 200 && len != 201) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("NNTP server %s returned error code %d: %s"),
nntp_folder_info_from_store_info (CamelNNTPStore *store, gboolean short_notation, CamelStoreInfo *si)
{
CamelURL *base_url = ((CamelService *) store)->url;
- CamelFolderInfo *fi = g_malloc0(sizeof(*fi));
+ CamelFolderInfo *fi;
CamelURL *url;
char *path;
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (si->path);
if (short_notation)
static CamelFolderInfo *
nntp_folder_info_from_name (CamelNNTPStore *store, gboolean short_notation, const char *name)
{
- CamelFolderInfo *fi = g_malloc0(sizeof(*fi));
CamelURL *base_url = ((CamelService *)store)->url;
+ CamelFolderInfo *fi;
CamelURL *url;
char *path;
+ fi = camel_folder_info_new ();
fi->full_name = g_strdup (name);
if (short_notation)
nntp_store->summary->last_newslist[0] = 0;
if (ret == 111) {
- ptr = line + 3;
+ ptr = (char *) line + 3;
while (*ptr == ' ' || *ptr == '\t')
ptr++;
}
while ((ret = camel_nntp_stream_line (nntp_store->stream, &line, &len)) > 0)
- nntp_store_info_update(nntp_store, line);
+ nntp_store_info_update(nntp_store, (char *) line);
} else {
GHashTable *all;
int i;
g_hash_table_insert(all, si->info.path, si);
while ((ret = camel_nntp_stream_line(nntp_store->stream, &line, &len)) > 0) {
- si = nntp_store_info_update(nntp_store, line);
+ si = nntp_store_info_update(nntp_store, (char *) line);
g_hash_table_remove(all, si->info.path);
}
camel_nntp_stream_set_mode(store->stream, CAMEL_NNTP_STREAM_LINE);
- ps = p = fmt;
+ p = (const unsigned char *) fmt;
+ ps = (const unsigned char *) p;
+
while ((c = *p++)) {
switch (c) {
case '%':
c = *p++;
- camel_stream_write ((CamelStream *) store->mem, ps, p - ps - (c == '%' ? 1 : 2));
+ camel_stream_write ((CamelStream *) store->mem, (const char *) ps, p - ps - (c == '%' ? 1 : 2));
ps = p;
switch (c) {
case 's':
}
}
- camel_stream_write ((CamelStream *) store->mem, ps, p-ps-1);
+ camel_stream_write ((CamelStream *) store->mem, (const char *) ps, p-ps-1);
dd(printf("NNTP_COMMAND: '%.*s'\n", (int)store->mem->buffer->len, store->mem->buffer->data));
camel_stream_write ((CamelStream *) store->mem, "\r\n", 2);
- if (camel_stream_write((CamelStream *) store->stream, store->mem->buffer->data, store->mem->buffer->len) == -1)
+ if (camel_stream_write((CamelStream *) store->stream, (const char *) store->mem->buffer->data, store->mem->buffer->len) == -1)
goto ioerror;
/* FIXME: hack */
typedef enum _xover_t {
XOVER_STRING = 0,
XOVER_MSGID,
- XOVER_SIZE,
+ XOVER_SIZE
} xover_t;
struct _xover_header {
memcpy(is->buf, is->ptr, left);
is->end = is->buf + left;
is->ptr = is->buf;
- left = camel_stream_read(is->source, is->end, CAMEL_NNTP_STREAM_SIZE - (is->end - is->buf));
+ left = camel_stream_read(is->source, (char *) is->end, CAMEL_NNTP_STREAM_SIZE - (is->end - is->buf));
if (left > 0) {
is->end += left;
is->end[0] = '\n';
typedef enum {
CAMEL_NNTP_STREAM_LINE,
CAMEL_NNTP_STREAM_DATA,
- CAMEL_NNTP_STREAM_EOD, /* end of data, acts as if end of stream */
+ CAMEL_NNTP_STREAM_EOD /* end of data, acts as if end of stream */
} camel_nntp_stream_mode_t;
struct _CamelNNTPStream {
+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-09-27 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #474000
/* first, read the greeting */
if (camel_pop3_stream_line (pe->stream, &line, &len) == -1
- || strncmp ((char *) line, (char *) "+OK", 3) != 0)
+ || strncmp ((char *) line, "+OK", 3) != 0)
return -1;
if ((apop = (unsigned char *) strchr ((char *) line + 3, '<'))
next = (unsigned char *) strchr((char *) tok, ' ');
if (next)
*next++ = 0;
- auth = camel_sasl_authtype((const char *)tok);
+ auth = camel_sasl_authtype((const char *) tok);
if (auth) {
dd(printf("got auth type '%s'\n", tok));
pe->auth = g_list_prepend(pe->auth, auth);
&& pe->current != NULL) {
e_dlist_addtail(&pe->queue, (EDListNode *)pc);
return FALSE;
- } else {
- /* ??? */
- if (camel_stream_write((CamelStream *)pe->stream, pc->data, strlen(pc->data)) == -1) {
- e_dlist_addtail(&pe->queue, (EDListNode *)pc);
- return FALSE;
- }
+ }
+
+ /* ??? */
+ if (camel_stream_write((CamelStream *)pe->stream, pc->data, strlen(pc->data)) == -1) {
+ e_dlist_addtail(&pe->queue, (EDListNode *)pc);
+ return FALSE;
+ }
- pe->sentlen += strlen(pc->data);
+ pe->sentlen += strlen(pc->data);
- pc->state = CAMEL_POP3_COMMAND_DISPATCHED;
+ pc->state = CAMEL_POP3_COMMAND_DISPATCHED;
- if (pe->current == NULL)
- pe->current = pc;
- else
- e_dlist_addtail(&pe->active, (EDListNode *)pc);
+ if (pe->current == NULL)
+ pe->current = pc;
+ else
+ e_dlist_addtail(&pe->active, (EDListNode *)pc);
- return TRUE;
- }
+ return TRUE;
}
/* returns -1 on error (sets errno), 0 when no work to do, or >0 if work remaining */
/* check the queue for sending any we can now send also */
pw = (CamelPOP3Command *)pe->queue.head;
pn = pw->next;
+
while (pn) {
if (((pe->capa & CAMEL_POP3_CAP_PIPE) == 0 || (pe->sentlen + strlen(pw->data)) > CAMEL_POP3_SEND_LIMIT)
&& pe->current != NULL)
CAMEL_POP3_ENGINE_DISCONNECT = 0,
CAMEL_POP3_ENGINE_AUTH,
CAMEL_POP3_ENGINE_TRANSACTION,
- CAMEL_POP3_ENGINE_UPDATE,
+ CAMEL_POP3_ENGINE_UPDATE
} camel_pop3_engine_t;
/* state of a command */
/* completion codes */
CAMEL_POP3_COMMAND_OK, /* plain ok response */
CAMEL_POP3_COMMAND_DATA, /* processing command response */
- CAMEL_POP3_COMMAND_ERR, /* error response */
+ CAMEL_POP3_COMMAND_ERR /* error response */
} camel_pop3_command_t;
/* flags for command types */
enum {
CAMEL_POP3_COMMAND_SIMPLE = 0, /* dont expect multiline response */
- CAMEL_POP3_COMMAND_MULTI = 1, /* expect multiline response */
+ CAMEL_POP3_COMMAND_MULTI = 1 /* expect multiline response */
};
/* flags for server options */
pop3_folder->uids_id = g_hash_table_new(NULL, NULL);
pcl = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_list, folder, "LIST\r\n");
- if (pop3_store->engine->capa & CAMEL_POP3_CAP_UIDL) {
+ if (pop3_store->engine->capa & CAMEL_POP3_CAP_UIDL)
pcu = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_uidl, folder, "UIDL\r\n");
- }
while ((i = camel_pop3_engine_iterate(pop3_store->engine, NULL)) > 0)
;
pop3_folder = CAMEL_POP3_FOLDER (folder);
pop3_store = CAMEL_POP3_STORE (folder->parent_store);
- if(pop3_store->delete_after && !expunge)
- {
+ if (pop3_store->delete_after && !expunge) {
d(printf("%s(%d): pop3_store->delete_after = [%d], expunge=[%d]\n",
__FILE__, __LINE__, pop3_store->delete_after, expunge));
camel_operation_start(NULL, _("Expunging old messages"));
camel_pop3_store_expunge (pop3_store, ex);
return 0;
-
}
static void
camel_exception_setv(ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled"));
else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot get message %s: %s"),
- uid, g_strerror (fi->err));
+ _("Cannot get message %s: %s"),
+ uid, g_strerror (fi->err));
goto done;
}
if (camel_stream_read(stream, buffer, 1) != 1 || buffer[0] != '#') {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot get message %s: %s"), uid, _("Unknown reason"));
+ _("Cannot get message %s: %s"), uid, _("Unknown reason"));
goto done;
}
}
camel_exception_setv(ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled"));
else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot get message %s: %s"),
- uid, g_strerror (errno));
+ _("Cannot get message %s: %s"),
+ uid, g_strerror (errno));
camel_object_unref((CamelObject *)message);
message = NULL;
}
enum {
MODE_CLEAR,
MODE_SSL,
- MODE_TLS,
+ MODE_TLS
};
#ifdef HAVE_SSL
}
#else
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to %s: %s"),
- service->url->host, _("SSL unavailable"));
+ _("Could not connect to %s: %s"),
+ service->url->host, _("SSL unavailable"));
return FALSE;
#endif /* HAVE_SSL */
- } else {
+ } else
tcp_stream = camel_tcp_stream_raw_new ();
- }
if ((ret = camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai)) == -1) {
if (errno == EINTR)
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
- _("Connection canceled"));
+ _("Connection canceled"));
else
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to %s: %s"),
- service->url->host,
- g_strerror (errno));
+ _("Could not connect to %s: %s"),
+ service->url->host,
+ g_strerror (errno));
camel_object_unref (tcp_stream);
if (!(store->engine = camel_pop3_engine_new (tcp_stream, flags))) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to read a valid greeting from POP server %s"),
- service->url->host);
+ _("Failed to read a valid greeting from POP server %s"),
+ service->url->host);
camel_object_unref (tcp_stream);
return FALSE;
}
#ifdef HAVE_SSL
if (!(store->engine->capa & CAMEL_POP3_CAP_STLS)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to POP server %s in secure mode: %s"),
- service->url->host, _("STLS not supported by server"));
+ _("Failed to connect to POP server %s in secure mode: %s"),
+ service->url->host, _("STLS not supported by server"));
goto stls_exception;
}
if (ret == FALSE) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to POP server %s in secure mode: %s"),
- service->url->host, store->engine->line);
+ _("Failed to connect to POP server %s in secure mode: %s"),
+ service->url->host, store->engine->line);
goto stls_exception;
}
}
#else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to POP server %s in secure mode: %s"),
- service->url->host, _("TLS is not available in this build"));
+ _("Failed to connect to POP server %s in secure mode: %s"),
+ service->url->host, _("TLS is not available in this build"));
goto stls_exception;
#endif /* HAVE_SSL */
camel_object_unref (tcp_stream);
/* rfc2595, section 4 states that after a successful STLS
- command, the client MUST discard prior CAPA responses */
+ command, the client MUST discard prior CAPA responses */
camel_pop3_engine_reget_capabilities (store->engine);
return TRUE;
CamelPOP3Store *store = CAMEL_POP3_STORE (service);
GList *types = NULL;
- types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex);
+ types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex);
if (camel_exception_is_set (ex))
return NULL;
while (1) {
if (camel_pop3_stream_line(stream, &line, &len) == -1)
goto ioerror;
- if (strncmp((char *) line, (char *) "+OK", 3) == 0)
+ if (strncmp((char *) line, "+OK", 3) == 0)
break;
- if (strncmp((char *) line, (char *) "-ERR", 4) == 0) {
+ if (strncmp((char *) line, "-ERR", 4) == 0) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("SASL `%s' Login failed for POP server %s: %s"),
mech, CAMEL_SERVICE (store)->url->host, line);
}
/* If we dont get continuation, or the sasl object's run out of work, or we dont get a challenge,
its a protocol error, so fail, and try reset the server */
- if (strncmp((char *) line, (char *) "+ ", 2) != 0
+ if (strncmp((char *) line, "+ ", 2) != 0
|| camel_sasl_authenticated(sasl)
|| (resp = (unsigned char *) camel_sasl_challenge_base64(sasl, (const char *) line+2, ex)) == NULL) {
camel_stream_printf((CamelStream *)stream, "*\r\n");
CAMEL_SERVICE (store)->url->host,
store->engine->line ? (char *)store->engine->line : _("Unknown error"));
- camel_pop3_engine_command_free(store->engine, pcp);
+ camel_pop3_engine_command_free (store->engine, pcp);
if (pcu)
camel_pop3_engine_command_free(store->engine, pcu);
memcpy(is->buf, is->ptr, left);
is->end = is->buf + left;
is->ptr = is->buf;
- left = camel_stream_read(is->source, is->end, CAMEL_POP3_STREAM_SIZE - (is->end - is->buf));
+ left = camel_stream_read(is->source, (char *) is->end, CAMEL_POP3_STREAM_SIZE - (is->end - is->buf));
if (left > 0) {
is->end += left;
is->end[0] = '\n';
typedef enum {
CAMEL_POP3_STREAM_LINE,
CAMEL_POP3_STREAM_DATA,
- CAMEL_POP3_STREAM_EOD, /* end of data, acts as if end of stream */
+ CAMEL_POP3_STREAM_EOD /* end of data, acts as if end of stream */
} camel_pop3_stream_mode_t;
struct _CamelPOP3Stream {
+2007-11-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Merge a bunch of compiler warning fixes and cosmetic
+ cleanups from camel-lite.
+
2007-03-26 Matthew Barnes <mbarnes@redhat.com>
* camel-smtp-transport.c (smtp_auth):
enum {
MODE_CLEAR,
MODE_SSL,
- MODE_TLS,
+ MODE_TLS
};
#ifdef HAVE_SSL
service->url->host);
service->url->passwd = camel_session_get_password (session, service, NULL,
- prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+ prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
g_free (prompt);
g_free (errbuf);
while (*end && !isspace ((int) *end))
end++;
- type = g_strndup (start, end - start);
+ type = g_strndup ((gchar*) start, end - start);
g_hash_table_insert (table, type, type);
/* advance to the next token */
const unsigned char *inend;
char *outbuf;
- outptr = outbuf = g_malloc (len + 1);
+ outbuf = (char *) g_malloc (len + 1);
+ outptr = (unsigned char *) outbuf;
inptr = (unsigned char *) in;
inend = inptr + len;
g_hash_table_destroy (transport->authtypes);
}
- transport->authtypes = esmtp_get_authtypes (token);
+ transport->authtypes = esmtp_get_authtypes ((const unsigned char *) token);
}
}
}
return FALSE;
}
} while (*(respbuf+3) == '-'); /* if we got "221-" then loop again */
+
g_free (respbuf);
return TRUE;