Skip to content

Commit

Permalink
Fix merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
jbevain committed Dec 10, 2019
1 parent 220c19e commit e55d803
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 5 additions & 0 deletions Mono.Cecil.PE/ByteBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public PByteBuffer (ByteSpan span)
this.e = this.p + this.span.length;
}

public int RemainingBytes ()
{
return (int) (e - p);
}

public bool CanReadMore ()
{
return p < e;
Expand Down
14 changes: 4 additions & 10 deletions Mono.Cecil/AssemblyReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ MethodSpecification ReadMethodSpecSignature (uint signature, MethodReference met
if (call_conv != methodspec_sig)
throw new NotSupportedException ();

var arity = reader.ReadCompressedUInt32 ();
var arity = sig.ReadCompressedUInt32 ();

var instance = new GenericInstanceMethod (method, (int) arity);

Expand Down Expand Up @@ -3430,10 +3430,10 @@ TypeReference ReadTypeSignature (ElementType etype, ref PByteBuffer buffer)
var is_value_type = buffer.ReadByte () == (byte) ElementType.ValueType;
var element_type = GetTypeDefOrRef (ReadTypeTokenSignature (ref buffer));

var arity = ReadCompressedUInt32 ();
var arity = buffer.ReadCompressedUInt32 ();
var generic_instance = new GenericInstanceType (element_type);

ReadGenericInstanceSignature (element_type, generic_instance, arity ref buffer);
ReadGenericInstanceSignature (element_type, generic_instance, arity, ref buffer);

if (is_value_type) {
generic_instance.KnownValueType ();
Expand Down Expand Up @@ -3833,8 +3833,7 @@ public Collection<SequencePoint> ReadSequencePoints (Document document, ref PByt
//there's about 5 compressed int32's per sequence points. we don't know exactly how many
//but let's take a conservative guess so we dont end up reallocating the sequence_points collection
//as it grows.
var bytes_remaining_for_sequencepoints = sig_length - (position - start);
var estimated_sequencepoint_amount = (int)bytes_remaining_for_sequencepoints / 5;
var estimated_sequencepoint_amount = (int) buffer.RemainingBytes () / 5;
var sequence_points = new Collection<SequencePoint> (estimated_sequencepoint_amount);

for (var i = 0; buffer.CanReadMore (); i++) {
Expand Down Expand Up @@ -3880,10 +3879,5 @@ public Collection<SequencePoint> ReadSequencePoints (Document document, ref PByt

return sequence_points;
}

public bool CanReadMore ()
{
return (position - start) < sig_length;
}
}
}

0 comments on commit e55d803

Please sign in to comment.