* boehm.c (set_bit): Improve type safety wrt unsignedness.
* gjavah.c (throwable_p, decode_signature_piece,
print_full_cxx_name, print_include, add_namelet, add_class_decl,
process_file): Likewise.
* jcf-dump.c (main): Likewise.
* jcf-io.c (read_zip_member): Likewise.
* jcf-parse.c (HANDLE_CONSTANT_Utf8, get_constant,
give_name_to_class, get_class_constant): Likewise.
* jcf-write.c (find_constant_wide, push_long_const,
generate_classfile): Likewise.
* lex.c (java_new_lexer, java_read_char, cxx_keyword_p): Likewise.
* parse.y (read_import_dir): Likewise.
* typeck.c (parse_signature_type): Likewise.
* verify.c (verify_jvm_instructions): Likewise.
* zextract.c (find_zip_file_start, read_zip_archive): Likewise.
From-SVN: r85102
+2004-07-23 Mike Stump <mrs@apple.com>
+
+ * boehm.c (set_bit): Improve type safety wrt unsignedness.
+ * gjavah.c (throwable_p, decode_signature_piece,
+ print_full_cxx_name, print_include, add_namelet, add_class_decl,
+ process_file): Likewise.
+ * jcf-dump.c (main): Likewise.
+ * jcf-io.c (read_zip_member): Likewise.
+ * jcf-parse.c (HANDLE_CONSTANT_Utf8, get_constant,
+ give_name_to_class, get_class_constant): Likewise.
+ * jcf-write.c (find_constant_wide, push_long_const,
+ generate_classfile): Likewise.
+ * lex.c (java_new_lexer, java_read_char, cxx_keyword_p): Likewise.
+ * parse.y (read_import_dir): Likewise.
+ * typeck.c (parse_signature_type): Likewise.
+ * verify.c (verify_jvm_instructions): Likewise.
+ * zextract.c (find_zip_file_start, read_zip_archive): Likewise.
+
2004-07-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* Make-lang.in: Replace rmic and rmiregistry references with
set_bit (unsigned HOST_WIDE_INT *low, unsigned HOST_WIDE_INT *high,
unsigned int n)
{
- HOST_WIDE_INT *which;
+ unsigned HOST_WIDE_INT *which;
if (n >= HOST_BITS_PER_WIDE_INT)
{
else
which = low;
- *which |= (HOST_WIDE_INT) 1 << n;
+ *which |= (unsigned HOST_WIDE_INT) 1 << n;
}
/* Recursively mark reference fields. */
(htab_del) free);
/* Make sure the root classes show up in the tables. */
- str = xstrdup ("java.lang.Throwable");
+ str = (unsigned char *) xstrdup ("java.lang.Throwable");
slot = htab_find_slot (throw_hash, str, INSERT);
*slot = str;
- str = xstrdup ("java.lang.Object");
+ str = (unsigned char *) xstrdup ("java.lang.Object");
slot = htab_find_slot (non_throw_hash, str, INSERT);
*slot = str;
void **slot;
unsigned char *super, *tmp;
int super_length = -1;
- const char *classfile_name = find_class (current, strlen (current),
+ const char *classfile_name = find_class ((char *) current, strlen ((const char *) current),
&jcf, 0);
if (! classfile_name)
if (flag_jni)
{
/* We know about certain types and special-case their names. */
- if (! strncmp (signature, "Ljava/lang/String;",
+ if (! strncmp ((const char *) signature, "Ljava/lang/String;",
sizeof ("Ljava/lang/String;") -1))
ctype = "jstring";
- else if (! strncmp (signature, "Ljava/lang/Class;",
+ else if (! strncmp ((const char *) signature, "Ljava/lang/Class;",
sizeof ("Ljava/lang/Class;") - 1))
ctype = "jclass";
/* Skip leading 'L' for throwable_p call. */
int sig_len = JPOOL_UTF_LENGTH (jcf, signature_index);
if (overloaded_jni_method_exists_p (JPOOL_UTF_DATA (jcf, name_index),
JPOOL_UTF_LENGTH (jcf, name_index),
- signature, sig_len))
+ (const char *) signature, sig_len))
{
/* If this method is overloaded by another native method,
then include the argument information in the mangled
return;
if (len == -1)
- len = strlen (utf8);
+ len = strlen ((const char *) utf8);
for (incl = all_includes; incl; incl = incl->next)
{
/* We check the length because we might have a proper prefix. */
if (len == (int) strlen (incl->name)
- && ! strncmp (incl->name, utf8, len))
+ && ! strncmp (incl->name, (const char *) utf8, len))
return;
}
incl = xmalloc (sizeof (struct include));
incl->name = xmalloc (len + 1);
- strncpy (incl->name, utf8, len);
+ strncpy (incl->name, (const char *) utf8, len);
incl->name[len] = '\0';
incl->next = all_includes;
all_includes = incl;
#define JAVAIO "java/io/"
#define JAVAUTIL "java/util/"
if ((name_limit - name >= (int) sizeof (JAVALANG) - 1
- && ! strncmp (name, JAVALANG, sizeof (JAVALANG) - 1))
+ && ! strncmp ((const char *) name, JAVALANG, sizeof (JAVALANG) - 1))
|| (name_limit - name >= (int) sizeof (JAVAUTIL) - 1
- && ! strncmp (name, JAVAUTIL, sizeof (JAVAUTIL) - 1))
+ && ! strncmp ((const char *) name, JAVAUTIL, sizeof (JAVAUTIL) - 1))
|| (name_limit - name >= (int) sizeof (JAVAIO) - 1
- && ! strncmp (name, JAVAIO, sizeof (JAVAIO) - 1)))
+ && ! strncmp ((const char *) name, JAVAIO, sizeof (JAVAIO) - 1)))
return;
}
{
/* We check the length because we might have a proper prefix. */
if ((int) strlen (np->name) == p - name &&
- ! strncmp (name, np->name, p - name))
+ ! strncmp ((const char *) name, np->name, p - name))
{
n = np;
break;
{
n = xmalloc (sizeof (struct namelet));
n->name = xmalloc (p - name + 1);
- strncpy (n->name, name, p - name);
+ strncpy (n->name, (const char *) name, p - name);
n->name[p - name] = '\0';
n->is_class = (p == name_limit);
n->subnamelets = NULL;
/* If we see an array, then we include the array header. */
if (s[i] == '[')
{
- print_include (out, "gcj/array", -1);
+ print_include (out, (const unsigned char *) "gcj/array", -1);
continue;
}
for (i = 0; i < len; ++i)
name[i] = jcf->classname[i] == '.' ? '/' : jcf->classname[i];
name[i] = '\0';
- print_include (out, name, len);
+ print_include (out, (const unsigned char *) name, len);
free (name);
if (! flag_jni)
{
- print_include (out, "gcj/cni", -1);
- print_include (out, "java/lang/UnsupportedOperationException",
+ print_include (out, (const unsigned char *) "gcj/cni", -1);
+ print_include (out, (const unsigned char *) "java/lang/UnsupportedOperationException",
-1);
}
}
if (jcf->read_end - jcf->read_ptr < total_length)
jcf_trim_old_input (jcf);
JCF_FILL (jcf, total_length);
- filename = jcf->read_ptr;
+ filename = (const char *) jcf->read_ptr;
JCF_SKIP (jcf, filename_length);
JCF_SKIP (jcf, extra_length);
if (filename_length > 0
jcf->read_ptr = jcf->buffer;
jcf->read_end = jcf->buffer_end;
buffer = ALLOC (zipd->size);
- d_stream.next_in = buffer;
+ d_stream.next_in = (unsigned char *) buffer;
d_stream.avail_in = zipd->size;
if (lseek (zipf->fd, zipd->filestart, 0) < 0
|| read (zipf->fd, buffer, zipd->size) != (long) zipd->size)
text = (JCF)->read_ptr; \
save = text[LENGTH]; \
text[LENGTH] = 0; \
- (JCF)->cpool.data[INDEX].t = get_identifier (text); \
+ (JCF)->cpool.data[INDEX].t = get_identifier ((const char *) text); \
text[LENGTH] = save; \
JCF_SKIP (JCF, LENGTH); } while (0)
case CONSTANT_Long:
{
unsigned HOST_WIDE_INT num = JPOOL_UINT (jcf, index);
- HOST_WIDE_INT lo, hi;
+ unsigned HOST_WIDE_INT lo;
+ HOST_WIDE_INT hi;
lshift_double (num, 0, 32, 64, &lo, &hi, 0);
num = JPOOL_UINT (jcf, index+1);
add_double (lo, hi, num, 0, &lo, &hi);
tree this_class;
int j = JPOOL_USHORT1 (jcf, i);
/* verify_constant_pool confirmed that j is a CONSTANT_Utf8. */
- tree class_name = unmangle_classname (JPOOL_UTF_DATA (jcf, j),
+ tree class_name = unmangle_classname ((const char *) JPOOL_UTF_DATA (jcf, j),
JPOOL_UTF_LENGTH (jcf, j));
this_class = lookup_class (class_name);
input_filename = DECL_SOURCE_FILE (TYPE_NAME (this_class));
{
int name_index = JPOOL_USHORT1 (jcf, i);
/* verify_constant_pool confirmed that name_index is a CONSTANT_Utf8. */
- const char *name = JPOOL_UTF_DATA (jcf, name_index);
+ const char *name = (const char *) JPOOL_UTF_DATA (jcf, name_index);
int nlength = JPOOL_UTF_LENGTH (jcf, name_index);
if (name[0] == '[') /* Handle array "classes". */
- type = TREE_TYPE (parse_signature_string (name, nlength));
+ type = TREE_TYPE (parse_signature_string ((const unsigned char *) name, nlength));
else
{
tree cname = unmangle_classname (name, nlength);
find_constant_wide (HOST_WIDE_INT lo, HOST_WIDE_INT hi,
struct jcf_partial *state)
{
- HOST_WIDE_INT w1, w2;
+ unsigned HOST_WIDE_INT w1;
+ HOST_WIDE_INT w2;
lshift_double (lo, hi, -32, 64, &w1, &w2, 1);
return find_constant2 (&state->cpool, CONSTANT_Long,
(jword)(w1 & 0xFFFFFFFF), (jword)(lo & 0xFFFFFFFF));
static void
push_long_const (HOST_WIDE_INT lo, HOST_WIDE_INT hi, struct jcf_partial *state)
{
- HOST_WIDE_INT highpart, dummy;
+ unsigned HOST_WIDE_INT highpart;
+ HOST_WIDE_INT dummy;
jint lowpart = WORD_TO_INT (lo);
rshift_double (lo, hi, 32, 64, &highpart, &dummy, 1);
OP1(OPCODE_lconst_0 + lowpart);
}
else if ((highpart == 0 && lowpart > 0 && lowpart < 32768)
- || (highpart == -1 && lowpart < 0 && lowpart >= -32768))
+ || (highpart == (unsigned HOST_WIDE_INT)-1
+ && lowpart < 0 && lowpart >= -32768))
{
push_int_const (lowpart, state);
RESERVE (1);
{
struct chunk *cpool_chunk;
const char *source_file, *s;
- char *ptr;
+ unsigned char *ptr;
int i;
- char *fields_count_ptr;
+ unsigned char *fields_count_ptr;
int fields_count = 0;
- char *methods_count_ptr;
+ unsigned char *methods_count_ptr;
int methods_count = 0;
tree part;
int total_supers
int code_attributes_count = 0;
static tree Code_node = NULL_TREE;
tree t;
- char *attr_len_ptr;
+ unsigned char *attr_len_ptr;
struct jcf_handler *handler;
if (Code_node == NULL_TREE)
Code_node = get_identifier ("Code");
in[1] = 0xbb;
in[2] = 0xbf;
- inp = in;
+ inp = (char *) in;
inc = 3;
outp = (char *) &result;
outc = 2;
in_save = inbytesleft;
out_save = out_count;
inp = &lex->buffer[lex->first];
- outp = &lex->out_buffer[lex->out_last];
+ outp = (char *) &lex->out_buffer[lex->out_last];
ir = iconv (lex->handle, (ICONV_CONST char **) &inp,
&inbytesleft, &outp, &out_count);
{
int kwl = strlen (cxx_keywords[mid]);
int min_length = kwl > length ? length : kwl;
- int r = utf8_cmp (name, min_length, cxx_keywords[mid]);
+ int r = utf8_cmp ((const unsigned char *) name, min_length, cxx_keywords[mid]);
if (r == 0)
{
buffer_grow (filename, entry_length);
memcpy (filename->data, entry_name, entry_length - 1);
filename->data[entry_length-1] = '\0';
- zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
+ zipf = opendir_in_zip ((const char *) filename->data, jcf_path_is_system (entry));
if (zipf == NULL)
error ("malformed .zip archive in CLASSPATH: %s", entry_name);
else
int current_entry_len = zipd->filename_length;
if (current_entry_len >= BUFFER_LENGTH (filename)
- && strncmp (filename->data, current_entry,
+ && strncmp ((const char *) filename->data, current_entry,
BUFFER_LENGTH (filename)) != 0)
continue;
found |= note_possible_classname (current_entry,
{
BUFFER_RESET (filename);
buffer_grow (filename, entry_length + package_length + 4);
- strcpy (filename->data, entry_name);
+ strcpy ((char *) filename->data, entry_name);
filename->ptr = filename->data + entry_length;
for (k = 0; k < package_length; k++)
{
}
*filename->ptr = '\0';
- dirp = opendir (filename->data);
+ dirp = opendir ((const char *) filename->data);
if (dirp == NULL)
continue;
*filename->ptr++ = '/';
d_name = direntp->d_name;
len = strlen (direntp->d_name);
buffer_grow (filename, len+1);
- strcpy (filename->ptr, d_name);
- found |= note_possible_classname (filename->data + entry_length,
+ strcpy ((char *) filename->ptr, d_name);
+ found |= note_possible_classname ((const char *) filename->data + entry_length,
package_length+len+1);
}
if (dirp)
break;
}
*ptr = str+1;
- type = lookup_class (unmangle_classname (start, str - start));
+ type = lookup_class (unmangle_classname ((const char *) start, str - start));
break;
}
default:
self_is_interface = CLASS_INTERFACE (TYPE_NAME (self_type));
method_name = COMPONENT_REF_NAME (¤t_jcf->cpool, index);
- method_type = parse_signature_string (IDENTIFIER_POINTER (sig),
+ method_type = parse_signature_string ((const unsigned char *) IDENTIFIER_POINTER (sig),
IDENTIFIER_LENGTH (sig));
if (TREE_CODE (method_type) != FUNCTION_TYPE)
if (read (fd, buffer, LREC_SIZE + 4) != LREC_SIZE + 4)
return -1;
- if (buffer[0] != 'P' || strncmp (&buffer[1], LOCAL_HDR_SIG, 3))
+ if (buffer[0] != 'P' || strncmp ((const char *) &buffer[1], LOCAL_HDR_SIG, 3))
return -1;
filename_length = makeword (&buffer[4 + L_FILENAME_LENGTH]);
return -1;
if (read (zipf->fd, buffer, ECREC_SIZE+4) != ECREC_SIZE+4)
return -2;
- zipf->count = makeword(&buffer[TOTAL_ENTRIES_CENTRAL_DIR]);
- zipf->dir_size = makelong(&buffer[SIZE_CENTRAL_DIRECTORY]);
+ zipf->count = makeword((const uch *) &buffer[TOTAL_ENTRIES_CENTRAL_DIR]);
+ zipf->dir_size = makelong((const uch *) &buffer[SIZE_CENTRAL_DIRECTORY]);
#define ALLOC xmalloc
/* Allocate 1 more to allow appending '\0' to last filename. */
zipf->central_directory = ALLOC (zipf->dir_size+1);
printf ("total_entries_central_dir = %d\n",
makeword(&buffer[TOTAL_ENTRIES_CENTRAL_DIR]));
printf ("size_central_directory = %d\n",
- makelong(&buffer[SIZE_CENTRAL_DIRECTORY]));
+ makelong((const uch *) &buffer[SIZE_CENTRAL_DIRECTORY]));
printf ("offset_start_central_directory = %d\n",
- makelong(&buffer[OFFSET_START_CENTRAL_DIRECTORY]));
+ makelong((const uch *) &buffer[OFFSET_START_CENTRAL_DIRECTORY]));
printf ("zipfile_comment_length = %d\n",
makeword(&buffer[ZIPFILE_COMMENT_LENGTH]));
#endif
{
ZipDirectory *zipd = (ZipDirectory*)(dir_ptr + dir_last_pad);
int compression_method = (int) dir_ptr[4+C_COMPRESSION_METHOD];
- long size = makelong (&dir_ptr[4+C_COMPRESSED_SIZE]);
- long uncompressed_size = makelong (&dir_ptr[4+C_UNCOMPRESSED_SIZE]);
- long filename_length = makeword (&dir_ptr[4+C_FILENAME_LENGTH]);
- long extra_field_length = makeword (&dir_ptr[4+C_EXTRA_FIELD_LENGTH]);
- long file_offset = makelong (&dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER]);
+ long size = makelong ((const uch *) &dir_ptr[4+C_COMPRESSED_SIZE]);
+ long uncompressed_size = makelong ((const uch *) &dir_ptr[4+C_UNCOMPRESSED_SIZE]);
+ long filename_length = makeword ((const uch *) &dir_ptr[4+C_FILENAME_LENGTH]);
+ long extra_field_length = makeword ((const uch *) &dir_ptr[4+C_EXTRA_FIELD_LENGTH]);
+ long file_offset = makelong ((const uch *) &dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER]);
int unpadded_direntry_length;
if ((dir_ptr-zipf->central_directory)+filename_length+CREC_SIZE+4>zipf->dir_size)
return -1;