Author: bodewig
Date: Mon Mar 30 15:49:16 2009
New Revision: 760017
URL: http://svn.apache.org/viewvc?rev=760017&view=rev
Log:
offset calculation was broken
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
URL:
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java?rev=760017&r1=760016&r2=760017&view=diff
==============================================================================
---
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
(original)
+++
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
Mon Mar 30 15:49:16 2009
@@ -111,19 +111,17 @@
public int read() throws IOException {
final int ret = input.read();
- offset++;
+ offset += (ret > 0 ? 1 : 0);
return ret;
}
public int read(byte b[]) throws IOException {
- final int ret = read(b, 0, b.length);
- offset = offset + b.length;
- return ret;
+ return read(b, 0, b.length);
}
public int read(byte[] b, int off, int len) throws IOException {
final int ret = this.input.read(b, off, len);
- offset = offset + off;
+ offset += (ret > 0 ? ret : 0);
return ret;
}