Mercurial > projects > dwt-win
diff dwt/internal/image/LEDataInputStream.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | bef543dec5c3 |
children | fd9c62a2998e |
line wrap: on
line diff
--- a/dwt/internal/image/LEDataInputStream.d Mon May 05 00:12:38 2008 +0200 +++ b/dwt/internal/image/LEDataInputStream.d Sat May 17 17:34:28 2008 +0200 @@ -51,7 +51,7 @@ else throw new IllegalArgumentException("bufferSize must be greater zero" ); } - override public void close() { + public void close() { buf = null; if (host !is null) { host.close(); @@ -69,7 +69,7 @@ /** * Answers how many bytes are available for reading without blocking */ - override public int available() { + public override int available() { if (buf is null) throw new IOException("buf is null"); return (buf.length - pos) + host.available(); } @@ -77,7 +77,7 @@ /** * Answer the next byte of the input stream. */ - override public int read() { + public override int read() { if (buf is null) throw new IOException("buf is null"); if (pos < buf.length) { position++; @@ -92,15 +92,15 @@ * Don't imitate the JDK behaviour of reading a random number * 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) { + public override int read(byte b[], int off, int len) { + 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,6 +143,7 @@ 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,9 +156,9 @@ public int readInt() { byte[4] buf = void; read(buf); - return ((((((buf[3] & 0xFF) << 24) | - (buf[2] & 0xFF)) << 16) | - (buf[1] & 0xFF)) << 8) | + return ((buf[3] & 0xFF) << 24) | + ((buf[2] & 0xFF) << 16) | + ((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF); }