summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-03 19:09:54 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-03 19:09:54 +0000
commitd9f14ffe246a44085f7c91fb767312653ed491d2 (patch)
tree4fe32e02624ca48f176d330fca2479e978a28c61
parentfe87e8a4f76a04a3c8312dc83f89459cc134b435 (diff)
downloadppe42-gcc-d9f14ffe246a44085f7c91fb767312653ed491d2.tar.gz
ppe42-gcc-d9f14ffe246a44085f7c91fb767312653ed491d2.zip
* jcf-io.c (jcf_print_utf8_replace): Handle UTF-8 input.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31779 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/jcf-io.c14
2 files changed, 13 insertions, 5 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 32fc2bd7d69..ae1f8c9fe4f 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2000-02-03 Tom Tromey <tromey@cygnus.com>
+
+ * jcf-io.c (jcf_print_utf8_replace): Handle UTF-8 input.
+
2000-01-31 Scott Bambrough <scottb@netwinder.org>
* gcc/java/javaop.h (WORDS_TO_DOUBLE): Allow WORDS_TO_DOUBLE to
diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c
index 0f650237b78..869bc002da6 100644
--- a/gcc/java/jcf-io.c
+++ b/gcc/java/jcf-io.c
@@ -1,5 +1,5 @@
/* Utility routines for finding and reading Java(TM) .class files.
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1996, 97-98, 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -505,11 +505,15 @@ DEFUN(jcf_print_utf8_replace, (stream, str, length, in_char, out_char),
FILE *stream AND const unsigned char *str AND int length
AND int in_char AND int out_char)
{
-
- int i;/* FIXME - actually handle Unicode! */
- for (i = 0; i < length; i++)
+ const unsigned char *limit = str + length;
+ while (str < limit)
{
- int ch = str[i];
+ int ch = UTF8_GET (str, limit);
+ if (ch < 0)
+ {
+ fprintf (stream, "\\<invalid>");
+ return;
+ }
jcf_print_char (stream, ch == in_char ? out_char : ch);
}
}
OpenPOWER on IntegriCloud