Commit d8b6d4cf by Tom Tromey Committed by Tom Tromey

* jcf-io.c (jcf_print_utf8_replace): Handle UTF-8 input.

From-SVN: r31779
parent 2c2f0e54
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> 2000-01-31 Scott Bambrough <scottb@netwinder.org>
* gcc/java/javaop.h (WORDS_TO_DOUBLE): Allow WORDS_TO_DOUBLE to * gcc/java/javaop.h (WORDS_TO_DOUBLE): Allow WORDS_TO_DOUBLE to
......
/* Utility routines for finding and reading Java(TM) .class files. /* 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 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 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), ...@@ -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 FILE *stream AND const unsigned char *str AND int length
AND int in_char AND int out_char) AND int in_char AND int out_char)
{ {
const unsigned char *limit = str + length;
int i;/* FIXME - actually handle Unicode! */ while (str < limit)
for (i = 0; i < length; i++)
{ {
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); jcf_print_char (stream, ch == in_char ? out_char : ch);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment