8313564: Fix -Wconversion warnings in classfile code

Reviewed-by: matsaave, dholmes
This commit is contained in:
Coleen Phillimore 2023-08-04 14:06:16 +00:00
parent e8a37b90db
commit f66cd5008d
19 changed files with 57 additions and 52 deletions

View file

@ -218,7 +218,7 @@ Symbol* ClassLoader::package_from_class_name(const Symbol* name, bool* bad_class
}
return nullptr;
}
return SymbolTable::new_symbol(name, start - base, end - base);
return SymbolTable::new_symbol(name, pointer_delta_as_int(start, base), pointer_delta_as_int(end, base));
}
// Given a fully qualified package name, find its defining package in the class loader's
@ -269,9 +269,11 @@ ClassFileStream* ClassPathDirEntry::open_stream(JavaThread* current, const char*
// debug builds so that we guard against use-after-free bugs.
FREE_RESOURCE_ARRAY_IN_THREAD(current, char, path, path_len);
#endif
// We don't verify the length of the classfile stream fits in an int, but this is the
// bootloader so we have control of this.
// Resource allocated
return new ClassFileStream(buffer,
st.st_size,
checked_cast<int>(st.st_size),
_dir,
ClassFileStream::verify);
}
@ -420,7 +422,7 @@ ClassFileStream* ClassPathImageEntry::open_stream_for_loader(JavaThread* current
// Resource allocated
assert(this == (ClassPathImageEntry*)ClassLoader::get_jrt_entry(), "must be");
return new ClassFileStream((u1*)data,
(int)size,
checked_cast<int>(size),
_name,
ClassFileStream::verify,
true); // from_boot_loader_modules_image