Re: [evolution-patches] fix for bug #44344
- From: Not Zed <notzed ximian com>
- To: Jeffrey Stedfast <fejj ximian com>
- Cc: evolution-patches ximian com
- Subject: Re: [evolution-patches] fix for bug #44344
- Date: 11 Jun 2003 13:14:10 +0930
couple more comments :)
Index: camel-mime-filter-bestenc.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-filter-bestenc.c,v
retrieving revision 1.6
diff -u -r1.6 camel-mime-filter-bestenc.c
--- camel-mime-filter-bestenc.c 11 Jul 2002 22:30:49 -0000 1.6
+++ camel-mime-filter-bestenc.c 10 Jun 2003 05:56:35 -0000
@@ -23,6 +23,7 @@
#include <config.h>
#endif
+#include <stdio.h>
#include <string.h>
#include "camel-mime-filter-bestenc.h"
@@ -210,8 +211,9 @@
/**
* camel_mime_filter_bestenc_get_best_encoding:
- * @f:
+ * @f: bestenc filter object
* @required: maximum level of output encoding allowed.
+ * @istext: content stream is text
--- left over from your last patch
*
* Return the best encoding, given specific constraints, that can be
used to
* encode a stream of bytes.
@@ -222,7 +224,11 @@
camel_mime_filter_bestenc_get_best_encoding(CamelMimeFilterBestenc *f,
CamelBestencEncoding required)
{
CamelMimePartEncodingType bestenc;
-
+ int istext;
+
+ istext = (required & CAMEL_BESTENC_TEXT) ? 1 : 0;
+ required = required & ~CAMEL_BESTENC_TEXT;
+
#if 0
printf("count0 = %d, count8 = %d, total = %d\n", f->count0,
f->count8, f->total);
printf("maxline = %d, crlfnoorder = %s\n", f->maxline,
f->crlfnoorder?"TRUE":"FALSE");
@@ -238,7 +244,7 @@
/* if we need to encode, see how we do it */
if (required == CAMEL_BESTENC_BINARY)
bestenc = CAMEL_MIME_PART_ENCODING_BINARY;
- else if (f->count8 + f->count0 >= (f->total*17/100))
+ else if (f->count0 > 0 || f->count8 >= (istext ?
(f->total*17/100) : 1))
--- this is partially left over from the last patch too. maybe ..
else if (istext && (f->count8 + f->count0) < (f->total*17/100))
bestenc = CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
else
bestenc = CAMEL_MIME_PART_ENCODING_BASE64;
would be clearer
i.e. make the logic much more obivous that we only even check for qp if
we are doing text parts. and then the choice is based upon the most
compact encoding.
}
ugh, why does pasting into gtkhtml now put the pasted text into a new
'cell' ?
On Tue, 2003-06-10 at 15:37, Jeffrey Stedfast wrote:
> ok, last try...then I'm going to bed.
>
> Jeff
>
> On Tue, 2003-06-10 at 01:24, Jeffrey Stedfast wrote:
> > better fix... instead of requiring an istext arg to get_best_encoding(),
> > instead define a bit CAMEL_BESTENC_TEXT that we pass in at creation
> > time.
> >
> > 1. this way the code that calls get_best_encoding() doesn't have to know
> > anything about the content-type
> >
> > 2. also means no API changes.
> >
> > Jeff
> >
> > On Tue, 2003-06-10 at 01:06, Jeffrey Stedfast wrote:
> > > Don't ever encode non-text streams as quoted-printable.
> > >
> > > (technically you are allowed to do this, but to avoid the gotchas with
> > > it, it's easier to just force base64)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]