Mercurial > projects > dwt-mac
diff dwt/internal/image/JPEGDecoder.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/JPEGDecoder.d Wed Aug 27 14:10:03 2008 +0200 +++ b/dwt/internal/image/JPEGDecoder.d Wed Aug 27 14:30:35 2008 +0200 @@ -466,7 +466,7 @@ } // look = PEEK_BITS(HUFF_LOOKAHEAD); if (nb !is 1) { - look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<<cast(HUFF_LOOKAHEAD))-1)); if ((nb = dctbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= nb; @@ -504,7 +504,7 @@ s += state.last_dc_val[ci]; state.last_dc_val[ci] = s; /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ - block[0] = (short) s; + block[0] = cast(short) s; } if (entropy.ac_needed[blkn]) { @@ -531,7 +531,7 @@ } if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); - look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<<cast(HUFF_LOOKAHEAD))-1)); if ((nb = actbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= (nb); @@ -572,7 +572,7 @@ * DCTSIZE2, which could happen if the data is * corrupted. */ - block[jpeg_natural_order[k]] = (short) s; + block[jpeg_natural_order[k]] = cast(short) s; } else { if (r !is 15) break; @@ -604,7 +604,7 @@ } if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); - look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<<cast(HUFF_LOOKAHEAD))-1)); if ((nb = actbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= (nb); @@ -937,7 +937,7 @@ } if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); - look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<<cast(HUFF_LOOKAHEAD))-1)); if ((nb = tbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= nb; @@ -1044,7 +1044,7 @@ if (s !is 0) { int pos = jpeg_natural_order[k]; /* Output newly nonzero coefficient */ - block[pos] = (short) s; + block[pos] = cast(short) s; /* Remember its position in case we have to suspend */ newnz_pos[num_newnz++] = pos; } @@ -1182,7 +1182,7 @@ } if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); - look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<<cast(HUFF_LOOKAHEAD))-1)); if ((nb = tbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); @@ -1216,7 +1216,7 @@ // s = HUFF_EXTEND(r, s); s = ((r) < extend_test[s] ? (r) + extend_offset[s] : (r)); /* Scale and output coefficient in natural (dezigzagged) order */ - block[jpeg_natural_order[k]] = (short) (s << Al); + block[jpeg_natural_order[k]] = cast(short) (s << Al); } else { if (r is 15) { /* ZRL */ k += 15; /* skip 15 zeroes in band */ @@ -1335,7 +1335,7 @@ } if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); - look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<<cast(HUFF_LOOKAHEAD))-1)); if ((nb = tbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); @@ -1371,7 +1371,7 @@ s += state.last_dc_val[ci]; state.last_dc_val[ci] = s; /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */ - block[0] = (short) (s << Al); + block[0] = cast(short) (s << Al); } /* Completed MCU, so update state */ @@ -1918,8 +1918,8 @@ // i = 0; // for (row = 0; row < DCTSIZE; row++) { // for (col = 0; col < DCTSIZE; col++) { -// fmtbl[i] = (FLOAT_MULT_TYPE) -// ((double) qtbl.quantval[i] * +// fmtbl[i] = cast(FLOAT_MULT_TYPE) +// (cast(double) qtbl.quantval[i] * // aanscalefactor[row] * aanscalefactor[col]); // i++; // } @@ -1992,7 +1992,7 @@ // if (post.buffer is null) { // post.buffer = (*cinfo.mem.access_virt_sarray) // ((j_common_ptr) cinfo, post.whole_image, -// (JDIMENSION) 0, post.strip_height, TRUE); +// cast(JDIMENSION) 0, post.strip_height, TRUE); // } } else { /* For single-pass processing without color quantization, @@ -2318,8 +2318,8 @@ //#endif coef.whole_image[ci] = new short - [(int)jround_up( compptr.height_in_blocks, compptr.v_samp_factor)] - [(int)jround_up( compptr.width_in_blocks, compptr.h_samp_factor)] + [cast(int)jround_up( compptr.height_in_blocks, compptr.v_samp_factor)] + [cast(int)jround_up( compptr.width_in_blocks, compptr.h_samp_factor)] [DCTSIZE2]; } // coef.consume_data = consume_data; @@ -2387,23 +2387,23 @@ // /* Compute actual output image dimensions and DCT scaling choices. */ // if (cinfo.scale_num * 8 <= cinfo.scale_denom) { // /* Provide 1/8 scaling */ -// cinfo.output_width = (int) +// cinfo.output_width = cast(int) // jdiv_round_up(cinfo.image_width, 8L); -// cinfo.output_height = (int) +// cinfo.output_height = cast(int) // jdiv_round_up(cinfo.image_height, 8L); // cinfo.min_DCT_scaled_size = 1; // } else if (cinfo.scale_num * 4 <= cinfo.scale_denom) { // /* Provide 1/4 scaling */ -// cinfo.output_width = (int) +// cinfo.output_width = cast(int) // jdiv_round_up(cinfo.image_width, 4L); -// cinfo.output_height = (int) +// cinfo.output_height = cast(int) // jdiv_round_up(cinfo.image_height, 4L); // cinfo.min_DCT_scaled_size = 2; // } else if (cinfo.scale_num * 2 <= cinfo.scale_denom) { // /* Provide 1/2 scaling */ -// cinfo.output_width = (int) +// cinfo.output_width = cast(int) // jdiv_round_up(cinfo.image_width, 2L); -// cinfo.output_height = (int) +// cinfo.output_height = cast(int) // jdiv_round_up(cinfo.image_height, 2L); // cinfo.min_DCT_scaled_size = 4; // } else { @@ -2435,11 +2435,11 @@ // for (ci = 0; ci < cinfo.num_components; ci++) { // compptr = cinfo.comp_info[ci]; // /* Size in samples, after IDCT scaling */ -// compptr.downsampled_width = (int) -// jdiv_round_up((long) cinfo.image_width * (long) (compptr.h_samp_factor * compptr.DCT_scaled_size), +// compptr.downsampled_width = cast(int) +// jdiv_round_up(cast(long) cinfo.image_width * cast(long) (compptr.h_samp_factor * compptr.DCT_scaled_size), // (cinfo.max_h_samp_factor * DCTSIZE)); -// compptr.downsampled_height = (int) -// jdiv_round_up((long) cinfo.image_height * (long) (compptr.v_samp_factor * compptr.DCT_scaled_size), +// compptr.downsampled_height = cast(int) +// jdiv_round_up(cast(long) cinfo.image_height * cast(long) (compptr.v_samp_factor * compptr.DCT_scaled_size), // (cinfo.max_v_samp_factor * DCTSIZE)); // } // @@ -2529,11 +2529,11 @@ /* First segment of "simple" table: limit[x] = 0 for x < 0 */ /* Main part of "simple" table: limit[x] = x */ for (i = 0; i <= MAXJSAMPLE; i++) - table[i + offset] = (byte)i; + table[i + offset] = cast(byte)i; offset += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ /* End of simple table, rest of first half of post-IDCT table */ for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) - table[i+offset] = (byte)MAXJSAMPLE; + table[i+offset] = cast(byte)MAXJSAMPLE; /* Second half of post-IDCT table */ System.arraycopy(cinfo.sample_range_limit, cinfo.sample_range_limit_offset, table, offset + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), CENTERJSAMPLE); } @@ -2553,14 +2553,14 @@ /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* Cr=>R value is nearest int to 1.40200 * x */ - cconvert.Cr_r_tab[i] = ((int)(1.40200f * (1<<SCALEBITS) + 0.5f) * x + ONE_HALF) >> SCALEBITS; + cconvert.Cr_r_tab[i] = (cast(int)(1.40200f * (1<<SCALEBITS) + 0.5f) * x + ONE_HALF) >> SCALEBITS; /* Cb=>B value is nearest int to 1.77200 * x */ - cconvert.Cb_b_tab[i] = ((int)(1.77200f * (1<<SCALEBITS) + 0.5f) * x + ONE_HALF) >> SCALEBITS; + cconvert.Cb_b_tab[i] = (cast(int)(1.77200f * (1<<SCALEBITS) + 0.5f) * x + ONE_HALF) >> SCALEBITS; /* Cr=>G value is scaled-up -0.71414 * x */ - cconvert.Cr_g_tab[i] = ((int)(- (0.71414f * (1<<SCALEBITS) + 0.5f)) * x); + cconvert.Cr_g_tab[i] = (cast(int)(- (0.71414f * (1<<SCALEBITS) + 0.5f)) * x); /* Cb=>G value is scaled-up -0.34414 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ - cconvert.Cb_g_tab[i] = ((int)(- (0.34414f* (1<<SCALEBITS) + 0.5f)) * x + ONE_HALF); + cconvert.Cb_g_tab[i] = (cast(int)(- (0.34414f* (1<<SCALEBITS) + 0.5f)) * x + ONE_HALF); } } @@ -2680,8 +2680,8 @@ // post.whole_image = (*cinfo.mem.request_virt_sarray) // ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, // cinfo.output_width * cinfo.out_color_components, -// (JDIMENSION) jround_up((long) cinfo.output_height, -// (long) post.strip_height), +// cast(JDIMENSION) jround_up(cast(long) cinfo.output_height, +// cast(long) post.strip_height), // post.strip_height); //#else // ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); @@ -2875,14 +2875,14 @@ } else if ((h_out_group % h_in_group) is 0 && (v_out_group % v_in_group) is 0) { /* Generic integral-factors upsampling method */ upsample.methods[ci] = INT_UPSAMPLE; - upsample.h_expand[ci] = (byte) (h_out_group / h_in_group); - upsample.v_expand[ci] = (byte) (v_out_group / v_in_group); + upsample.h_expand[ci] = cast(byte) (h_out_group / h_in_group); + upsample.v_expand[ci] = cast(byte) (v_out_group / v_in_group); } else error(); // ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); if (need_buffer) { upsample.color_buf[ci] = new byte[cinfo.max_v_samp_factor] - [(int) jround_up(cinfo.output_width, cinfo.max_h_samp_factor)]; + [cast(int) jround_up(cinfo.output_width, cinfo.max_h_samp_factor)]; } } } @@ -3250,8 +3250,8 @@ prepare_range_limit_table(cinfo); /* Width of an output scanline must be representable as JDIMENSION. */ - samplesperrow = (long) cinfo.output_width * (long) cinfo.out_color_components; - jd_samplesperrow = (int) samplesperrow; + samplesperrow = cast(long) cinfo.output_width * cast(long) cinfo.out_color_components; + jd_samplesperrow = cast(int) samplesperrow; if ( jd_samplesperrow !is samplesperrow) error(); // ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); @@ -3369,7 +3369,7 @@ // nscans = cinfo.num_components; // } // cinfo.progress.pass_counter = 0L; -// cinfo.progress.pass_limit = (long) cinfo.total_iMCU_rows * nscans; +// cinfo.progress.pass_limit = cast(long) cinfo.total_iMCU_rows * nscans; // cinfo.progress.completed_passes = 0; // cinfo.progress.total_passes = (cinfo.enable_2pass_quant ? 3 : 2); // /* Count the input pass as done */ @@ -3443,7 +3443,7 @@ // if (cinfo.progress !is null && (retcode is JPEG_ROW_COMPLETED || retcode is JPEG_REACHED_SOS)) { // if (++cinfo.progress.pass_counter >= cinfo.progress.pass_limit) { // /* jdmaster underestimated number of scans; ratchet up one scan */ -// cinfo.progress.pass_limit += (long) cinfo.total_iMCU_rows; +// cinfo.progress.pass_limit += cast(long) cinfo.total_iMCU_rows; // } // } } @@ -3960,7 +3960,7 @@ pred = (1<<Al)-1; pred = -pred; } - workspace[1] = (short) pred; + workspace[1] = cast(short) pred; } /* AC10 */ if ((Al=coef_bits[2+coef_offset]) !is 0 && workspace[8] is 0) { @@ -3975,7 +3975,7 @@ pred = (1<<Al)-1; pred = -pred; } - workspace[8] = (short) pred; + workspace[8] = cast(short) pred; } /* AC20 */ if ((Al=coef_bits[3+coef_offset]) !is 0 && workspace[16] is 0) { @@ -3990,7 +3990,7 @@ pred = (1<<Al)-1; pred = -pred; } - workspace[16] = (short) pred; + workspace[16] = cast(short) pred; } /* AC11 */ if ((Al=coef_bits[4+coef_offset]) !is 0 && workspace[9] is 0) { @@ -4005,7 +4005,7 @@ pred = (1<<Al)-1; pred = -pred; } - workspace[9] = (short) pred; + workspace[9] = cast(short) pred; } /* AC02 */ if ((Al=coef_bits[5+coef_offset]) !is 0 && workspace[2] is 0) { @@ -4020,7 +4020,7 @@ pred = (1<<Al)-1; pred = -pred; } - workspace[2] = (short) pred; + workspace[2] = cast(short) pred; } /* OK, do the IDCT */ jpeg_idct_islow(cinfo, compptr, workspace, output_ptr, output_ptr_offset, output_col); @@ -4305,8 +4305,8 @@ /* Call progress monitor hook if present */ // if (cinfo.progress !is NULL) { -// cinfo.progress.pass_counter = (long) cinfo.output_scanline; -// cinfo.progress.pass_limit = (long) cinfo.output_height; +// cinfo.progress.pass_counter = cast(long) cinfo.output_scanline; +// cinfo.progress.pass_limit = cast(long) cinfo.output_height; // (*cinfo.progress.progress_monitor) ((j_common_ptr) cinfo); // } @@ -4345,14 +4345,14 @@ // JDIMENSION last_scanline; // /* Call progress monitor hook if present */ // if (cinfo.progress !is NULL) { -// cinfo.progress.pass_counter = (long) cinfo.output_scanline; -// cinfo.progress.pass_limit = (long) cinfo.output_height; +// cinfo.progress.pass_counter = cast(long) cinfo.output_scanline; +// cinfo.progress.pass_limit = cast(long) cinfo.output_height; // (*cinfo.progress.progress_monitor) ((j_common_ptr) cinfo); // } // /* Process some data */ // last_scanline = cinfo.output_scanline; -// (*cinfo.main.process_data) (cinfo, (JSAMPARRAY) NULL, -// &cinfo.output_scanline, (JDIMENSION) 0); +// (*cinfo.main.process_data) (cinfo, cast(JSAMPARRAY) NULL, +// &cinfo.output_scanline, cast(JDIMENSION) 0); // if (cinfo.output_scanline is last_scanline) // return FALSE; /* No progress made, must suspend */ // } @@ -4487,7 +4487,7 @@ tmp = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; } /* We convert the zigzag-order table to natural array order. */ - quant_ptr.quantval[jpeg_natural_order[i]] = (short) tmp; + quant_ptr.quantval[jpeg_natural_order[i]] = cast(short) tmp; } // if (cinfo.err.trace_level >= 2) { @@ -4564,10 +4564,10 @@ // ERREXIT1(cinfo, JERR_DAC_INDEX, index); if (index >= NUM_ARITH_TBLS) { /* define AC table */ - cinfo.arith_ac_K[index-NUM_ARITH_TBLS] = (byte) val; + cinfo.arith_ac_K[index-NUM_ARITH_TBLS] = cast(byte) val; } else { /* define DC table */ - cinfo.arith_dc_L[index] = (byte) (val & 0x0F); - cinfo.arith_dc_U[index] = (byte) (val >> 4); + cinfo.arith_dc_L[index] = cast(byte) (val & 0x0F); + cinfo.arith_dc_U[index] = cast(byte) (val >> 4); if (cinfo.arith_dc_L[index] > cinfo.arith_dc_U[index]) error(); // ERREXIT1(cinfo, JERR_DAC_VALUE, val); @@ -4688,7 +4688,7 @@ length -= 8; // TRACEMS4(cinfo, 1, JTRC_SOF, cinfo.unread_marker, -// (int) cinfo.image_width, (int) cinfo.image_height, +// cast(int) cinfo.image_width, cast(int) cinfo.image_height, // cinfo.num_components); if (cinfo.marker.saw_SOF) @@ -4872,20 +4872,20 @@ int inptr_offset = 0, outptr_offset = 0; /* Special case for first column */ invalue = inptr[inptr_offset++] & 0xFF; - outptr[outptr_offset++] = (byte) invalue; - outptr[outptr_offset++] = (byte) ((invalue * 3 + (inptr[inptr_offset] & 0xFF) + 2) >> 2); + outptr[outptr_offset++] = cast(byte) invalue; + outptr[outptr_offset++] = cast(byte) ((invalue * 3 + (inptr[inptr_offset] & 0xFF) + 2) >> 2); for (colctr = compptr.downsampled_width - 2; colctr > 0; colctr--) { /* General case: 3/4 * nearer pixel + 1/4 * further pixel */ invalue = (inptr[inptr_offset++] & 0xFF) * 3; - outptr[outptr_offset++] = (byte) ((invalue + (inptr[inptr_offset-2] & 0xFF) + 1) >> 2); - outptr[outptr_offset++] = (byte) ((invalue + (inptr[inptr_offset] & 0xFF) + 2) >> 2); + outptr[outptr_offset++] = cast(byte) ((invalue + (inptr[inptr_offset-2] & 0xFF) + 1) >> 2); + outptr[outptr_offset++] = cast(byte) ((invalue + (inptr[inptr_offset] & 0xFF) + 2) >> 2); } /* Special case for last column */ invalue = (inptr[inptr_offset] & 0xFF); - outptr[outptr_offset++] = (byte) ((invalue * 3 + (inptr[inptr_offset-1] & 0xFF) + 1) >> 2); - outptr[outptr_offset++] = (byte) invalue; + outptr[outptr_offset++] = cast(byte) ((invalue * 3 + (inptr[inptr_offset-1] & 0xFF) + 1) >> 2); + outptr[outptr_offset++] = cast(byte) invalue; } } @@ -4915,22 +4915,22 @@ /* Special case for first column */ thiscolsum = (inptr0[inptr0_offset++] & 0xFF) * 3 + (inptr1[inptr1_offset++] & 0xFF); nextcolsum = (inptr0[inptr0_offset++] & 0xFF) * 3 + (inptr1[inptr1_offset++] & 0xFF); - outptr[outptr_offset++] = (byte) ((thiscolsum * 4 + 8) >> 4); - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 4 + 8) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); lastcolsum = thiscolsum; thiscolsum = nextcolsum; for (colctr = compptr.downsampled_width - 2; colctr > 0; colctr--) { /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */ /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */ nextcolsum = (inptr0[inptr0_offset++] & 0xFF) * 3 + (inptr1[inptr1_offset++] & 0xFF); - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); lastcolsum = thiscolsum; thiscolsum = nextcolsum; } /* Special case for last column */ - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); - outptr[outptr_offset++] = (byte) ((thiscolsum * 4 + 7) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 4 + 7) >> 4); } inrow++; } @@ -5110,7 +5110,7 @@ length -= 2; -// TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo.unread_marker, (int) length); +// TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo.unread_marker, cast(int) length); if (length > 0) { skip_input_data (cinfo, length); @@ -5185,10 +5185,10 @@ /* Found JFIF APP0 marker: save info */ cinfo.saw_JFIF_marker = true; cinfo.JFIF_major_version = (data[5]); - cinfo.JFIF_minor_version = (byte)(data[6] & 0xFF); - cinfo.density_unit = (byte)(data[7] & 0xFF); - cinfo.X_density = (short)(((data[8] & 0xFF) << 8) + (data[9] & 0xFF)); - cinfo.Y_density = (short)(((data[10] & 0xFF) << 8) + (data[11] & 0xFF)); + cinfo.JFIF_minor_version = cast(byte)(data[6] & 0xFF); + cinfo.density_unit = cast(byte)(data[7] & 0xFF); + cinfo.X_density = cast(short)(((data[8] & 0xFF) << 8) + (data[9] & 0xFF)); + cinfo.Y_density = cast(short)(((data[10] & 0xFF) << 8) + (data[11] & 0xFF)); /* Check version. * Major version must be 1, anything else signals an incompatible change. * (We used to treat this as an error, but now it's a nonfatal warning, @@ -5210,7 +5210,7 @@ } totallen -= APP0_DATA_LEN; if (totallen != ((data[12] & 0xFF) * (data[13] & 0xFF) * 3)) { -// TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, cast(int) totallen); } } else if (datalen >= 6 && (data[0] & 0xFF) is 0x4A && @@ -5225,21 +5225,21 @@ */ switch ((data[5]) & 0xFF) { case 0x10: -// TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, cast(int) totallen); break; case 0x11: -// TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, cast(int) totallen); break; case 0x13: -// TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, cast(int) totallen); break; default: -// TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, GETJOCTET(data[5]), (int) totallen); +// TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, GETJOCTET(data[5]), cast(int) totallen); break; } } else { /* Start of APP0 does not match "JFIF" or "JFXX", or too short */ -// TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_APP0, cast(int) totallen); } } @@ -5265,10 +5265,10 @@ transform = (data[11] & 0xFF); // TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform); cinfo.saw_Adobe_marker = true; - cinfo.Adobe_transform = (byte) transform; + cinfo.Adobe_transform = cast(byte) transform; } else { /* Start of APP14 does not match "Adobe", or too short */ -// TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining)); +// TRACEMS1(cinfo, 1, JTRC_APP14, cast(int) (datalen + remaining)); } } @@ -5558,8 +5558,8 @@ // ERREXIT(cinfo, JERR_INPUT_EMPTY); // WARNMS(cinfo, JWRN_JPEG_EOF); /* Insert a fake EOI marker */ - cinfo.buffer[0] = (byte)0xFF; - cinfo.buffer[1] = (byte)M_EOI; + cinfo.buffer[0] = cast(byte)0xFF; + cinfo.buffer[1] = cast(byte)M_EOI; nbytes = 2; } cinfo.bytes_in_buffer = nbytes; @@ -5835,15 +5835,15 @@ compptr = cinfo.comp_info[ci]; compptr.DCT_scaled_size = DCTSIZE; /* Size in DCT blocks */ - compptr.width_in_blocks = (int)jdiv_round_up((long) cinfo.image_width * (long) compptr.h_samp_factor, (cinfo.max_h_samp_factor * DCTSIZE)); - compptr.height_in_blocks = (int)jdiv_round_up((long) cinfo.image_height * (long) compptr.v_samp_factor, (cinfo.max_v_samp_factor * DCTSIZE)); + compptr.width_in_blocks = cast(int)jdiv_round_up(cast(long) cinfo.image_width * cast(long) compptr.h_samp_factor, (cinfo.max_h_samp_factor * DCTSIZE)); + compptr.height_in_blocks = cast(int)jdiv_round_up(cast(long) cinfo.image_height * cast(long) compptr.v_samp_factor, (cinfo.max_v_samp_factor * DCTSIZE)); /* downsampled_width and downsampled_height will also be overridden by * jdmaster.c if we are doing full decompression. The transcoder library * doesn't use these values, but the calling application might. */ /* Size in samples */ - compptr.downsampled_width = (int)jdiv_round_up((long) cinfo.image_width * (long) compptr.h_samp_factor, cinfo.max_h_samp_factor); - compptr.downsampled_height = (int)jdiv_round_up((long) cinfo.image_height * (long) compptr.v_samp_factor, cinfo.max_v_samp_factor); + compptr.downsampled_width = cast(int)jdiv_round_up(cast(long) cinfo.image_width * cast(long) compptr.h_samp_factor, cinfo.max_h_samp_factor); + compptr.downsampled_height = cast(int)jdiv_round_up(cast(long) cinfo.image_height * cast(long) compptr.v_samp_factor, cinfo.max_v_samp_factor); /* Mark component needed, until color conversion says otherwise */ compptr.component_needed = true; /* Mark no quantization table yet saved for component */ @@ -5851,7 +5851,7 @@ } /* Compute number of fully interleaved MCU rows. */ - cinfo.total_iMCU_rows = (int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); + cinfo.total_iMCU_rows = cast(int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); /* Decide whether file contains multiple scans */ if (cinfo.comps_in_scan < cinfo.num_components || cinfo.progressive_mode) @@ -5902,8 +5902,8 @@ // ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo.comps_in_scan, MAX_COMPS_IN_SCAN); /* Overall image size in MCUs */ - cinfo.MCUs_per_row = (int)jdiv_round_up( cinfo.image_width, (cinfo.max_h_samp_factor*DCTSIZE)); - cinfo.MCU_rows_in_scan = (int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); + cinfo.MCUs_per_row = cast(int)jdiv_round_up( cinfo.image_width, (cinfo.max_h_samp_factor*DCTSIZE)); + cinfo.MCU_rows_in_scan = cast(int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); cinfo.blocks_in_MCU = 0; @@ -5990,7 +5990,7 @@ error(); // ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); while (i-- !is 0) - huffsize[p++] = (byte) l; + huffsize[p++] = cast(byte) l; } huffsize[p] = 0; numsymbols = p; @@ -6348,7 +6348,7 @@ System.arraycopy(buffer[0], 0, data, offset, row_stride); } jpeg_finish_output(cinfo); - loader.notifyListeners(new ImageLoaderEvent(loader, (ImageData)imageData.clone(), incrementCount, done = jpeg_input_complete(cinfo))); + loader.notifyListeners(new ImageLoaderEvent(loader, cast(ImageData)imageData.clone(), incrementCount, done = jpeg_input_complete(cinfo))); } while (!done); } else { while (cinfo.output_scanline < cinfo.output_height) {