Mercurial > projects > dwt-mac
comparison dwt/internal/image/PngChunkReader.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 |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
28 PngIhdrChunk getIhdrChunk() { | 28 PngIhdrChunk getIhdrChunk() { |
29 if (headerChunk is null) { | 29 if (headerChunk is null) { |
30 try { | 30 try { |
31 PngChunk chunk = PngChunk.readNextFromStream(inputStream); | 31 PngChunk chunk = PngChunk.readNextFromStream(inputStream); |
32 if (chunk is null) DWT.error(DWT.ERROR_INVALID_IMAGE); | 32 if (chunk is null) DWT.error(DWT.ERROR_INVALID_IMAGE); |
33 headerChunk = (PngIhdrChunk) chunk; | 33 headerChunk = cast(PngIhdrChunk) chunk; |
34 headerChunk.validate(readState, null); | 34 headerChunk.validate(readState, null); |
35 } catch (ClassCastException e) { | 35 } catch (ClassCastException e) { |
36 DWT.error(DWT.ERROR_INVALID_IMAGE); | 36 DWT.error(DWT.ERROR_INVALID_IMAGE); |
37 } | 37 } |
38 } | 38 } |
44 | 44 |
45 PngChunk chunk = PngChunk.readNextFromStream(inputStream); | 45 PngChunk chunk = PngChunk.readNextFromStream(inputStream); |
46 if (chunk is null) DWT.error(DWT.ERROR_INVALID_IMAGE); | 46 if (chunk is null) DWT.error(DWT.ERROR_INVALID_IMAGE); |
47 switch (chunk.getChunkType()) { | 47 switch (chunk.getChunkType()) { |
48 case PngChunk.CHUNK_tRNS: | 48 case PngChunk.CHUNK_tRNS: |
49 ((PngTrnsChunk) chunk).validate(readState, headerChunk, paletteChunk); | 49 (cast(PngTrnsChunk) chunk).validate(readState, headerChunk, paletteChunk); |
50 break; | 50 break; |
51 case PngChunk.CHUNK_PLTE: | 51 case PngChunk.CHUNK_PLTE: |
52 chunk.validate(readState, headerChunk); | 52 chunk.validate(readState, headerChunk); |
53 paletteChunk = (PngPlteChunk) chunk; | 53 paletteChunk = cast(PngPlteChunk) chunk; |
54 break; | 54 break; |
55 default: | 55 default: |
56 chunk.validate(readState, headerChunk); | 56 chunk.validate(readState, headerChunk); |
57 } | 57 } |
58 if (readState.readIDAT && !(chunk.getChunkType() is PngChunk.CHUNK_IDAT)) { | 58 if (readState.readIDAT && !(chunk.getChunkType() is PngChunk.CHUNK_IDAT)) { |