changeset 170:bef543dec5c3

Fix for LEDataStream unread
author Frank Benoit <benoit@tionex.de>
date Sat, 23 Feb 2008 00:56:35 +0100
parents a52ddf7c3a8f
children 487072cb0473
files dwt/internal/image/LEDataInputStream.d
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/image/LEDataInputStream.d	Fri Feb 22 18:44:56 2008 +0100
+++ b/dwt/internal/image/LEDataInputStream.d	Sat Feb 23 00:56:35 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
  * Copyright (c) 2000, 2006 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -93,14 +93,14 @@
      * of bytes when you can actually read them all.
      */
     override public int read(byte b[], int off, int len) {
-        int read = 0, count;
-        while (read !is len && (count = readData(b, off, len - read)) !is -1) {
+        int read_ = 0, count;
+        while (read_ !is len && (count = readData(b, off, len - read_)) !is -1) {
             off += count;
-            read += count;
+            read_ += count;
         }
-        position += read;
-        if (read is 0 && read !is len) return -1;
-        return read;
+        position += read_;
+        if (read_ is 0 && read_ !is len) return -1;
+        return read_;
     }
 
     /**
@@ -143,7 +143,6 @@
         if (cacheCopied is len) return len;
 
         int inCopied = host.read( buffer, newOffset, len - cacheCopied );
-        if( inCopied is -1 ) inCopied = -1;
         if (inCopied > 0 ) return inCopied + cacheCopied;
         if (cacheCopied is 0) return inCopied;
         return cacheCopied;
@@ -155,7 +154,7 @@
      */
     public int readInt() {
         byte[4] buf = void;
-        host.read(buf);
+        read(buf);
         return ((((((buf[3] & 0xFF) << 24) |
             (buf[2] & 0xFF)) << 16) |
             (buf[1] & 0xFF)) << 8) |
@@ -168,7 +167,7 @@
      */
     public short readShort() {
         byte[2] buf = void;
-        host.read(buf);
+        read(buf);
         return cast(short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF));
     }