< prev index next >

src/java.base/share/native/libjimage/imageDecompressor.cpp

Print this page




 173 void SharedStringDecompressor::decompress_resource(u1* data,
 174                 u1* uncompressed_resource,
 175                 ResourceHeader* header, const ImageStrings* strings) {
 176     u1* uncompressed_base = uncompressed_resource;
 177     u1* data_base = data;
 178     int header_size = 8; // magic + major + minor
 179     memcpy(uncompressed_resource, data, header_size + 2); //+ cp count
 180     uncompressed_resource += header_size + 2;
 181     data += header_size;
 182     u2 cp_count = Endian::get_java(data);
 183     data += 2;
 184     for (int i = 1; i < cp_count; i++) {
 185         u1 tag = *data;
 186         data += 1;
 187         switch (tag) {
 188 
 189             case externalized_string:
 190             { // String in Strings table
 191                 *uncompressed_resource = 1;
 192                 uncompressed_resource += 1;
 193                 int i = decompress_int(data);
 194                 const char * string = strings->get(i);
 195                 int str_length = (int) strlen(string);
 196                 Endian::set_java(uncompressed_resource, str_length);
 197                 uncompressed_resource += 2;
 198                 memcpy(uncompressed_resource, string, str_length);
 199                 uncompressed_resource += str_length;
 200                 break;
 201             }
 202             // Descriptor String has been split and types added to Strings table
 203             case externalized_string_descriptor:
 204             {
 205                 *uncompressed_resource = 1;
 206                 uncompressed_resource += 1;
 207                 int descriptor_index = decompress_int(data);
 208                 int indexes_length = decompress_int(data);
 209                 u1* length_address = uncompressed_resource;
 210                 uncompressed_resource += 2;
 211                 int desc_length = 0;
 212                 const char * desc_string = strings->get(descriptor_index);
 213                 if (indexes_length > 0) {
 214                     u1* indexes_base = data;




 173 void SharedStringDecompressor::decompress_resource(u1* data,
 174                 u1* uncompressed_resource,
 175                 ResourceHeader* header, const ImageStrings* strings) {
 176     u1* uncompressed_base = uncompressed_resource;
 177     u1* data_base = data;
 178     int header_size = 8; // magic + major + minor
 179     memcpy(uncompressed_resource, data, header_size + 2); //+ cp count
 180     uncompressed_resource += header_size + 2;
 181     data += header_size;
 182     u2 cp_count = Endian::get_java(data);
 183     data += 2;
 184     for (int i = 1; i < cp_count; i++) {
 185         u1 tag = *data;
 186         data += 1;
 187         switch (tag) {
 188 
 189             case externalized_string:
 190             { // String in Strings table
 191                 *uncompressed_resource = 1;
 192                 uncompressed_resource += 1;
 193                 int k = decompress_int(data);
 194                 const char * string = strings->get(k);
 195                 int str_length = (int) strlen(string);
 196                 Endian::set_java(uncompressed_resource, str_length);
 197                 uncompressed_resource += 2;
 198                 memcpy(uncompressed_resource, string, str_length);
 199                 uncompressed_resource += str_length;
 200                 break;
 201             }
 202             // Descriptor String has been split and types added to Strings table
 203             case externalized_string_descriptor:
 204             {
 205                 *uncompressed_resource = 1;
 206                 uncompressed_resource += 1;
 207                 int descriptor_index = decompress_int(data);
 208                 int indexes_length = decompress_int(data);
 209                 u1* length_address = uncompressed_resource;
 210                 uncompressed_resource += 2;
 211                 int desc_length = 0;
 212                 const char * desc_string = strings->get(descriptor_index);
 213                 if (indexes_length > 0) {
 214                     u1* indexes_base = data;


< prev index next >