Remove the stupid warning that should never have been there in the first

2001-10-25    <NotZed@Ximian.com>

        * camel-search-private.c (utf8_get): Remove the stupid warning
        that should never have been there in the first place.

        * camel-sasl-digest-md5.c (digest_response): s/iconv/e_iconv/

        * camel-pgp-context.c (pgp_verify): "

        * camel-mime-utils.c (rfc2047_decode_word, rfc2047_decode_word,
        append_8bit, rfc2047_encode_word, rfc2184_decode,
        header_decode_param): "

        * camel-mime-part-utils.c (convert_buffer, convert_buffer): "

        * camel-mime-filter-charset.c (reset, complete, filter): "

svn path=/trunk/; revision=14113
This commit is contained in:
5
2001-10-26 00:37:52 +00:00
committed by Michael Zucci
parent b822bc381f
commit 5b449d9ca7
9 changed files with 94 additions and 36 deletions

View File

@ -1,3 +1,31 @@
2001-10-25 <NotZed@Ximian.com>
* camel-search-private.c (utf8_get): Remove the stupid warning
that should never have been there in the first place.
* camel-sasl-digest-md5.c (digest_response): s/iconv/e_iconv/
* camel-pgp-context.c (pgp_verify): "
* camel-mime-utils.c (rfc2047_decode_word, rfc2047_decode_word,
append_8bit, rfc2047_encode_word, rfc2184_decode,
header_decode_param): "
* camel-mime-part-utils.c (convert_buffer, convert_buffer): "
* camel-mime-filter-charset.c (reset, complete, filter): "
2001-10-24 <NotZed@Ximian.com>
* camel-mime-filter-basic.c (complete): For qp decoding, if the
data isn't really qp encoded, we could possible grow the buffer by
upto 2 bytes above the input size, fix allocations/assertions
appropraitely.
* camel-vee-folder.c (folder_changed_change): If we're not
autoupdate, only search for new matches against changed uid's that
we dont already have.
2001-10-24 Dan Winship <danw@ximian.com>
* providers/imap/camel-imap-store.c (unsubscribe_folder): Don't

View File

@ -122,10 +122,10 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
g_assert(newlen <= len);
break;
case CAMEL_MIME_FILTER_BASIC_QP_DEC:
/* output can't possibly exceed the input size */
camel_mime_filter_set_size(mf, len, FALSE);
/* 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 = quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len);
g_assert(newlen <= len+2);
break;
case CAMEL_MIME_FILTER_BASIC_UU_DEC:
/* output can't possibly exceed the input size */

View File

