src/java.base/share/native/libjimage/imageFile.cpp
Print this page
*** 116,126 ****
// direct indexing. Unspecified values default to zero (from constructor.)
void ImageLocation::set_data(u1* data) {
// Deflate the attribute stream into an array of attributes.
u1 byte;
// Repeat until end header is found.
! while ((byte = *data)) {
// Extract kind from header byte.
u1 kind = attribute_kind(byte);
assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
// Extract length of data (in bytes).
u1 n = attribute_length(byte);
--- 116,126 ----
// direct indexing. Unspecified values default to zero (from constructor.)
void ImageLocation::set_data(u1* data) {
// Deflate the attribute stream into an array of attributes.
u1 byte;
// Repeat until end header is found.
! while ((data != NULL) && (byte = *data)) {
// Extract kind from header byte.
u1 kind = attribute_kind(byte);
assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
// Extract length of data (in bytes).
u1 n = attribute_length(byte);
*** 189,199 ****
}
// Release module data resource.
ImageModuleData::~ImageModuleData() {
if (_data) {
! delete _data;
}
}
// Return the name of the module data resource. Ex. "./lib/modules/file.jimage"
// yields "file.jdata"
--- 189,199 ----
}
// Release module data resource.
ImageModuleData::~ImageModuleData() {
if (_data) {
! delete[] _data;
}
}
// Return the name of the module data resource. Ex. "./lib/modules/file.jimage"
// yields "file.jdata"
*** 272,282 ****
ImageFileReaderTable::ImageFileReaderTable() : _count(0), _max(_growth) {
_table = new ImageFileReader*[_max];
}
ImageFileReaderTable::~ImageFileReaderTable() {
! delete _table;
}
// Add a new image entry to the table.
void ImageFileReaderTable::add(ImageFileReader* image) {
if (_count == _max) {
--- 272,282 ----
ImageFileReaderTable::ImageFileReaderTable() : _count(0), _max(_growth) {
_table = new ImageFileReader*[_max];
}
ImageFileReaderTable::~ImageFileReaderTable() {
! delete[] _table;
}
// Add a new image entry to the table.
void ImageFileReaderTable::add(ImageFileReader* image) {
if (_count == _max) {
*** 412,422 ****
ImageFileReader::~ImageFileReader() {
// Ensure file is closed.
close();
// Free up name.
if (_name) {
! delete _name;
_name = NULL;
}
}
// Open image file for read access.
--- 412,422 ----
ImageFileReader::~ImageFileReader() {
// Ensure file is closed.
close();
// Free up name.
if (_name) {
! delete[] _name;
_name = NULL;
}
}
// Open image file for read access.
*** 666,676 ****
// Decompress resource.
ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, (u4)uncompressed_size,
&strings);
// If not memory mapped then release temporary buffer.
if (!MemoryMapImage) {
! delete compressed_data;
}
} else {
// Read bytes from offset beyond the image index.
bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset);
assert(is_read && "error reading from image or short read");
--- 666,676 ----
// Decompress resource.
ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, (u4)uncompressed_size,
&strings);
// If not memory mapped then release temporary buffer.
if (!MemoryMapImage) {
! delete[] compressed_data;
}
} else {
// Read bytes from offset beyond the image index.
bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset);
assert(is_read && "error reading from image or short read");