file = NULL;
next_call_no = 0;
version = 0;
+ m_supportsSeeking = false;
}
if (!file->open(filename, File::Read)) {
return false;
}
+ m_supportsSeeking = file->supportsOffsets();
version = read_uint();
if (version > TRACE_VERSION) {
size_t id = read_uint();
FunctionSig *sig = lookup(functions, id);
- const File::Offset offset = file->currentOffset();
- bool callWithSig = callWithSignature(offset);
+
+
+ File::Offset offset;
+ bool callWithSig = false;
+ if (m_supportsSeeking) {
+ offset = file->currentOffset();
+ callWithSig = callWithSignature(offset);
+ }
+
if (!sig || callWithSig) {
if (!sig) {
sig = new FunctionSig;
}
sig->arg_names = arg_names;
functions[id] = sig;
- m_callSigOffsets.insert(offset);
+ if (m_supportsSeeking) {
+ m_callSigOffsets.insert(offset);
+ }
} else {
/* skip over the signature */
skip_string(); /* name */
Value *Parser::parse_enum() {
size_t id = read_uint();
EnumSig *sig = lookup(enums, id);
- const File::Offset offset = file->currentOffset();
- bool enumWithSig = enumWithSignature(offset);
+ File::Offset offset;
+ bool enumWithSig = false;
+
+ if (m_supportsSeeking) {
+ offset = file->currentOffset();
+ enumWithSig = enumWithSignature(offset);
+ }
+
if (!sig || enumWithSig) {
if (!sig) {
sig = new EnumSig;
sig->value = value->toSInt();
delete value;
enums[id] = sig;
- m_enumSigOffsets.insert(offset);
+ if (m_supportsSeeking) {
+ m_enumSigOffsets.insert(offset);
+ }
} else {
skip_string(); /*name*/
scan_value();
Value *Parser::parse_bitmask() {
size_t id = read_uint();
BitmaskSig *sig = lookup(bitmasks, id);
- const File::Offset offset = file->currentOffset();
- bool bitmaskWithSig = bitmaskWithSignature(offset);
+ File::Offset offset;
+ bool bitmaskWithSig = false;
+
+ if (m_supportsSeeking) {
+ offset = file->currentOffset();
+ bitmaskWithSig = bitmaskWithSignature(offset);
+ }
+
if (!sig || bitmaskWithSig) {
if (!sig) {
sig = new BitmaskSig;
}
sig->flags = flags;
bitmasks[id] = sig;
- m_bitmaskSigOffsets.insert(offset);
+ if (m_supportsSeeking) {
+ m_bitmaskSigOffsets.insert(offset);
+ }
} else {
int num_flags = read_uint();
for (int i = 0; i < num_flags; ++i) {
size_t id = read_uint();
StructSig *sig = lookup(structs, id);
- const File::Offset offset = file->currentOffset();
- bool structWithSig = structWithSignature(offset);
+ File::Offset offset;
+ bool structWithSig = false;
+
+ if (m_supportsSeeking) {
+ offset = file->currentOffset();
+ structWithSig = structWithSignature(offset);
+ }
+
if (!sig || structWithSig) {
if (!sig) {
sig = new StructSig;
}
sig->member_names = member_names;
structs[id] = sig;
- m_structSigOffsets.insert(offset);
+ if (m_supportsSeeking) {
+ m_structSigOffsets.insert(offset);
+ }
} else {
skip_string(); /* name */
unsigned num_members = read_uint();
Call * Parser::scan_call()
{
+ assert(m_supportsSeeking);
do {
int c = read_byte();
switch(c) {