PATCH: pedantic fix for UTF-8 decoding

Tom Tromey tromey@cygnus.com
Mon Feb 22 09:13:00 GMT 1999


I'm committing this patch.  It changes the java front end's UTF-8
decoding to be pedantically correct.  In practice this change has no
effect.

1999-02-20  Tom Tromey  <tromey@cygnus.com>

	* jcf.h (UTF8_GET): Mask first byte of 3-byte encoding with 0x0f,
	not 0x1f.

Tom

Index: jcf.h
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/jcf.h,v
retrieving revision 1.7
diff -u -r1.7 jcf.h
--- jcf.h	1999/02/01 07:00:39	1.7
+++ jcf.h	1999/02/22 17:10:07
@@ -241,7 +241,7 @@
    ? (((PTR)[-2] & 0x1F) << 6) + ((PTR)[-1] & 0x3F) \
    : (*(PTR) & 0xF0) == 0xE0 && ((PTR) += 3) <= (LIMIT) \
    && ((PTR)[-2] & 0xC0) == 0x80 && ((PTR)[-1] & 0xC0) == 0x80 \
-   ? (((PTR)[-3]&0x1F) << 12) + (((PTR)[-2]&0x3F) << 6) + ((PTR)[-1]&0x3F) \
+   ? (((PTR)[-3]&0x0F) << 12) + (((PTR)[-2]&0x3F) << 6) + ((PTR)[-1]&0x3F) \
    : ((PTR)++, -1))
 
 extern char *jcf_write_base_directory;


More information about the Gcc-patches mailing list