Mercurial > projects > dwt-mac
diff dwt/internal/image/PngChunk.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/PngChunk.d Wed Aug 27 14:10:03 2008 +0200 +++ b/dwt/internal/image/PngChunk.d Wed Aug 27 14:30:35 2008 +0200 @@ -35,11 +35,11 @@ // Non-critical chunks. static final int CHUNK_tRNS = 5; - static final byte[] TYPE_IHDR = {(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'}; - static final byte[] TYPE_PLTE = {(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'}; - static final byte[] TYPE_IDAT = {(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'}; - static final byte[] TYPE_IEND = {(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; - static final byte[] TYPE_tRNS = {(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; + static final byte[] TYPE_IHDR = {cast(byte) 'I', cast(byte) 'H', cast(byte) 'D', cast(byte) 'R'}; + static final byte[] TYPE_PLTE = {cast(byte) 'P', cast(byte) 'L', cast(byte) 'T', cast(byte) 'E'}; + static final byte[] TYPE_IDAT = {cast(byte) 'I', cast(byte) 'D', cast(byte) 'A', cast(byte) 'T'}; + static final byte[] TYPE_IEND = {cast(byte) 'I', cast(byte) 'E', cast(byte) 'N', cast(byte) 'D'}; + static final byte[] TYPE_tRNS = {cast(byte) 't', cast(byte) 'R', cast(byte) 'N', cast(byte) 'S'}; static final int[] CRC_TABLE; static { @@ -108,8 +108,8 @@ * array at the given offset. */ void setInt16(int offset, int value) { - reference[offset] = (byte) ((value >> 8) & 0xFF); - reference[offset + 1] = (byte) (value & 0xFF); + reference[offset] = cast(byte) ((value >> 8) & 0xFF); + reference[offset + 1] = cast(byte) (value & 0xFF); } /** @@ -130,10 +130,10 @@ * array at the given offset. */ void setInt32(int offset, int value) { - reference[offset] = (byte) ((value >> 24) & 0xFF); - reference[offset + 1] = (byte) ((value >> 16) & 0xFF); - reference[offset + 2] = (byte) ((value >> 8) & 0xFF); - reference[offset + 3] = (byte) (value & 0xFF); + reference[offset] = cast(byte) ((value >> 24) & 0xFF); + reference[offset + 1] = cast(byte) ((value >> 16) & 0xFF); + reference[offset + 2] = cast(byte) ((value >> 8) & 0xFF); + reference[offset + 3] = cast(byte) (value & 0xFF); } /** @@ -273,7 +273,7 @@ } bool isCritical() { - char c = (char) getTypeBytes()[0]; + char c = cast(wchar) getTypeBytes()[0]; return 'A' <= c && c <= 'Z'; } @@ -333,12 +333,12 @@ byte[] type = getTypeBytes(); // The third character MUST be upper case. - char c = (char) type[2]; + char c = cast(wchar) type[2]; if (!('A' <= c && c <= 'Z')) DWT.error(DWT.ERROR_INVALID_IMAGE); // All characters must be letters. for (int i = 0; i < TYPE_FIELD_LENGTH; i++) { - c = (char) type[i]; + c = cast(wchar) type[i]; if (!(('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) { DWT.error(DWT.ERROR_INVALID_IMAGE); } @@ -368,7 +368,7 @@ buffer.append("\n\tType: "); byte[] type = getTypeBytes(); for(int i = 0; i < type.length; i++) { - buffer.append((char) type[i]); + buffer.append(cast(wchar) type[i]); } contributeToString(buffer);