summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2006-09-18 17:18:57 +0000
committerSilenio Quarti <silenio>2006-09-18 17:18:57 +0000
commitbf1a8f9b947adcbd301c393269ebefd11b30b000 (patch)
treef01597c9f73fb73bbd3ab6d0233cb7b62eabee20
parent02294f0eee29bb25f749605983ff76c0b309ef21 (diff)
downloadeclipse.platform.swt-bf1a8f9b947adcbd301c393269ebefd11b30b000.tar.gz
eclipse.platform.swt-bf1a8f9b947adcbd301c393269ebefd11b30b000.tar.xz
eclipse.platform.swt-bf1a8f9b947adcbd301c393269ebefd11b30b000.zip
back port to 3.2.1 (157478 - Web services wizard scale and graph all weird)v3235d
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java
index 964e3ecabe..7bef3b6da1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java
@@ -81,17 +81,14 @@ final class LEDataInputStream extends InputStream {
* of bytes when you can actually read them all.
*/
public int read(byte b[], int off, int len) throws IOException {
- int result;
- int left = len;
- result = readData(b, off, len);
- while (true) {
- if (result == -1) return -1;
- position += result;
- if (result == left) return len;
- left -= result;
- off += result;
- result = readData(b, off, left);
+ int read = 0, count;
+ while (read != len && (count = readData(b, off, len - read)) != -1) {
+ off += count;
+ read += count;
}
+ position += read;
+ if (read == 0 && read != len) return -1;
+ return read;
}
/**