@ -79,7 +79,7 @@ reset(CamelMimeFilter *mf)
/* what happens with the output bytes if this resets the state? */
if (f->ic != (iconv_t) -1) {
buffer = buf;
iconv(f->ic, NULL, 0, &buffer, &outlen);
e_iconv(f->ic, NULL, 0, &buffer, &outlen);
}
}
@ -109,7 +109,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
d(memset(outbuf, 0, outlen));
if (inlen>0) {
converted = iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
converted = e_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
if (converted == -1) {
if (errno != EINVAL) {
g_warning("error occured converting: %s", strerror(errno));
@ -124,7 +124,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
/* this 'resets' the output stream, returning back to the initial
shift state for multishift charactersets */
converted = iconv(f->ic, NULL, 0, &outbuf, &outlen);
converted = e_iconv(f->ic, NULL, 0, &outbuf, &outlen);
if (converted == -1) {
g_warning("Conversion failed to complete: %s", strerror(errno));
}
@ -168,7 +168,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
inlen = len;
outbuf = mf->outbuf;
outlen = mf->outsize;
converted = iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
converted = e_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
if (converted == -1) {
if (errno != EINVAL) {
g_warning("error occured converting: %s", strerror(errno));

View File

@ -123,7 +123,7 @@ static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *fr
inlen = in->len;
outbuf = buffer;
if (iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen) == -1) {
if (e_iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen) == -1) {
g_free(buffer);
g_warning("conversion failed: %s", strerror(errno));
/* we didn't have enough space */
@ -140,7 +140,7 @@ static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *fr
/* close off the conversion */
outbuf = buffer;
outlen = in->len * i + 16;
if (iconv(ic, NULL, 0, &outbuf, &outlen) != -1)
if (e_iconv(ic, NULL, 0, &outbuf, &outlen) != -1)
g_byte_array_append(out, buffer, (in->len*i+16) - outlen);
g_free(buffer);

View File

@ -1037,9 +1037,9 @@ rfc2047_decode_word(const char *in, int len)
retry:
ic = e_iconv_open ("UTF-8", charset);
if (ic != (iconv_t)-1) {
ret = iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret >= 0) {
iconv (ic, NULL, 0, &outbuf, &outlen);
e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = 0;
decoded = g_strdup (outbase);
}
@ -1116,7 +1116,7 @@ append_8bit (GString *out, const char *inbuf, int inlen, const char *charset)
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc(outlen);
if (iconv(ic, &inbuf, &inlen, &outbuf, &outlen) == -1) {
if (e_iconv(ic, &inbuf, &inlen, &outbuf, &outlen) == -1) {
w(g_warning("Conversion to '%s' failed: %s", charset, strerror(errno)));
g_free(outbase);
e_iconv_close(ic);
@ -1267,13 +1267,13 @@ rfc2047_encode_word(GString *outstring, const char *in, int len, const char *typ
hopefully-small-enough chunks, and leave it at that */
convlen = MIN(inlen, CAMEL_FOLD_PREENCODED);
p = inptr;
if (iconv(ic, &inptr, &convlen, &out, &outlen) == -1) {
if (e_iconv(ic, &inptr, &convlen, &out, &outlen) == -1) {
w(g_warning("Conversion problem: conversion truncated: %s", strerror(errno)));
/* blah, we include it anyway, better than infinite loop ... */
inptr = p + convlen;
} else {
/* make sure we flush out any shift state */
iconv(ic, NULL, 0, &out, &outlen);
e_iconv(ic, NULL, 0, &out, &outlen);
}
inlen -= (inptr - p);
}
@ -1880,9 +1880,9 @@ rfc2184_decode (const char *in, int len)
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc (outlen);
ret = iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret >= 0) {
iconv (ic, NULL, 0, &outbuf, &outlen);
e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = '\0';
g_free (decoded);
decoded = outbase;
@ -2035,9 +2035,9 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc (outlen);
ret = iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret >= 0) {
iconv (ic, NULL, 0, &outbuf, &outlen);
e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = '\0';
}

View File

@ -1037,9 +1037,9 @@ pgp_verify (CamelCipherContext *ctx, CamelCipherHash hash, CamelStream *istream,
int ret;
inbuf = diagnostics;
ret = iconv (cd, &inbuf, &inlen, &outbuf, &outlen);
ret = e_iconv (cd, &inbuf, &inlen, &outbuf, &outlen);
if (ret >= 0) {
iconv (cd, NULL, 0, &outbuf, &outlen);
e_iconv (cd, NULL, 0, &outbuf, &outlen);
}
e_iconv_close (cd);

View File

@ -709,7 +709,7 @@ digest_response (struct _DigestResponse *resp)
outbuf = username = g_malloc0 (outlen + 1);
buf = resp->username;
if (cd == (iconv_t) -1 || iconv (cd, &buf, &len, &outbuf, &outlen) == -1) {
if (cd == (iconv_t) -1 || e_iconv (cd, &buf, &len, &outbuf, &outlen) == -1) {
/* We can't convert to UTF-8 - pretend we never got a charset param? */
g_free (resp->charset);
resp->charset = NULL;

View File

@ -199,8 +199,9 @@ utf8_get (const char **inp)
{
const unsigned char *p = *inp;
gunichar c;
g_return_val_if_fail (p != NULL, 0);
if (p == NULL)
return 0;
c = g_utf8_get_char (p);
*inp = g_unichar_validate (c) ? g_utf8_next_char (p) : NULL;

View File

@ -1260,7 +1260,7 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
CamelVeeMessageInfo *vinfo;
int i, vuidlen = 0;
CamelFolderChangeInfo *vf_changes = NULL, *unmatched_changes = NULL;
GPtrArray *matches;
GPtrArray *matches, *newchanged = NULL, *changed;
GHashTable *matches_hash;
/* Check the folder hasn't beem removed while we weren't watching */
@ -1301,8 +1301,34 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
if (changes->uid_changed->len > 0)
dd(printf(" Searching for changed matches '%s'\n", vf->expression));
if (changes->uid_changed->len > 0
&& (matches = camel_folder_search_by_uids(sub, vf->expression, changes->uid_changed, NULL))) {
/* TODO:
In this code around here, we can work out if the search will affect the changes
we had, and only re-search against them if they might have */
matches = NULL;
changed = changes->uid_changed;
if (changed->len
&& (vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0) {
newchanged = g_ptr_array_new();
for (i=0;i<changed->len;i++) {
uid = changed->pdata[i];
if (strlen(uid)+9 > vuidlen) {
vuidlen = strlen(uid)+64;
vuid = g_realloc(vuid, vuidlen);
}
memcpy(vuid, hash, 8);
strcpy(vuid+8, uid);
vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
if (vinfo == NULL)
g_ptr_array_add(newchanged, uid);
else
camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
}
changed = newchanged;
}
if (changed->len
&& (matches = camel_folder_search_by_uids(sub, vf->expression, changed, NULL))) {
/* If we are auto-updating, then re-check changed uids still match */
dd(printf(" Vfolder %supdate\nuids match:", (vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO)?"auto-":""));
matches_hash = g_hash_table_new(g_str_hash, g_str_equal);
@ -1311,8 +1337,8 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
g_hash_table_insert(matches_hash, matches->pdata[i], matches->pdata[i]);
}
dd(printf("\n"));
for (i=0;i<changes->uid_changed->len;i++) {
uid = changes->uid_changed->pdata[i];
for (i=0;i<changed->len;i++) {
uid = changed->pdata[i];
if (strlen(uid)+9 > vuidlen) {
vuidlen = strlen(uid)+64;
vuid = g_realloc(vuid, vuidlen);
@ -1322,20 +1348,20 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
if (vinfo == NULL) {
/* A uid we dont have, but now it matches, add it */
if (g_hash_table_lookup(matches_hash, changes->uid_changed->pdata[i])) {
dd(printf(" adding uid '%s' [newly matched]\n", (char *)changes->uid_changed->pdata[i]));
folder_changed_add_uid(sub, changes->uid_changed->pdata[i], hash, vf);
if (g_hash_table_lookup(matches_hash, uid)) {
dd(printf(" adding uid '%s' [newly matched]\n", uid));
folder_changed_add_uid(sub, uid, hash, vf);
}
} else {
if ((vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0
|| g_hash_table_lookup(matches_hash, changes->uid_changed->pdata[i])) {
|| g_hash_table_lookup(matches_hash, uid)) {
/* still match, or we're not auto-updating, change event, (if it changed) */
dd(printf(" changing uid '%s' [still matches]\n", (char *)changes->uid_changed->pdata[i]));
folder_changed_change_uid(sub, changes->uid_changed->pdata[i], hash, vf);
dd(printf(" changing uid '%s' [still matches]\n", uid));
folder_changed_change_uid(sub, uid, hash, vf);
} else {
/* No longer matches, remove it, but keep it in unmatched (potentially) */
dd(printf(" removing uid '%s' [did match]\n", (char *)changes->uid_changed->pdata[i]));
folder_changed_remove_uid(sub, changes->uid_changed->pdata[i], hash, TRUE, vf);
dd(printf(" removing uid '%s' [did match]\n", uid));
folder_changed_remove_uid(sub, uid, hash, TRUE, vf);
}
camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
}
@ -1345,6 +1371,9 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
camel_folder_search_free(sub, matches);
}
if (newchanged)
g_ptr_array_free(newchanged, TRUE);
if (camel_folder_change_info_changed(folder_unmatched->changes)) {
unmatched_changes = folder_unmatched->changes;
folder_unmatched->changes = camel_folder_change_info_new();