Mercurial > projects > dwt-mac
diff dwt/internal/image/LZWCodec.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 380af2bdd8e5 |
children | 5123b17c98ef |
line wrap: on
line diff
--- a/dwt/internal/image/LZWCodec.d Wed Aug 27 14:10:03 2008 +0200 +++ b/dwt/internal/image/LZWCodec.d Wed Aug 27 14:30:35 2008 +0200 @@ -53,7 +53,7 @@ while ((c = nextCode()) is clearCode) {} if (c !is endCode) { oc = fc = c; - buf[bufIndex] = (byte)c; + buf[bufIndex] = cast(byte)c; bufIndex++; if (bufIndex is imageWidth) { nextPutPixels(buf); @@ -90,7 +90,7 @@ } while (stackIndex > 0) { stackIndex--; - buf[bufIndex] = (byte)stack[stackIndex]; + buf[bufIndex] = cast(byte)stack[stackIndex]; bufIndex++; if (bufIndex is imageWidth) { nextPutPixels(buf); @@ -127,9 +127,9 @@ // Write out last partial block if (bitsLeft is 8) { - block[0] = (byte)(blockIndex - 1); // Nothing in last byte + block[0] = cast(byte)(blockIndex - 1); // Nothing in last byte } else { - block[0] = (byte)(blockIndex); // Last byte has data + block[0] = cast(byte)(blockIndex); // Last byte has data } writeBlock(); @@ -257,7 +257,7 @@ blockIndex = 1; blockSize = 255; block = new byte[blockSize]; - block[0] = (byte)(blockSize - 1); + block[0] = cast(byte)(blockSize - 1); nodeStack = new LZWNode[1 << bitsPerPixel]; for (int i = 0; i < nodeStack.length; i++) { LZWNode node = new LZWNode(); @@ -344,7 +344,7 @@ // *high-order* bits of the code. int c = codeToDo & MASK_TABLE[bitsLeft - 1]; currentByte = currentByte | (c << (8 - bitsLeft)); - block[blockIndex] = (byte)currentByte; + block[blockIndex] = cast(byte)currentByte; codeBitsToDo -= bitsLeft; if (codeBitsToDo < 1) { // The whole code fit in the first byte, so we are done. @@ -372,7 +372,7 @@ } while (codeBitsToDo >= 8) { currentByte = codeToDo & 0xFF; - block[blockIndex] = (byte)currentByte; + block[blockIndex] = cast(byte)currentByte; codeToDo = codeToDo >> 8; codeBitsToDo -= 8; blockIndex++; @@ -384,7 +384,7 @@ // Fill the *low-order* bits of the last byte with the remainder bitsLeft = 8 - codeBitsToDo; currentByte = codeToDo; - block[blockIndex] = (byte)currentByte; + block[blockIndex] = cast(byte)currentByte; } /** * Copy a row of pixel values to the image. @@ -421,7 +421,7 @@ else if (pass is 5) line = 0; if (pass < 5) { if (loader.hasListeners()) { - ImageData imageCopy = (ImageData) image.clone(); + ImageData imageCopy = cast(ImageData) image.clone(); loader.notifyListeners( new ImageLoaderEvent(loader, imageCopy, pass - 2, false)); } @@ -455,7 +455,7 @@ if (size is -1) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - block[0] = (byte)size; + block[0] = cast(byte)size; size = inputStream.read(block, 1, size); if (size is -1) { DWT.error(DWT.ERROR_INVALID_IMAGE);