# HG changeset patch # User Frank Benoit # Date 1203724595 -3600 # Node ID bef543dec5c33e3d4efd0389d37370fc5e3469a8 # Parent a52ddf7c3a8fbbee633fc2638abcdb16c2506ec6 Fix for LEDataStream unread diff -r a52ddf7c3a8f -r bef543dec5c3 dwt/internal/image/LEDataInputStream.d --- 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)); }