Re: [evolution-patches] ABR patch for camel's rfc2047 encode_string



On Thu, 2004-07-29 at 11:01 +0800, Not Zed wrote:
> 
> Maybe we should put it right the macro's?  The compiler should
> optimise it out for a char type.

I don't think we should because it would make it such that we couldn't
do:

 camel_mime_is_foo (*inptr++)

we don't currently use that convention, but it'd be nice (especially
since the similar libc versions allow it).

also: since as you pointed out, there's no actual ABR, I don't think we
want to change the macros.

I've checked all the code that uses camel_mime_is_*() macros and checked
that the usage is correct (eg. not using 32bit ints or some such) and
the only case that was wrong was the case fixed in my patch.

> 
> We should also check against ((unsigned int)x) < 256 since -100 < 256
> but not in range for the tables.

gunichar is by definition a uint32 so no need to cast in my patch (I
think you only meant for this cast to be used in the macro's anyway).

Since you OK'd my patch, I'm going to commit.

Jeff

> 
> On Thu, 2004-07-29 at 10:16 +0800, Not Zed wrote:
> > 
> > looks ok, should check other instances where we don't pass a char to
> > the type functions.
> > 
> > although this shouldn't abr since we explictly cast to unsigned char
> > which can only be 0-255.
> > 
> > 
> > On Wed, 2004-07-28 at 14:01 -0400, Jeffrey Stedfast wrote:  
> > > likely culprit for http://bugzilla.ximian.com/show_bug.cgi?id=62029
> > > 
> > > when Sun sent us a patch to use is_lwsp() instead of g_unichar_is_space
> > > (), they forgot to make sure that 'c' was <256 (otherwise it would read
> > > past the lookup table and get a bogus value).
> > > 
> > > Jeff
> > > 
> > > Plain text document attachment (62029.patch)
> > > ? 24026.patch
> > > ? 55280.patch
> > > ? 61551.patch
> > > ? 62029.patch
> > > ? ChangeLog.nonximian
> > > ? body
> > > ? body.c
> > > ? body.txt
> > > ? body2.txt
> > > ? braindamaged.patch
> > > ? cf.c
> > > ? charset-map.c
> > > ? charset-map.diff
> > > ? class.sh
> > > ? cmsutil.c
> > > ? date.patch
> > > ? flags
> > > ? foo
> > > ? foo.txt
> > > ? foo2.txt
> > > ? gw-body.txt
> > > ? imap
> > > ? invalid-content-id.patch
> > > ? iso
> > > ? iso.c
> > > ? lang.patch
> > > ? namespace.sh
> > > ? patch
> > > ? pop3-uidl.patch
> > > ? smime
> > > ? uid-cache.patch
> > > ? providers/tmp
> > > ? providers/local/camel-mozilla-folder.c
> > > ? providers/local/camel-mozilla-folder.h
> > > ? providers/local/camel-mozilla-store.c
> > > ? providers/local/camel-mozilla-store.h
> > > ? tests/data/camel-mime-tests.tar.gz
> > > Index: ChangeLog
> > > ===================================================================
> > > RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
> > > retrieving revision 1.2229
> > > diff -u -r1.2229 ChangeLog
> > > --- ChangeLog	28 Jul 2004 16:44:08 -0000	1.2229
> > > +++ ChangeLog	28 Jul 2004 18:00:08 -0000
> > > @@ -1,3 +1,8 @@
> > > +2004-07-28  Jeffrey Stedfast  <fejj novell com>
> > > +
> > > +	* camel-mime-utils.c (camel_header_encode_string): Fixed an ABR
> > > +	that may have been responsible for bug #62029.
> > > +
> > >  2004-07-26  Jeffrey Stedfast  <fejj novell com>
> > >  
> > >  	* camel-charset-map.c (camel_charset_best_mask): Changed the logic
> > > Index: camel-mime-utils.c
> > > ===================================================================
> > > RCS file: /cvs/gnome/evolution/camel/camel-mime-utils.c,v
> > > retrieving revision 1.210
> > > diff -u -r1.210 camel-mime-utils.c
> > > --- camel-mime-utils.c	18 Jun 2004 20:07:09 -0000	1.210
> > > +++ camel-mime-utils.c	28 Jul 2004 18:00:09 -0000
> > > @@ -1335,7 +1335,7 @@
> > >  			continue;
> > >  		}
> > >  		
> > > -		if (camel_mime_is_lwsp (c) && !last_was_space) {
> > > +		if (c < 256 && camel_mime_is_lwsp (c) && !last_was_space) {
> > >  			/* we've reached the end of a 'word' */
> > >  			if (word && !(last_was_encoded && encoding)) {
> > >  				/* output lwsp between non-encoded words */
> > -- 
> > 
> > Michael Zucchi <notzed ximian com>
> > "born to die, live to work, it's
> > all downhill from here"
> > Novell's Evolution and Free
> > Software Developer
> -- 
> 
> Michael Zucchi <notzed ximian com>
> "born to die, live to work, it's
> all downhill from here"
> Novell's Evolution and Free
> Software Developer
-- 
Jeffrey Stedfast
Evolution Hacker - Novell, Inc.
fejj ximian com  - www.novell.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]