From 4b860f8b50791fad8ca96f54899a20dc34d3ff04 Mon Sep 17 00:00:00 2001 From: Vladimir Shakhov Date: Tue, 23 Dec 2014 19:16:54 +0300 Subject: [PATCH] Changed bytesLeft to long, per #10 --- .../edu/tufts/eaftan/hprofparser/parser/HprofParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/tufts/eaftan/hprofparser/parser/HprofParser.java b/src/main/java/edu/tufts/eaftan/hprofparser/parser/HprofParser.java index b7c2ea3..6901a14 100644 --- a/src/main/java/edu/tufts/eaftan/hprofparser/parser/HprofParser.java +++ b/src/main/java/edu/tufts/eaftan/hprofparser/parser/HprofParser.java @@ -127,7 +127,7 @@ private boolean parseRecord(DataInput in, int idSize) throws IOException { // otherwise propagate the EOFException int time = in.readInt(); // TODO(eaftan): we might want time passed to handler fns - int bytesLeft = in.readInt(); + long bytesLeft = Integer.toUnsignedLong(in.readInt()); long l1, l2, l3, l4; int i1, i2, i3, i4, i5, i6, i7, i8, i9; @@ -142,7 +142,7 @@ private boolean parseRecord(DataInput in, int idSize) throws IOException { // String in UTF-8 l1 = readId(idSize, in); bytesLeft -= idSize; - bArr1 = new byte[bytesLeft]; + bArr1 = new byte[(int) bytesLeft]; in.readFully(bArr1); handler.stringInUTF8(l1, new String(bArr1)); break; @@ -179,7 +179,7 @@ private boolean parseRecord(DataInput in, int idSize) throws IOException { i2 = in.readInt(); i3 = in.readInt(); bytesLeft -= 12; - lArr1 = new long[bytesLeft/idSize]; + lArr1 = new long[(int) bytesLeft/idSize]; for (int i=0; i