/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// -*- C++ -*-
// Program for unpacking specially compressed Java packages.
// John R. Rose
/*
* When compiling for a 64bit LP64 system (longs and pointers being 64bits),
* the printf format %ld is correct and use of %lld will cause warning
* errors from some compilers (gcc/g++).
* _LP64 can be explicitly set (used on Linux).
* Solaris compilers will define __sparcv9 or __x86_64 on 64bit compilations.
*/
#else
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <time.h>
#include "defines.h"
#include "bytes.h"
#include "utils.h"
#include "coding.h"
#include "bands.h"
#include "constants.h"
#include "zip.h"
#include "unpack.h"
// tags, in canonical order:
};
#ifndef PRODUCT
static const char* TAG_NAME[] = {
"*None",
"Utf8",
"*Unicode",
"Integer",
"Float",
"Long",
"Double",
"Class",
"String",
"Fieldref",
"Methodref",
"InterfaceMethodref",
"NameandType",
"*Signature",
0
};
"class", "field", "method", "code"
};
#else
#endif
// REQUESTED must be -2 for u2 and REQUESTED_LDC must be -1 for u1
struct entry {
#if 0
enum {
//EB_EXTRA = 1,
EB_SUPER = 2
};
#endif
int outputIndex;
// put last to pack best
union {
bytes b;
int i;
jlong l;
} value;
int getOutputIndex() {
return outputIndex;
}
}
const char* utf8String() {
}
return ref(0);
}
return ref(0);
}
return ref(1);
}
return ref(0);
}
return ref(1);
}
int typeSize();
#ifndef PRODUCT
|| (tag2 == CONSTANT_Literal
|| (tag2 == CONSTANT_Member
#endif
;
}
#ifdef PRODUCT
char* string() { return 0; }
#else
char* string(); // see far below
#endif
};
if (i >= len)
return null;
// primary index
return &base1[i];
else
// secondary index
return base2[i];
}
return value.b;
}
switch (*sigp) {
case 'D':
case 'J': return 2; // double field
default: return 1; // field
}
int siglen = 0;
for (;;) {
switch (ch) {
case 'D': case 'J':
siglen += 1;
break;
case '[':
// Skip rest of array info.
if (ch != 'L') break;
// else fall through
case 'L':
unpack_abort("bad data");
return 0;
}
sigp += 1;
break;
case ')': // closing ')'
return siglen;
}
siglen += 1;
}
}
}
}
struct inner_class {
int flags;
bool requested;
};
// Here is where everything gets deallocated:
int i;
// free everybody ever allocated with U_NEW or (recently) with T_NEW
for (i = 0; i < ATTR_CONTEXT_LIMIT; i++)
// free CP state
for (i = 0; i < CONSTANT_Limit; i++)
}
// input handling
// Attempts to advance rplimit so that (rplimit-rp) is at least 'more'.
// Will eagerly read ahead by larger chunks, if possible.
// Returns false if (rplimit-rp) is not at least 'more',
// unless rplimit hits input.limit().
if (read_input_fn == null) {
// assume it is already all there
return true;
}
if (fetch < CHUNK_SIZE)
fetch = CHUNK_SIZE;
// Try to fetch at least "more" bytes.
if (nr <= 0) {
}
bytes_read += nr;
}
return true;
}
// output handling
} else {
}
}
//wpbase = null;
return which;
}
//maybe_inline
// Determine which segment needs expanding.
}
}
return wp0;
}
if (n != (unsigned short)n) {
return;
}
wp[0] = (n) >> 8;
wp[1] = (n) >> 0;
}
wp[0] = (n) >> 24;
wp[3] = (n) >> 0;
}
}
}
}
}
if (e == null)
return 0;
else if (e->outputIndex > NOT_REQUESTED)
return e->outputIndex;
else if (e->tag == CONSTANT_Signature)
else {
// Later on we'll fix the bits.
class_fixup_ref.add(e);
#ifdef PRODUCT
return 0;
#else
#endif
}
}
}
}
static int total_cp_size[] = {0, 0};
static int largest_cp_ref[] = {0, 0};
static int hash_probes[] = {0, 0};
// Allocation of small and large blocks.
// Call malloc. Try to combine small blocks and free much later.
return res;
}
}
}
if (aborting()) {
b.len = 0;
return;
}
}
// Read up through band_headers.
// Do the archive_size dance to set the size of the input mega-buffer.
// Read file header to determine file type and total size.
enum {
// Length contributions from optional header fields:
};
// An absolute minimum null archive is magic[4], {minver,majver,options}[3],
// archive_size[0], cp_counts[8], class_counts[4], for a total of 19 bytes.
// (Note that archive_size is optional; it may be 0..10 bytes in length.)
// The first read must capture everything up through the options field.
// This happens to work even if {minver,majver,options} is a pathological
// 15 bytes long. Legal pack files limit those three fields to 1+1+2 bytes.
// Up through archive_size, the largest possible archive header is
// magic[4], {minver,majver,options}[4], archive_size[10].
// (Note only the low 12 bits of options are allowed to be non-zero.)
// In order to parse archive_size, we need at least this many bytes
// in the first read. Of course, if archive_size_hi is more than
// a byte, we probably will fail to allocate the buffer, since it
// will be many gigabytes long. This is a practical, not an
// architectural limit to Pack200 archive sizes.
if (foreign_buf) {
// inbytes is all there is
} else {
// inbytes, if not empty, contains some read-ahead we must use first
// ensure_input will take care of copying it into initbuf,
// then querying read_input_fn for any additional data needed.
// However, the caller must assume that we use up all of inbytes.
// There is no way to tell the caller that we used only part of them.
// Therefore, the caller must use only a bare minimum of read-ahead.
abort("too much read-ahead");
return;
}
}
// Read only 19 bytes, which is certain to contain #archive_options fields,
// but is certain not to overflow past the archive_header.
if (!ensure_input(FIRST_READ))
abort("EOF reading archive magic number");
#ifdef UNPACK_JNI
// Java driver must handle this case before we get this far.
abort("encountered a JAR header in unpacker");
#else
// In the Unix-style program, we simply simulate a copy command.
// Copy until EOF; assume the JAR file is the last segment.
for (;;) {
if (foreign_buf)
break; // one-time use of a passed in buffer
// Get some breathing room.
}
if (!ensure_input(1))
break;
}
jarout->closeJarFile(false);
#endif
return;
}
// Read the magic number.
magic = 0;
magic <<= 8;
}
// Read the first 3 values from the header.
int hdrVals = 0;
hdrVals += 2;
if (magic != (int)JAVA_PACKAGE_MAGIC ||
"%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d\n",
}
hdrVals += 1;
if ((archive_options & ~OPTION_LIMIT) != 0) {
abort("illegal archive options");
return;
}
if ((archive_options & AO_HAVE_FILE_HEADERS) != 0) {
archive_size = (size_t) x;
if (archive_size != x) {
// Silly size specified; force overflow.
}
hdrVals += 2;
} else {
hdrValsSkipped += 2;
}
// Now we can size the whole archive.
// Read everything else into a mega-buffer.
if (foreign_buf) {
abort("EOF reading fixed input buffer");
return;
}
} else if (archive_size != 0) {
if (archive_size < ARCHIVE_SIZE_MIN) {
return;
}
if (archive_size < header_size_1) {
return;
}
// Move all the bytes we read initially into the real buffer.
} else {
// It's more complicated and painful.
// A zero archive_size means that we must read until EOF.
// Set up input buffer as if we already read the header:
rplimit += header_size;
}
free_input = true; // free it later
}
live_input = true; // mark as "do not reuse"
if (aborting()) {
abort("cannot allocate large input buffer for package file");
return;
}
// read the rest of the header fields
if ((archive_options & AO_HAVE_FILE_HEADERS) != 0) {
hdrVals += 3;
} else {
hdrValsSkipped += 3;
}
if ((archive_options & AO_HAVE_SPECIAL_FORMATS) != 0) {
hdrVals += 2;
} else {
hdrValsSkipped += 2;
}
for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
if (!(archive_options & AO_HAVE_CP_NUMBERS)) {
switch (TAGS_IN_ORDER[k]) {
case CONSTANT_Integer:
case CONSTANT_Float:
case CONSTANT_Long:
case CONSTANT_Double:
cp_counts[k] = 0;
hdrValsSkipped += 1;
continue;
}
}
CHECK_COUNT(cp_counts[k]);
hdrVals += 1;
}
hdrVals += 4;
// done with archive_header
#ifndef PRODUCT
if ((archive_options & AO_HAVE_FILE_HEADERS) != 0)
if ((archive_options & AO_HAVE_SPECIAL_FORMATS) != 0)
if ((archive_options & AO_HAVE_CP_NUMBERS) != 0)
#endif //PRODUCT
abort("EOF reading archive header");
// Now size the CP.
#ifndef PRODUCT
assert(x);
#endif //PRODUCT
if ((archive_options & AO_DEFLATE_HINT) != 0)
// meta-bytes, if any, immediately follow archive header
//band_headers.readData(band_headers_size);
abort("EOF reading band headers");
return;
}
// The "1+" allows an initial byte to be pushed on the front.
// Start scanning band headers here:
// Put evil meta-codes at the end of the band headers,
// so we are sure to throw an error if we run off the end.
}
if (verbose >= 1) {
"A total of "
LONG_LONG_FORMAT " bytes were read in %d segment(s).\n",
"A total of "
LONG_LONG_FORMAT " file content bytes were written.\n",
"A total of %d files (of which %d are classes) were written to output.\n",
}
jarout->closeJarFile(true);
} else {
}
errstrm_name = null;
}
}
// Cf. PackageReader.readConstantPoolCounts
this->u = u_;
// Fill-pointer for CP.
int next_entry = 0;
// Size the constant pool:
for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
next_entry += len;
// Detect and defend against constant pool size overflow.
// (Pack200 forbids the sum of CP counts to exceed 2^29-1.)
enum {
};
abort("archive too large: constant pool limit exceeded");
return;
}
}
// Close off the end of the CP:
// place a limit on future CP growth:
int generous = 0;
// Note that this CP does not include "empty" entries
// for longs and doubles. Those are introduced when
// the entries are renumbered for classfile output.
// Initialize the standard indexes.
tag_base[ CONSTANT_All] = 0;
}
// Initialize hashTab to a generous power-of-two size.
}
} else if (ch <= 0x07FF) {
} else {
}
return cp;
}
for (;; cp++) {
if (len-- == 0)
return cp;
return cp+1;
}
}
}
int c0 = 0;
for (int i = 0; i < l0; i++) {
// Before returning the obvious answer,
// check to see if c1 or c2 is part of a 0x0000,
// which encodes as {0xC0,0x80}. The 0x0000 is the
// lowest-sorting Java char value, and yet it encodes
// as if it were the first char after 0x7F, which causes
// strings containing nulls to sort too high. All other
// comparisons are consistent between Utf8 and Java chars.
if (c0 == 0xC0) {
}
}
}
// common prefix is identical; return length difference if any
}
// Cf. PackageReader.readUtf8Bands
// Implicit first Utf8 string is the empty string.
enum {
// certain bands begin with implicit zeroes
};
int i;
// First band: Read lengths of shared prefixes.
if (len > PREFIX_SKIP_2)
// Second band: Read lengths of unshared suffixes:
if (len > SUFFIX_SKIP_1)
int nbigsuf = 0;
// Third band: Read the char values in the unshared suffixes:
for (i = 0; i < len; i++) {
if (suffix < 0) {
abort("bad utf8 suffix");
return;
}
if (suffix == 0 && i >= SUFFIX_SKIP_1) {
// chars are packed in cp_Utf8_big_chars
nbigsuf += 1;
continue;
}
if (isMalloc) {
} else {
}
}
for (int j = 0; j < suffix; j++) {
}
// shrink to fit:
if (isMalloc) {
} else {
// Note that we did not reclaim the final '\0'.
}
}
//cp_Utf8_chars.done();
#ifndef PRODUCT
#endif
// Fourth band: Go back and size the specially packed strings.
int maxlen = 0;
for (i = 0; i < len; i++) {
abort("bad utf8 prefix");
return;
}
if (suffix == 0 && i >= SUFFIX_SKIP_1) {
} else {
}
}
}
//cp_Utf8_suffix.done(); // will use allsuffixes[i].len (ptr!=null)
//cp_Utf8_big_suffix.done(); // will use allsuffixes[i].len
// Fifth band(s): Get the specially packed characters.
for (i = 0; i < len; i++) {
if (suffix == 0) continue; // done with empty string
for (int j = 0; j < suffix; j++) {
}
//cp_Utf8_big_chars.done();
}
//cp_Utf8_big_chars.done();
// Finally, sew together all the prefixes and suffixes.
for (i = 0; i < len; i++) {
// by induction, the buffer is already filled with the prefix
// make sure the prefix value is not corrupted, though:
abort("utf8 prefix overflow");
return;
}
// copy the suffix into the same buffer:
*fillp = 0; // bigbuf must contain a well-formed Utf8 string
// Index all Utf8 strings
// Note that if two identical strings are transmitted,
// the first is taken to be the canonical one.
}
}
//cp_Utf8_prefix.done();
// Free intermediate buffers.
free_temps();
}
for (int i = 0; i < len; i++) {
}
}
for (int i = 0; i < len; i++) {
}
//cp_band_hi.done();
//cp_band_lo.done();
}
for (int i = 0; i < len; i++) {
if (indexTag != 0) {
// Maintain cross-reference:
// Note that if two identical classes are transmitted,
// the first is taken to be the canonical one.
htref = &e;
}
}
}
//cp_band.done();
}
for (int i = 0; i < len; i++) {
}
//cp_band1.done();
//cp_band2.done();
}
// Cf. PackageReader.readSignatureBands
int ncTotal = 0;
int i;
for (i = 0; i < len; i++) {
int nc = 0;
}
}
//cp_Signature_form.done();
for (i = 0; i < len; i++) {
for (int j = 1; j < e.nrefs; j++) {
}
}
//cp_Signature_classes.done();
}
// Cf. PackageReader.readConstantPool
int i;
for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
for (i = 0; i < len; i++) {
}
switch (tag) {
case CONSTANT_Utf8:
break;
case CONSTANT_Integer:
break;
case CONSTANT_Float:
break;
case CONSTANT_Long:
break;
case CONSTANT_Double:
break;
case CONSTANT_String:
break;
case CONSTANT_Class:
break;
case CONSTANT_Signature:
break;
case CONSTANT_NameandType:
break;
case CONSTANT_Fieldref:
break;
case CONSTANT_Methodref:
break;
break;
default:
assert(false);
break;
}
// Initialize the tag's CP index right away, since it might be needed
// in the next pass to initialize the CP for another tag.
#ifndef PRODUCT
#endif
}
const char* symNames = (
"<init>"
);
}
}
band::initIndexes(this);
}
inline
}
{ return fixed_band(e_class_flags_hi); }
{ return fixed_band(e_class_flags_lo); }
{ return fixed_band(e_class_attr_count); }
{ return fixed_band(e_class_attr_indexes); }
{ return fixed_band(e_class_attr_calls); }
inline
const char* layout) {
return lo;
}
const char* name,
const char* layout) {
if (idx >= 0) {
// Fixed attr.
if (idx >= (int)flag_limit)
abort("attribute index too large");
if (isRedefined(idx))
abort("redefined attribute index");
} else {
}
}
return lo;
}
band**
int i;
} else {
// Create bands for this attribute by parsing the layout.
abort("garbage at end of layout");
}
band_stack.popTo(0);
// Fix up callables to point at their callees.
int num_callables = 0;
if (hasCallables) {
abort("garbage mixed with callables");
break;
}
num_callables += 1;
}
}
for (i = 0; i < calls_to_link.length(); i++) {
// Determine the callee.
abort("bad call in layout");
break;
}
// Link the call to it.
// Distinguish backward calls and callables:
}
calls_to_link.popTo(0);
}
}
/* attribute layout language parser
attribute_layout:
( layout_element )* | ( callable )+
layout_element:
( integral | replication | union | call | reference )
callable:
'[' body ']'
body:
( layout_element )+
integral:
( unsigned_int | signed_int | bc_index | bc_offset | flag )
unsigned_int:
uint_type
signed_int:
'S' uint_type
any_int:
( unsigned_int | signed_int )
bc_index:
( 'P' uint_type | 'PO' uint_type )
bc_offset:
'O' any_int
flag:
'F' uint_type
uint_type:
( 'B' | 'H' | 'I' | 'V' )
replication:
'N' uint_type '[' body ']'
union:
'T' any_int (union_case)* '(' ')' '[' (body)? ']'
union_case:
'(' union_case_tag (',' union_case_tag)* ')' '[' (body)? ']'
union_case_tag:
( numeral | numeral '-' numeral )
call:
'(' numeral ')'
reference:
reference_type ( 'N' )? uint_type
reference_type:
( constant_ref | schema_ref | utf8_ref | untyped_ref )
constant_ref:
( 'KI' | 'KJ' | 'KF' | 'KD' | 'KS' | 'KQ' )
schema_ref:
( 'RC' | 'RS' | 'RD' | 'RF' | 'RM' | 'RI' )
utf8_ref:
'RU'
untyped_ref:
'RQ'
numeral:
'(' ('-')? (digit)+ ')'
digit:
( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
*/
const char*
// Note: This is the last use of sign. There is no 'EF_SIGN'.
spec = SIGNED5_spec;
} else if (le == 'B') {
}
int le_len = 0;
switch (le) {
case 'V': le_len = 0; break;
default: abort("bad layout element");
}
band_stack.add(b);
res = b;
return lp;
}
const char*
bool sgn = false;
int con = 0;
con *= 10;
}
abort("missing numeral in layout");
return "";
}
// (Portability note: Misses the error if int is not 32 bits.)
abort("numeral overflow");
return "" ;
}
return lp;
}
band**
// Return everything that was pushed, as a null-terminated pointer array.
return no_bands;
} else {
for (int i = 0; i < nb; i++) {
res[i] = b;
}
return res;
}
}
const char*
int curCble) {
band* b;
switch (*lp++) {
case 'B': case 'H': case 'I': case 'V': // unsigned_int
case 'S': // signed_int
--lp; // reparse
case 'F':
break;
case 'P':
{
if (*lp == 'O') {
++lp;
}
else
}
break;
case 'O':
break;
case 'N': // replication: 'N' uint '[' elem ... ']'
++lp;
break;
case 'T': // union: 'T' any_int union_case* '(' ')' '[' body ']'
{
for (;;) { // for each case
if (*lp++ != '(') {
abort("bad union case");
return "";
}
if (*lp++ != ')') {
--lp; // reparse
// Read some case values. (Use band_stack for temp. storage.)
for (;;) {
int caseval = 0;
if (*lp == '-') {
// new in version 160, allow (1-5) for (1,2,3,4,5)
if (u->majver < JAVA6_PACKAGE_MAJOR_VERSION) {
abort("bad range in union case label (old archive format)");
return "";
}
lp++;
// Note: 0x10000 is arbitrary implementation restriction.
// We can remove it later if it's important to.
abort("bad range in union case label");
return "";
}
for (;;) {
++caseval;
}
}
if (*lp != ',') break;
lp++;
}
if (*lp++ != ')') {
abort("bad case label");
return "";
}
// save away the case labels
for (int i = 0; i < ntags; i++) {
}
}
// Got le_casetags. Now grab the body.
++lp;
}
}
break;
case '(': // call: '(' -?NN* ')'
{
int call_num = 0;
if (*lp++ != ')') {
abort("bad call label");
return "";
}
}
break;
case 'K': // reference_type: constant_ref
case 'R': // reference_type: schema_ref
{
switch (*lp++) {
}
} else {
switch (*lp++) {
}
}
if (ixTag == CONSTANT_None) {
abort("bad reference layout");
break;
}
bool nullOK = false;
if (*lp == 'N') {
nullOK = true;
lp++;
}
}
break;
case '[':
{
// [callable1][callable2]...
if (!top_level) {
abort("bad nested callable");
break;
}
curCble += 1;
}
break;
case ']':
// Hit a closing brace. This ends whatever body we were in.
done = true;
break;
case '\0':
// Hit a null. Also ends the (top-level) body.
--lp; // back up, so caller can see the null also
done = true;
break;
default:
abort("bad layout");
break;
}
}
// Return the accumulated bands:
return lp;
}
int i;
// Tell each AD which attrc it is and where its fixed flags are:
// Decide whether bands for the optional high flag words are present.
// Set up built-in attrs.
// (The simple ones are hard-coded. The metadata layouts are not.)
const char* md_layout = (
// parameter annotations:
#define MDL0 \
"[NB[(1)]]"
// annotations:
#define MDL1 \
"[NH[(1)]]" \
"[RSHNH[RUH(1)]]"
// member_value:
"[TB"
"(66,67,73,83,90)[KIH]"
"(68)[KDH]"
"(70)[KFH]"
"(74)[KJH]"
"(99)[RSH]"
"(101)[RSHRUH]"
"(115)[RUH]"
"(91)[NH[(0)]]"
"(64)["
// nested annotation:
"RSH"
"NH[RUH(0)]"
"]"
"()[]"
"]"
);
for (i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
"RuntimeVisibleAnnotations", md_layout_A);
"RuntimeInvisibleAnnotations", md_layout_A);
if (i != ATTR_CONTEXT_METHOD) continue;
"RuntimeVisibleParameterAnnotations", md_layout_P);
"RuntimeInvisibleParameterAnnotations", md_layout_P);
"AnnotationDefault", md_layout_V);
}
// Initialize correct predef bits, to distinguish predefs from new defs.
// Clear out the redef bits, folding them back into predef.
for (i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
}
// Now read the transmitted locally defined attrs.
// This will set redef bits again.
for (i = 0; i < attr_definition_count; i++) {
}
}
}
return true;
}
enum { // constants for parsing class names
DOLLAR_MIN = 0,
};
}
return -1;
}
return ic;
}
return ic;
}
return ic;
}
int i;
// Scan flags to get count of long-form bands.
int long_forms = 0;
for (i = 0; i < ic_count; i++) {
if ((flags & ACC_IC_LONG_FORM) != 0) {
long_forms += 1;
}
flags &= ~ACC_IC_LONG_FORM;
abort("identical inner class");
break;
}
}
//ic_this_class.done();
//ic_flags.done();
for (i = 0; i < ic_count; i++) {
// Long form.
} else {
// Fill in outer and name based on inner.
// Parse n into pkgOuter and name (and number).
// parse n = (<pkg>/)*<outer>($<number>)?($<name>)?
if (dollar2 < 0) {
abort();
return;
}
// n = (<pkg>/)*<outer>$<number>
// n = (<pkg>/)*<outer>$<number>$<name>
} else {
// n = (<pkg>/)*<outer>$<name>
}
else
}
}
}
}
//ic_outer_class.done();
//ic_name.done();
}
void unpacker::read_classes() {
#if 0
int i;
// Make a little mark on super-classes.
for (i = 0; i < class_count; i++) {
}
#endif
// Members.
}
}
if (haveLongFlags)
// pre-scan flags, counting occurrences of each index bit
for (i = 0; i < obj_count; i++) {
abort("undefined attribute flag bit");
return;
}
}
}
// we'll scan these again later for output:
// There is one count element for each 1<<16 bit set in flags:
// pre-scan attr indexes, counting occurrences of each value
for (i = 0; i < overflowIndexCount; i++) {
abort("attribute index out of bounds");
return;
}
}
// We will need a backward call count for each used backward callable.
int backwardCounts = 0;
// Build the bands lazily, only when they are used.
if (lo->hasCallables()) {
backwardCounts += 1;
}
}
}
}
}
// Read built-in bands.
// Mostly, these are hand-coded equivalents to readBandData().
switch (attrc) {
case ATTR_CONTEXT_CLASS:
// Drop remaining columns wherever flags are zero:
break;
case ATTR_CONTEXT_FIELD:
break;
case ATTR_CONTEXT_METHOD:
// Code attrs are handled very specially below...
break;
case ATTR_CONTEXT_CODE:
// (keep this code aligned with its brother in unpacker::write_attrs)
// disable this feature in old archives!
abort("undefined StackMapTable attribute (old archive format)");
return;
}
// the rest of it depends in a complicated way on frame tags
{
int fat_frame_count = 0;
int offset_count = 0;
int type_count = 0;
for (int k = 0; k < count; k++) {
if (tag <= 127) {
// (64-127) [(2)]
} else if (tag <= 251) {
// (247) [(1)(2)]
// (248-251) [(1)]
} else if (tag <= 254) {
// (252) [(1)(2)]
// (253) [(1)(2)(2)]
// (254) [(1)(2)(2)(2)]
offset_count++;
} else {
// (255) [(1)NH[(2)]NH[(2)]]
}
}
// done pre-scanning frame tags:
// deal completely with fat frames:
// read the rest:
// (7) [RCH]
// (8) [PH]
}
break;
}
// Read compressor-defined bands.
continue; // none at this fixed index <32
continue; // already handled
continue; // no attributes of this type (then why transmit layouts?)
}
}
int j;
if (count == 0) return;
}
if (!hasCallables) {
// Read through the rest of the bands in a regular way.
} else {
// Deal with the callables.
// First set up the forward entry count for each callable.
// This is stored on band::length of the callable.
// Add in the predicted effects of backward calls, too.
// In a moment, more forward calls may increment j_cble.length.
}
}
// Now consult whichever callables have non-zero entry counts.
}
}
// Recursive helper to the previous function:
int j, k;
// It has data, so read it.
}
switch (b.le_kind) {
case EK_REPL:
{
}
break;
case EK_UN:
{
int k_count = 0;
} else {
while (ntags-- > 0) {
}
}
}
}
break;
case EK_CALL:
// Push the count forward, if it is not a backward call.
if (!b.le_back) {
}
break;
case EK_CBLE:
k = b.length;
assert(k >= 0);
// This is intended and required for non production mode.
readBandData(b.le_body, k);
break;
}
}
}
static inline
// If it has tags, it must match a tag.
break;
}
if (ntags == 0)
continue; // does not match
}
}
return null;
}
// write attribute band data:
int i;
abort("putlayout: unexpected NULL for body");
return;
}
// Handle scalar part, if any.
int x = 0;
// It has data, so unparse an element.
if (b.ixTag != CONSTANT_None) {
if (b.ixTag == CONSTANT_Literal)
else
e = b.getRefN();
switch (b.le_len) {
case 0: break;
case 1: putu1ref(e); break;
case 2: putref(e); break;
default: assert(false);
}
} else {
x = b.getInt();
switch (b.le_bci) {
case EK_BCI: // PH: transmit R(bci), store bci
prevBCI = x;
break;
case EK_BCID: // POH: transmit D(R(bci)), store bci
prevBCI = x;
break;
case EK_BCO: // OH: transmit D(R(bci)), store D(bci)
prevBCI += x;
break;
}
switch (b.le_len) {
case 0: break;
case 1: putu1(x); break;
case 2: putu2(x); break;
case 4: putu4(x); break;
default: assert(false);
}
}
}
// Handle subparts, if any.
switch (le_kind) {
case EK_REPL:
// x is the repeat count
while (x-- > 0) {
}
break;
case EK_UN:
// x is the tag
break;
case EK_CALL:
{
}
break;
#ifndef PRODUCT
case EK_CBLE:
case EK_CASE:
assert(false); // should not reach here
#endif
}
}
}
if ((archive_options & AO_HAVE_FILE_SIZE_HI) != 0)
if ((archive_options & AO_HAVE_FILE_MODTIME) != 0)
if ((archive_options & AO_HAVE_FILE_OPTIONS) != 0) {
// FO_IS_CLASS_STUB might be set, causing overlap between classes and files
for (int i = 0; i < file_count; i++) {
}
}
}
}
int& max_na_locals,
int& handler_count,
int& cflags) {
if (sc == 0) {
return;
}
// Short code header is the usual case:
int nh;
int mod;
sc -= 1;
nh = 0;
mod = 12;
nh = 1;
mod = 8;
} else {
nh = 2;
mod = 7;
}
handler_count = nh;
if ((archive_options & AO_HAVE_ALL_CODE_FLAGS) != 0)
cflags = -1;
else
cflags = 0; // this one has no attributes
}
// Cf. PackageReader.readCodeHeaders
void unpacker::read_code_headers() {
int totalHandlerCount = 0;
int totalFlagsCount = 0;
for (int i = 0; i < code_count; i++) {
else totalHandlerCount += handler_count;
}
// Read handler specifications.
// Cf. PackageReader.readCodeHandlers.
}
}
static inline bool is_field_op(int bc) {
}
static inline bool is_invoke_init_op(int bc) {
}
static inline bool is_self_linker_op(int bc) {
}
static bool is_branch_op(int bc) {
}
static bool is_local_slot_op(int bc) {
}
switch (bc) {
case bc_ildc:
case bc_ildc_w:
return &bc_intref;
case bc_fldc:
case bc_fldc_w:
return &bc_floatref;
case bc_lldc2_w:
return &bc_longref;
case bc_dldc2_w:
return &bc_doubleref;
case bc_aldc:
case bc_aldc_w:
return &bc_stringref;
case bc_cldc:
case bc_cldc_w:
return &bc_classref;
case bc_getstatic:
case bc_putstatic:
case bc_getfield:
case bc_putfield:
return &bc_fieldref;
case bc_invokevirtual:
case bc_invokespecial:
case bc_invokestatic:
return &bc_methodref;
case bc_invokeinterface:
return &bc_imethodref;
case bc_new:
case bc_anewarray:
case bc_checkcast:
case bc_instanceof:
case bc_multianewarray:
return &bc_classref;
}
return null;
}
if (!isSuper)
else
}
// Cf. PackageReader.readByteCodes
inline // called exactly once => inline
code_count));
// read from bc_codes and bc_case_count
//Do this later: bc_codes.readData(...)
bool isAload; // passed by ref and then ignored
int junkBC; // passed by ref and then ignored
for (int k = 0; k < code_count; k++) {
// Scan one method:
for (;;) {
ensure_input(2);
}
bool isWide = false;
isWide = true;
}
// Adjust expectations of various band sizes.
switch (bc) {
case bc_tableswitch:
case bc_lookupswitch:
break;
case bc_iinc:
break;
case bc_sipush:
break;
case bc_bipush:
break;
case bc_newarray:
break;
case bc_multianewarray:
break;
case bc_ref_escape:
break;
case bc_byte_escape:
// bc_escbyte will have to be counted too
break;
default:
if (is_invoke_init_op(bc)) {
break;
}
break;
}
if (is_branch_op(bc)) {
break;
}
break;
}
if (is_local_slot_op(bc)) {
break;
}
break;
case bc_end_marker:
// Increment k and test against code_count.
goto doneScanningMethod;
}
}
if (aborting()) break;
}
// Go through the formality, so we can use it in a regular fashion later:
int i = 0;
// To size instruction bands correctly, we need info on switches:
for (i = 0; i < (int)all_switch_ops.size(); i++) {
}
for (i = e_bc_case_value; i <= e_bc_escsize; i++) {
}
// The bc_escbyte band is counted by the immediately previous band.
code_count));
}
void unpacker::read_bands() {
// read_file_header failed to read a CP, because it copied a JAR.
return;
}
// Do this after the file header has been read:
read_cp();
read_ics();
read_classes();
read_bcs();
read_files();
}
/// CP routines
for (int i = 0; i < (int)b.len; i++) {
}
int hlen = hashTabLength;
int probes = 0;
break;
if (hash2 == 0)
// Note: hash2 must be relatively prime to hlen, hence the "|1".
}
#ifndef PRODUCT
hash_probes[0] += 1;
#endif
}
// This ordering helps implement the Pack200 requirement
// of a predictable CP order in the class files produced.
// Note: We will sort the list (by string-name) later.
}
// Make one.
if (nentries == maxentries) {
abort("cp utf8 overflow");
}
e.tag = CONSTANT_Utf8;
assert(&e >= first_extra_entry);
return ix = &e;
}
// Make one.
if (nentries == maxentries) {
abort("cp class overflow");
}
e.tag = CONSTANT_Class;
e.nrefs = 1;
ix = &e; // hold my spot in the index
assert(&e >= first_extra_entry);
return &e;
}
void cpool::expandSignatures() {
int i;
int nsigs = 0;
int nreused = 0;
int refnum = 0;
if (c == 'L') {
}
}
// try to find a pre-existing Utf8:
e.nrefs = 1;
nreused++;
} else {
// there is no other replacement; reuse this CP entry as a Utf8
e.tag = CONSTANT_Utf8;
e.nrefs = 0;
e2 = &e;
}
nsigs++;
}
// go expunge all references to remaining signatures:
for (i = 0; i < (int)nentries; i++) {
for (int j = 0; j < e.nrefs; j++) {
}
}
}
void cpool::initMemberIndexes() {
// This function does NOT refer to any class schema.
// It is totally internal to the cpool.
int i, j;
// Get the pre-existing indexes:
for (j = 0; j < nfields; j++) {
i = f.memberClass()->inord;
field_counts[i]++;
}
for (j = 0; j < nmethods; j++) {
i = m.memberClass()->inord;
method_counts[i]++;
}
for (i = 0; i < nclasses; i++) {
int fc = field_counts[i];
int mc = method_counts[i];
// reuse field_counts and member_counts as fill pointers:
field_counts[i] = fbase;
method_counts[i] = mbase;
// (the +1 leaves a space between every subarray)
}
for (j = 0; j < nfields; j++) {
i = f.memberClass()->inord;
field_ix[field_counts[i]++] = &f;
}
for (j = 0; j < nmethods; j++) {
i = m.memberClass()->inord;
method_ix[method_counts[i]++] = &m;
}
#ifndef PRODUCT
// Test the result immediately on every class and field.
for (i = 0; i < nclasses; i++) {
prevord = -1;
fvisited++;
}
prevord = -1;
mvisited++;
}
}
#endif
// Free intermediate buffers.
u->free_temps();
}
if (tag == CONSTANT_Signature) {
return;
}
if (outputIndex != NOT_REQUESTED) {
if (req == REQUESTED_LDC)
return;
}
outputIndex = req;
//assert(!cp.outputEntries.contains(this));
for (int j = 0; j < nrefs; j++) {
}
}
void cpool::resetOutputIndexes() {
int i;
for (i = 0; i < noes; i++) {
e.outputIndex = NOT_REQUESTED;
}
outputIndexLimit = 0;
#ifndef PRODUCT
// they must all be clear now
for (i = 0; i < (int)nentries; i++)
#endif
}
0, 1, 0, 2, 3, 4, 5, 7, 6, 10, 11, 12, 9, 8
};
extern "C"
// Sort entries according to the Pack200 rules for deterministic
// constant pool ordering.
//
// The four sort keys as follows, in order of decreasing importance:
// 1. ldc first, then non-ldc guys
// 2. normal cp_All entries by input order (i.e., address order)
// 3. after that, extra entries by lexical order (as in tag_extras[*])
// Else fall through; neither is an ldc request.
}
// One or both is normal. Use input order.
return 0; // equal pointers
}
// Both are extras. Sort by tag and then by value.
}
// If the tags are the same, use string comparison.
}
void cpool::computeOutputIndexes() {
int i;
#ifndef PRODUCT
// outputEntries must be a complete list of those requested:
static uint checkStart = 0;
int checkStep = 1;
if (e.outputIndex != NOT_REQUESTED) {
} else {
}
}
// check hand-initialization of TAG_ORDER
for (i = 0; i < (int)N_TAGS_IN_ORDER; i++) {
}
#endif
// Sort the output constant pool into the order required by Pack200.
// Allocate a new index for each entry that needs one.
// We do this in two passes, one for LDC entries and one for the rest.
for (i = 0; i < noes; i++) {
e.outputIndex = nextIndex++;
}
}
#ifndef PRODUCT
// debugging goo
static int bn = 0;
return buf;
}
switch (tag) {
case CONSTANT_None:
return (char*)"<empty>";
case CONSTANT_Signature:
// else fall through:
case CONSTANT_Utf8:
break;
case CONSTANT_Integer:
case CONSTANT_Float:
break;
case CONSTANT_Long:
case CONSTANT_Double:
break;
default:
if (nrefs == 0) {
} else if (nrefs == 1) {
} else {
}
}
}
void print_cp_entry(int i) {
char buf[30];
}
print_cp_entry(i);
}
void print_cp() {
}
#endif
// Unpacker Start
const char str_tf[] = "true\0false";
#ifdef HAVE_STRIP
return STR_TF(strip_compile);
return STR_TF(strip_debug);
return STR_TF(strip_jcov);
#endif /*HAVE_STRIP*/
return STR_TF(remove_packfile);
return saveIntStr(verbose);
return (modification_time_or_zero == 0)? null:
return log_file;
} else {
return NULL; // unknown option ignore
}
}
#ifdef HAVE_STRIP
#endif /*HAVE_STRIP*/
#ifndef PRODUCT
#endif
modification_time_or_zero = (int) now;
} else {
if (modification_time_or_zero == 0)
}
} else {
return false; // unknown option ignore
}
return true;
}
// Deallocate all internal storage and reset to a clean state.
// Do not disturb any input or output connections, including
// infileptr, infileno, inbytes, read_input_fn, jarout, or errstrm.
// Do not reset any unpack options.
if (verbose >= 2) {
"After segment %d, "
LONG_LONG_FORMAT " bytes read and "
LONG_LONG_FORMAT " bytes written.\n",
"After segment %d, %d files (of which %d are classes) written to output.\n",
if (archive_next_count != 0) {
"After segment %d, %d segment%s remaining (estimated).\n",
}
}
if (errstrm_name != null) {
} else {
}
this->free();
this->init(read_input_fn);
// restore selected interface state:
//SAVE(read_input_fn);
}
// Note: If we use strip_names, watch out: They get nuked here.
}
int i;
NOT_PRODUCT(debug_u = this);
#ifndef PRODUCT
free(); // just to make sure freeing is idempotent
#endif
this->u = this; // self-reference for U_NEW macro
// Make a default jar buffer; caller may safely overwrite it.
for (i = 0; i < ATTR_CONTEXT_LIMIT; i++)
attr_defs[i].u = u; // set up outer ptr
}
const char* unpacker::get_abort_message() {
return abort_message;
}
void unpacker::dump_options() {
static const char* opts[] = {
#ifdef HAVE_STRIP
#endif /*HAVE_STRIP*/
};
if (verbose == 0) continue;
str = "(not set)";
}
}
}
// Usage: unpack a byte buffer
// packptr is a reference to byte buffer containing a
// packed file and len is the length of the buffer.
// If null, the callback is used to fill an internal buffer.
NOT_PRODUCT(debug_u = this);
}
read_bands();
}
void unpacker::check_options() {
const char* strue = "true";
const char* sfalse = "false";
if (deflate_hint_or_zero != 0) {
bool force_deflate_hint = (deflate_hint_or_zero > 0);
if (force_deflate_hint)
else
// Turn off per-file deflate hint by force.
}
if (modification_time_or_zero != 0) {
// Turn off per-file modtime by force.
}
// %%% strip_compile, etc...
}
// classfile writing
void unpacker::reset_cur_classfile() {
// set defaults
// reset constant pool state
// reset fixups
}
char ch = '?';
}
switch (ch) {
case 'B': case 'S': case 'C':
default: abort("bad KQ reference"); break;
}
}
// Else it's a fractional or out-of-range BCI.
for (int i = len; ; i--) {
break;
else
--bii;
}
return bii;
}
void unpacker::put_stackmap_type() {
switch (tag) {
case 7: // (7) [RCH]
break;
case 8: // (8) [PH]
break;
}
}
// Functions for writing code.
}
inline // called exactly once => inline
void unpacker::write_bc_ops() {
// No need for oplimit, since the codes are pre-counted.
bool isAload; // copy-out result
int origBC;
// overwrite any prior index on these bands; it changes w/ current class:
if (superClass != null) {
} else {
}
putu1_fast(bc);
// Note: See '--wp' below for pseudo-bytecodes like bc_end_marker.
bool isWide = false;
putu1_fast(bc);
isWide = true;
}
switch (bc) {
case bc_end_marker:
--wp; // not really part of the code
goto doneScanningMethod;
case bc_tableswitch: // apc: (df, lo, hi, (hi-lo+1)*(label))
case bc_lookupswitch: // apc: (df, nc, nc*(case, label))
{
if (bc == bc_tableswitch) {
for (int j = 0; j < caseCount; j++) {
//int cVal = lo + j;
}
} else {
for (int j = 0; j < caseCount; j++) {
}
}
continue;
}
case bc_iinc:
{
if (isWide) {
} else {
}
continue;
}
case bc_sipush:
{
continue;
}
case bc_bipush:
case bc_newarray:
{
continue;
}
case bc_ref_escape:
{
// Note that insnMap has one entry for this.
--wp; // not really part of the code
switch (size) {
default: assert(false);
}
continue;
}
case bc_byte_escape:
{
// Note that insnMap has one entry for all these bytes.
--wp; // not really part of the code
for (int j = 0; j < size; j++)
continue;
}
default:
if (is_invoke_init_op(bc)) {
switch (bc - _invokeinit_op) {
}
// Find the nth overloading of <init> in classRef.
for (int j = 0, which_init = 0; ; j++) {
if (which_init++ == coding) break;
}
}
continue;
}
if (!isAload) {
} else {
// Note: insnMap keeps the _aload_0 separate.
++curIP;
}
continue;
}
if (is_branch_op(bc)) {
//int lVal = bc_label.getInt();
} else {
}
continue;
}
// Shorthand for class self-references.
}
switch (bc) {
case bc_ildc:
case bc_cldc:
case bc_fldc:
case bc_aldc:
break;
case bc_ildc_w:
case bc_cldc_w:
case bc_fldc_w:
case bc_aldc_w:
break;
case bc_lldc2_w:
case bc_dldc2_w:
break;
case bc_new:
break;
}
} else {
}
if (origBC == bc_multianewarray) {
// Copy the trailing byte also.
} else if (origBC == bc_invokeinterface) {
putu1_fast(0);
}
continue;
}
if (is_local_slot_op(bc)) {
if (isWide) {
}
} else {
}
}
continue;
}
// Random bytecode. Just copy it.
}
}
//bcimap.add(curPC); // PC limit is already also in map, from bc_end_marker
// Armed with a bcimap, we can now fix up all the labels.
for (int i = 0; i < (int)code_fixup_type.size(); i++) {
switch (type) {
default: assert(false);
}
}
}
inline // called exactly once => inline
void unpacker::write_code() {
int j;
max_locals += siglen;
// Write the bytecodes themselves.
write_bc_ops();
for (j = 0; j < handler_count; j++) {
}
if (cflags < 0) {
}
}
if (indexBits == 0) {
// Quick short-circuit.
putu2(0);
return 0;
}
int oiCount = 0;
}
int biCount = 0;
// Fill bitIndexes with index bits, in order.
if ((indexBits & 1) != 0)
}
// Write a provisional attribute count, perhaps to be corrected later.
int na = 0;
for (i = 0; i < na0; i++) {
if (i < biCount)
idx = bitIndexes[i];
else
// Switch on the attrc and idx simultaneously.
// no attribute at all, so back up on this one
continue;
// back up; not a real attribute
continue;
// note the existence of this attr, but save for later
abort("too many InnerClasses attrs");
cur_class_has_local_ics = true;
continue;
// parse n = (<pkg>/)*<outer>?($<id>)*
for (;;) {
// Work backwards, finding all '$', '#', etc.
if (dollar < 0) break;
}
const char* suffix = ".java";
}
break;
break;
break;
write_code();
break;
for (j = 0; j < count; j++) {
}
break;
// (keep this code aligned with its brother in unpacker::read_attrs)
for (j = 0; j < count; j++) {
if (tag <= 127) {
// (64-127) [(2)]
} else if (tag <= 251) {
// (247) [(1)(2)]
// (248-251) [(1)]
} else if (tag <= 254) {
// (252) [(1)(2)]
// (253) [(1)(2)(2)]
// (254) [(1)(2)(2)(2)]
for (int k = (tag - 251); k > 0; k--) {
}
} else {
// (255) [(1)NH[(2)]NH[(2)]]
}
}
break;
for (j = 0; j < count; j++) {
}
break;
for (j = 0; j < count; j++) {
}
break;
for (j = 0; j < count; j++) {
}
break;
break;
break;
break;
// no data
break;
}
}
// Unparse a compressor-defined attribute.
abort("bad layout index");
break;
}
// Cache the name entry for next time.
}
// Execute all the layout elements.
if (lo->hasCallables()) {
}
}
abort("bad attribute index");
// DTRT if this attr is on the strip-list.
// (Note that we emptied the data out of the band first.)
continue;
}
// patch the name and length
na++; // count the attrs actually written
}
// Refresh changed count.
return na;
}
for (int i = 0; i < num; i++) {
}
}
extern "C"
}
void unpacker::write_classfile_tail() {
int i, num;
for (i = 0; i < num; i++) {
}
cur_class_has_local_ics = false; // may be set true by write_attrs
// at the very last, choose which inner classes (if any) pertain to k:
#ifdef ASSERT
for (i = 0; i < ic_count; i++) {
}
#endif
// First, consult the global table and the local constant pool,
// and decide on the globally implied inner classes.
// (Note that we read the cpool's outputIndex fields, but we
// do not yet write them, since the local IC attribute might
// reverse a global decision to declare an IC.)
// Always include all members of the current class.
}
// And, for each inner class mentioned in the constant pool,
// include it and all its outers.
for (i = 0; i < noes; i++) {
}
}
// Second, consult a local attribute (if any) and adjust the global set.
int num_extra_ics = 0;
if (cur_class_has_local_ics) {
// adjust the set of ICs by symmetric set difference w/ the locals
if (num_extra_ics == 0) {
// Explicit zero count has an irregular meaning: It deletes the attr.
local_ics = 0; // (short-circuit all tests of requested bits)
} else {
// Note: extra_ics will be freed up by next call to get_next_file().
}
}
for (i = 0; i < num_extra_ics; i++) {
// Find the corresponding equivalent global IC:
if (flags == 0) {
// The extra IC is simply a copy of a global IC.
abort("bad reference to inner class");
break;
}
} else {
// Detect if this is an exact copy of the global tuple.
}
}
}
// This local repetition reverses the globally implied request.
local_ics -= 1;
} else {
// The global either does not exist, or is not yet requested.
local_ics += 1;
}
}
// Finally, if there are any that survived, put them into an attribute.
// (Note that a zero-count attribute is always deleted.)
// The putref calls below will tell the constant pool to add any
// necessary local CP references to support the InnerClasses attribute.
// This step must be the last round of additions to the local CP.
if (local_ics > 0) {
// append the new attribute:
for (i = -num_global_ics; i < num_extra_ics; i++) {
if (i < 0)
else
NOT_PRODUCT(local_ics--);
}
}
}
// Tidy up global 'requested' bits:
for (i = requested_ics.length(); --i >= 0; ) {
}
close_output();
// rewrite CP references in the tail
int nextref = 0;
for (i = 0; i < (int)class_fixup_type.size(); i++) {
int idx = e->getOutputIndex();
switch (type) {
default: assert(false); // should not reach here
}
}
}
void unpacker::write_classfile_head() {
int checkIndex = 1;
for (int i = 0; i < noes; i++) {
switch (tag) {
case CONSTANT_Utf8:
break;
case CONSTANT_Integer:
case CONSTANT_Float:
break;
case CONSTANT_Long:
case CONSTANT_Double:
assert(checkIndex++);
break;
case CONSTANT_Class:
case CONSTANT_String:
// just write the ref
break;
case CONSTANT_Fieldref:
case CONSTANT_Methodref:
case CONSTANT_NameandType:
break;
default:
}
}
#ifndef PRODUCT
#endif
close_output();
}
free_temps();
if (files_remaining == 0) {
// Leave a clue that we're exhausted.
if (archive_size != 0) {
if (predicted_size != bytes_read)
abort("archive header had incorrect size");
}
return null;
}
files_remaining -= 1;
if (files_written < file_count) {
if ((archive_options & AO_HAVE_FILE_MODTIME) != 0)
if ((archive_options & AO_HAVE_FILE_OPTIONS) != 0)
} else if (classes_written < class_count) {
// there is a class for a missing file record
}
classes_written += 1;
abort("class file size transmitted");
return null;
}
// write the meat of the classfile:
// write the CP of the classfile, second:
const char* suffix = ".class";
}
} else {
// If there is buffered file data, produce a pointer to it.
// Silly size specified.
abort("resource file too large");
return null;
}
if (rpleft > 0) {
}
// Caller must read the rest.
}
}
files_written += 1;
return &cur_file;
}
// Write a file to jarout.
#ifndef PRODUCT
return;
}
#endif
} else {
assert(input_remaining() == 0);
bytes_read -= fleft;
if (fleft > 0) {
// Must read some more.
if (live_input) {
// Stop using the input buffer. Make a new one:
free_input = true;
live_input = false;
} else {
// Make it large enough.
}
if (!ensure_input(fleft))
abort("EOF reading resource file");
}
}
if (verbose >= 3) {
}
}
// Redirect the stdio to the specified file in the unpack.log.file option
void unpacker::redirect_stdio() {
}
if (log_file == errstrm_name)
// Nothing more to be done.
return;
return;
return;
return;
} else {
#ifdef WIN32
if (n < 1 || n > PATH_MAX) {
}
#else
#endif
return ;
}
return ;
}
#ifndef WIN32
// On windows most likely it will fail.
return ;
}
#endif
// Last resort
// (Do not use stdout, since it might be jarout->jarfp.)
}
}
#ifndef PRODUCT
char fmtbuf[300];
return 1; // for ?: usage
}
#endif
#ifdef UNPACK_JNI
}
return;
#else
#ifndef PRODUCT
::abort();
#else
exit(-1);
#endif
#endif // JNI
}