link.cc (_Jv_Linker::print_class_loaded): Declare string constants as "const char *".
2006-02-08 Bryce McKinlay <mckinlay@redhat.com> * link.cc (_Jv_Linker::print_class_loaded): Declare string constants as "const char *". * verify.cc (verify_fail): Likewise. * gnu/classpath/natSystemProperties.cc (file_encoding): Likewise. * interpret.cc (throw_internal_error, throw_class_format_error): Likewise. * gcj/javaprims.h (_Jv_hashUtf8String, _Jv_Utf8Const::space_needed, _Jv_Utf8Const::init, _Jv_makeUtf8Const): Likewise. * java/lang/Class.h (_Jv_InitPrimClass): Likewise. * include/jvm.h (_Jv_strLengthUtf8, _Jv_makeUtf8Const): Likewise. * defineclass.cc (throw_internal_error, throw_no_class_def_found_error, is_attribute_name): Likewise. * prims.cc (_Jv_strLengthUtf8, _Jv_hashUtf8String, _Jv_Utf8Const::init, _Jv_makeUtf8Const, _Jv_InitPrimClass): Likewise. From-SVN: r110767
This commit is contained in:
parent
8b1753e3ec
commit
2cf94e58cb
10 changed files with 48 additions and 31 deletions
|
@ -1,3 +1,20 @@
|
|||
2006-02-08 Bryce McKinlay <mckinlay@redhat.com>
|
||||
|
||||
* link.cc (_Jv_Linker::print_class_loaded): Declare string constants
|
||||
as "const char *".
|
||||
* verify.cc (verify_fail): Likewise.
|
||||
* gnu/classpath/natSystemProperties.cc (file_encoding): Likewise.
|
||||
* interpret.cc (throw_internal_error, throw_class_format_error):
|
||||
Likewise.
|
||||
* gcj/javaprims.h (_Jv_hashUtf8String, _Jv_Utf8Const::space_needed,
|
||||
_Jv_Utf8Const::init, _Jv_makeUtf8Const): Likewise.
|
||||
* java/lang/Class.h (_Jv_InitPrimClass): Likewise.
|
||||
* include/jvm.h (_Jv_strLengthUtf8, _Jv_makeUtf8Const): Likewise.
|
||||
* defineclass.cc (throw_internal_error, throw_no_class_def_found_error,
|
||||
is_attribute_name): Likewise.
|
||||
* prims.cc (_Jv_strLengthUtf8, _Jv_hashUtf8String, _Jv_Utf8Const::init,
|
||||
_Jv_makeUtf8Const, _Jv_InitPrimClass): Likewise.
|
||||
|
||||
2006-02-08 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
PR libgcj/26063, PR libgcj/17978, PR libgcj/10598:
|
||||
|
|
|
@ -47,11 +47,11 @@ using namespace gcj;
|
|||
|
||||
// these go in some separate functions, to avoid having _Jv_InitClass
|
||||
// inserted all over the place.
|
||||
static void throw_internal_error (char *msg)
|
||||
static void throw_internal_error (const char *msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
static void throw_no_class_def_found_error (jstring msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
static void throw_no_class_def_found_error (char *msg)
|
||||
static void throw_no_class_def_found_error (const char *msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
static void throw_class_format_error (jstring msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
|
@ -258,10 +258,10 @@ struct _Jv_ClassReader
|
|||
void read_one_method_attribute (int method);
|
||||
void read_one_code_attribute (int method);
|
||||
void read_one_field_attribute (int field);
|
||||
void throw_class_format_error (char *msg);
|
||||
void throw_class_format_error (const char *msg);
|
||||
|
||||
/** check an utf8 entry, without creating a Utf8Const object */
|
||||
bool is_attribute_name (int index, char *name);
|
||||
bool is_attribute_name (int index, const char *name);
|
||||
|
||||
/** here goes the class-loader members defined out-of-line */
|
||||
void handleConstantPool ();
|
||||
|
@ -469,7 +469,7 @@ void _Jv_ClassReader::read_fields ()
|
|||
}
|
||||
|
||||
bool
|
||||
_Jv_ClassReader::is_attribute_name (int index, char *name)
|
||||
_Jv_ClassReader::is_attribute_name (int index, const char *name)
|
||||
{
|
||||
check_tag (index, JV_CONSTANT_Utf8);
|
||||
int len = get2u (bytes+offsets[index]);
|
||||
|
@ -1418,7 +1418,7 @@ void _Jv_ClassReader::handleMethodsEnd ()
|
|||
}
|
||||
}
|
||||
|
||||
void _Jv_ClassReader::throw_class_format_error (char *msg)
|
||||
void _Jv_ClassReader::throw_class_format_error (const char *msg)
|
||||
{
|
||||
jstring str;
|
||||
if (def->name != NULL)
|
||||
|
@ -1460,7 +1460,7 @@ throw_no_class_def_found_error (jstring msg)
|
|||
}
|
||||
|
||||
static void
|
||||
throw_no_class_def_found_error (char *msg)
|
||||
throw_no_class_def_found_error (const char *msg)
|
||||
{
|
||||
throw_no_class_def_found_error (JvNewStringLatin1 (msg));
|
||||
}
|
||||
|
@ -1474,7 +1474,7 @@ throw_class_format_error (jstring msg)
|
|||
}
|
||||
|
||||
static void
|
||||
throw_internal_error (char *msg)
|
||||
throw_internal_error (const char *msg)
|
||||
{
|
||||
throw new java::lang::InternalError (JvNewStringLatin1 (msg));
|
||||
}
|
||||
|
|
|
@ -489,7 +489,7 @@ extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
|
|||
__attribute__((__malloc__));
|
||||
extern "C" jsize _Jv_GetStringUTFLength (jstring);
|
||||
extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
|
||||
extern "C" jint _Jv_hashUtf8String (char*, int);
|
||||
extern "C" jint _Jv_hashUtf8String (const char*, int);
|
||||
|
||||
struct _Jv_VMOption
|
||||
{
|
||||
|
@ -561,17 +561,17 @@ class _Jv_Utf8Const
|
|||
jstring toString() { return _Jv_NewStringUTF(data); }
|
||||
/** Given an UTF8 string, how many bytes needed for a UTF8Const,
|
||||
including struct header, and final NUL. I.e. what to pas to malloc. */
|
||||
static int space_needed (char *, int len)
|
||||
static int space_needed (const char *, int len)
|
||||
{ return sizeof (_Jv_Utf8Const) + len + 1; }
|
||||
/** Given an allocated _Jv_Utf8Const, copy / fill it in. */
|
||||
void init (char *s, int len);
|
||||
void init (const char *s, int len);
|
||||
friend jboolean _Jv_equalUtf8Consts (const _Jv_Utf8Const*, const _Jv_Utf8Const *);
|
||||
friend jboolean _Jv_equal (_Jv_Utf8Const*, jstring, jint);
|
||||
friend jboolean _Jv_equaln (_Jv_Utf8Const*, jstring, jint);
|
||||
friend jboolean _Jv_equalUtf8Classnames (const _Jv_Utf8Const*,
|
||||
const _Jv_Utf8Const*);
|
||||
friend jboolean _Jv_isPrimitiveOrDerived (const _Jv_Utf8Const*);
|
||||
friend _Jv_Utf8Const *_Jv_makeUtf8Const (char*, int);
|
||||
friend _Jv_Utf8Const *_Jv_makeUtf8Const (const char*, int);
|
||||
friend _Jv_Utf8Const *_Jv_makeUtf8Const (jstring);
|
||||
friend jstring _Jv_NewStringUtf8Const (_Jv_Utf8Const*);
|
||||
};
|
||||
|
|
|
@ -62,11 +62,11 @@ _Jv_SetDLLSearchPath (const char *)
|
|||
#if ! defined (DEFAULT_FILE_ENCODING) && defined (HAVE_ICONV) \
|
||||
&& defined (HAVE_NL_LANGINFO)
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
file_encoding ()
|
||||
{
|
||||
setlocale (LC_CTYPE, "");
|
||||
char *e = nl_langinfo (CODESET);
|
||||
const char *e = nl_langinfo (CODESET);
|
||||
if (e == NULL || *e == '\0')
|
||||
e = "8859_1";
|
||||
return e;
|
||||
|
@ -80,7 +80,7 @@ file_encoding ()
|
|||
#define DEFAULT_FILE_ENCODING "8859_1"
|
||||
#endif
|
||||
|
||||
static char *default_file_encoding = DEFAULT_FILE_ENCODING;
|
||||
static const char *default_file_encoding = DEFAULT_FILE_ENCODING;
|
||||
|
||||
#if HAVE_GETPWUID_R
|
||||
/* Use overload resolution to find out the signature of getpwuid_r. */
|
||||
|
|
|
@ -132,10 +132,10 @@ union _Jv_value
|
|||
? (((PTR)[-3]&0x0F) << 12) + (((PTR)[-2]&0x3F) << 6) + ((PTR)[-1]&0x3F) \
|
||||
: ((PTR)++, -1))
|
||||
|
||||
extern int _Jv_strLengthUtf8(char* str, int len);
|
||||
extern int _Jv_strLengthUtf8(const char* str, int len);
|
||||
|
||||
typedef struct _Jv_Utf8Const Utf8Const;
|
||||
_Jv_Utf8Const *_Jv_makeUtf8Const (char *s, int len);
|
||||
_Jv_Utf8Const *_Jv_makeUtf8Const (const char *s, int len);
|
||||
_Jv_Utf8Const *_Jv_makeUtf8Const (jstring string);
|
||||
extern jboolean _Jv_equalUtf8Consts (const _Jv_Utf8Const *, const _Jv_Utf8Const *);
|
||||
extern jboolean _Jv_equal (_Jv_Utf8Const *, jstring, jint);
|
||||
|
|
|
@ -47,7 +47,7 @@ _Jv_InterpreterEngine _Jv_soleInterpreterEngine;
|
|||
|
||||
using namespace gcj;
|
||||
|
||||
static void throw_internal_error (char *msg)
|
||||
static void throw_internal_error (const char *msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
static void throw_incompatible_class_change_error (jstring msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
|
@ -58,7 +58,7 @@ static void throw_null_pointer_exception ()
|
|||
|
||||
static void throw_class_format_error (jstring msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
static void throw_class_format_error (char *msg)
|
||||
static void throw_class_format_error (const char *msg)
|
||||
__attribute__ ((__noreturn__));
|
||||
|
||||
#ifdef DIRECT_THREADED
|
||||
|
@ -3294,7 +3294,7 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
|
|||
}
|
||||
|
||||
static void
|
||||
throw_internal_error (char *msg)
|
||||
throw_internal_error (const char *msg)
|
||||
{
|
||||
throw new java::lang::InternalError (JvNewStringLatin1 (msg));
|
||||
}
|
||||
|
@ -3817,7 +3817,7 @@ throw_class_format_error (jstring msg)
|
|||
}
|
||||
|
||||
static void
|
||||
throw_class_format_error (char *msg)
|
||||
throw_class_format_error (const char *msg)
|
||||
{
|
||||
throw_class_format_error (JvNewStringLatin1 (msg));
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ jclass _Jv_NewClass (_Jv_Utf8Const *name, jclass superclass,
|
|||
void _Jv_InitNewClassFields (jclass klass);
|
||||
|
||||
// Friend functions and classes in prims.cc
|
||||
void _Jv_InitPrimClass (jclass, char *, char, int);
|
||||
void _Jv_InitPrimClass (jclass, const char *, char, int);
|
||||
jstring _Jv_GetMethodString (jclass, _Jv_Method *, jclass = NULL);
|
||||
|
||||
jboolean _Jv_CheckAccess (jclass self_klass, jclass other_klass,
|
||||
|
@ -494,7 +494,7 @@ private:
|
|||
friend void ::_Jv_InitNewClassFields (jclass klass);
|
||||
|
||||
// in prims.cc
|
||||
friend void ::_Jv_InitPrimClass (jclass, char *, char, int);
|
||||
friend void ::_Jv_InitPrimClass (jclass, const char *, char, int);
|
||||
|
||||
friend jstring (::_Jv_GetMethodString) (jclass, _Jv_Method *, jclass);
|
||||
|
||||
|
|
|
@ -1848,9 +1848,9 @@ _Jv_Linker::print_class_loaded (jclass klass)
|
|||
}
|
||||
}
|
||||
if (codesource == NULL)
|
||||
codesource = "<no code source>";
|
||||
codesource = (char *) "<no code source>";
|
||||
|
||||
char *abi;
|
||||
const char *abi;
|
||||
if (_Jv_IsInterpretedClass (klass))
|
||||
abi = "bytecode";
|
||||
else if (_Jv_IsBinaryCompatibilityABI (klass))
|
||||
|
|
|
@ -353,7 +353,7 @@ _Jv_equalUtf8Classnames (const Utf8Const *a, const Utf8Const *b)
|
|||
|
||||
/* Count the number of Unicode chars encoded in a given Ut8 string. */
|
||||
int
|
||||
_Jv_strLengthUtf8(char* str, int len)
|
||||
_Jv_strLengthUtf8(const char* str, int len)
|
||||
{
|
||||
unsigned char* ptr;
|
||||
unsigned char* limit;
|
||||
|
@ -374,7 +374,7 @@ _Jv_strLengthUtf8(char* str, int len)
|
|||
* This returns the same hash value as specified or java.lang.String.hashCode.
|
||||
*/
|
||||
jint
|
||||
_Jv_hashUtf8String (char* str, int len)
|
||||
_Jv_hashUtf8String (const char* str, int len)
|
||||
{
|
||||
unsigned char* ptr = (unsigned char*) str;
|
||||
unsigned char* limit = ptr + len;
|
||||
|
@ -391,7 +391,7 @@ _Jv_hashUtf8String (char* str, int len)
|
|||
}
|
||||
|
||||
void
|
||||
_Jv_Utf8Const::init(char *s, int len)
|
||||
_Jv_Utf8Const::init(const char *s, int len)
|
||||
{
|
||||
::memcpy (data, s, len);
|
||||
data[len] = 0;
|
||||
|
@ -400,7 +400,7 @@ _Jv_Utf8Const::init(char *s, int len)
|
|||
}
|
||||
|
||||
_Jv_Utf8Const *
|
||||
_Jv_makeUtf8Const (char* s, int len)
|
||||
_Jv_makeUtf8Const (const char* s, int len)
|
||||
{
|
||||
if (len < 0)
|
||||
len = strlen (s);
|
||||
|
@ -794,7 +794,7 @@ DECLARE_PRIM_TYPE(double)
|
|||
DECLARE_PRIM_TYPE(void)
|
||||
|
||||
void
|
||||
_Jv_InitPrimClass (jclass cl, char *cname, char sig, int len)
|
||||
_Jv_InitPrimClass (jclass cl, const char *cname, char sig, int len)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ private:
|
|||
return r;
|
||||
}
|
||||
|
||||
__attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1)
|
||||
__attribute__ ((__noreturn__)) void verify_fail (const char *s, jint pc = -1)
|
||||
{
|
||||
using namespace java::lang;
|
||||
StringBuffer *buf = new StringBuffer ();
|
||||
|
|
Loading…
Add table
Reference in a new issue