From cca28734e39c041112b73314fbd0191dba39362b Mon Sep 17 00:00:00 2001 From: luukkainen Date: Fri, 7 Sep 2012 10:56:54 +0000 Subject: [PATCH] using long to calculate offsets. refs #3692 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25687 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../modelica/reader/MatFileReader.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/org.simantics.modelica/src/org/simantics/modelica/reader/MatFileReader.java b/org.simantics.modelica/src/org/simantics/modelica/reader/MatFileReader.java index 85074f8f..786faae1 100644 --- a/org.simantics.modelica/src/org/simantics/modelica/reader/MatFileReader.java +++ b/org.simantics.modelica/src/org/simantics/modelica/reader/MatFileReader.java @@ -25,8 +25,8 @@ public class MatFileReader implements ResultFileReader { private Map indices = new HashMap(); - int readBytes = 0; // tracking read data - int dataMark = 0; // mark for actual data + long readBytes = 0; // tracking read data + long dataMark = 0; // mark for actual data IntMatrix info; int[] infoData; @@ -345,11 +345,11 @@ public class MatFileReader implements ResultFileReader { int rows = header.rows; double[] v = new double[count]; int sc = infoData[row * 4 + 1]; - int c = sc > 0 ? sc-1 : -sc-1; + long c = sc > 0 ? sc-1 : -sc-1; - skip((c+start*rows) * 8, in); + skip((c+((long)start*(long)rows)) * 8L, in); for (int j = 0; j < v.length; ++j) { double d = getDouble(in); @@ -413,7 +413,7 @@ public class MatFileReader implements ResultFileReader { - skip(c[0] * 8, in); + skip((long)c[0] * 8L, in); for (int j = 0; j < size; ++j) { for (int index = 0; index < sortedRows.size(); index++) { @@ -532,8 +532,10 @@ public class MatFileReader implements ResultFileReader { - - skip((start*rows) * 8, in); + long s = start; + s *= (long)rows; + s *= 8L; + skip(s, in); skip(c[0] * 8, in); for (int j = 0; j < count; ++j) { for (int index = 0; index < sortedRows.size(); index++) { @@ -583,8 +585,8 @@ public class MatFileReader implements ResultFileReader { return vs; } - private void skip(int skipBytes, InputStream in) throws IOException { - int skip = 0; + private void skip(long skipBytes, InputStream in) throws IOException { + long skip = 0; while (skip < skipBytes) { skip += in.skip(skipBytes-skip); } -- 2.47.1