return rc == Z_OK && strm.avail_out == 0;
}
+static bfd_size_type
+get_uncompressed_size (bfd_byte *uncompressed_size_buffer)
+{
+ bfd_size_type uncompressed_size = uncompressed_size_buffer[0];
+ uncompressed_size <<= 8;
+ uncompressed_size += uncompressed_size_buffer[1];
+ uncompressed_size <<= 8;
+ uncompressed_size += uncompressed_size_buffer[2];
+ uncompressed_size <<= 8;
+ uncompressed_size += uncompressed_size_buffer[3];
+ uncompressed_size <<= 8;
+ uncompressed_size += uncompressed_size_buffer[4];
+ uncompressed_size <<= 8;
+ uncompressed_size += uncompressed_size_buffer[5];
+ uncompressed_size <<= 8;
+ uncompressed_size += uncompressed_size_buffer[6];
+ uncompressed_size <<= 8;
+ uncompressed_size += uncompressed_size_buffer[7];
+ return uncompressed_size;;
+}
+
/* Compress data of the size specified in @var{uncompressed_size}
and pointed to by @var{uncompressed_buffer} using zlib and store
as the contents field. This function assumes the contents
return FALSE;
}
- uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8;
- uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8;
- uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8;
- uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8;
- uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8;
- uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8;
- uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8;
- uncompressed_size += compressed_buffer[11];
-
+ uncompressed_size = get_uncompressed_size (compressed_buffer + 4);
sec->compressed_size = sec->size;
sec->size = uncompressed_size;
sec->compress_status = DECOMPRESS_SECTION_SIZED;