diff dwt/internal/image/PngDeflater.d @ 7:e831403a80a9

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents 1a8b3cb347e0
children 5123b17c98ef
line wrap: on
line diff
--- a/dwt/internal/image/PngDeflater.d	Wed Aug 27 14:10:03 2008 +0200
+++ b/dwt/internal/image/PngDeflater.d	Wed Aug 27 14:30:35 2008 +0200
@@ -185,8 +185,8 @@
 
 void writeShortLSB(ByteArrayOutputStream baos, int theShort) {
 
-    byte byte1 = (byte) (theShort & 0xff);
-    byte byte2 = (byte) ((theShort >> 8) & 0xff);
+    byte byte1 = cast(byte) (theShort & 0xff);
+    byte byte2 = cast(byte) ((theShort >> 8) & 0xff);
     byte[] temp = {byte1, byte2};
     baos.write(temp, 0, 2);
 
@@ -194,10 +194,10 @@
 
 void writeInt(ByteArrayOutputStream baos, int theInt) {
 
-    byte byte1 = (byte) ((theInt >> 24) & 0xff);
-    byte byte2 = (byte) ((theInt >> 16) & 0xff);
-    byte byte3 = (byte) ((theInt >> 8) & 0xff);
-    byte byte4 = (byte) (theInt & 0xff);
+    byte byte1 = cast(byte) ((theInt >> 24) & 0xff);
+    byte byte2 = cast(byte) ((theInt >> 16) & 0xff);
+    byte byte3 = cast(byte) ((theInt >> 8) & 0xff);
+    byte byte4 = cast(byte) (theInt & 0xff);
     byte[] temp = {byte1, byte2, byte3, byte4};
     baos.write(temp, 0, 4);
 
@@ -229,8 +229,8 @@
     buffer |= value << bitCount;
     bitCount += count;
     if (bitCount >= 16) {
-        bytes.write((byte) buffer);
-        bytes.write((byte) (buffer >>> 8));
+        bytes.write(cast(byte) buffer);
+        bytes.write(cast(byte) (buffer >>> 8));
         buffer >>>= 16;
         bitCount -= 16;
     }
@@ -240,8 +240,8 @@
 void alignToByte() {
 
     if (bitCount > 0) {
-        bytes.write((byte) buffer);
-        if (bitCount > 8) bytes.write((byte) (buffer >>> 8));
+        bytes.write(cast(byte) buffer);
+        if (bitCount > 8) bytes.write(cast(byte) (buffer >>> 8));
     }
     buffer = 0;
     bitCount = 0;
@@ -574,7 +574,7 @@
         }
         
         // write data header
-        bytes.write((byte) BFINAL);
+        bytes.write(cast(byte) BFINAL);
         writeShortLSB(bytes, blockLength); // LEN
         writeShortLSB(bytes, blockLength ^ 0xffff); // NLEN (one's complement of LEN)
     
@@ -594,8 +594,8 @@
     inLength = input.length;
     
     // write zlib header
-    bytes.write((byte) 0x78); // window size = 0x70 (32768), compression method = 0x08
-    bytes.write((byte) 0x9C); // compression level = 0x80 (default), check bits = 0x1C
+    bytes.write(cast(byte) 0x78); // window size = 0x70 (32768), compression method = 0x08
+    bytes.write(cast(byte) 0x9C); // compression level = 0x80 (default), check bits = 0x1C
     
     // compute checksum
     for (int i = 0; i < inLength; i++) {