Skip to content

Commit

Permalink
Fix compiler warnings under Visual C++
Browse files Browse the repository at this point in the history
A few of these are long-standing, but most were exposed when switching
from INT32 to JLONG.
  • Loading branch information
dcommander committed Oct 15, 2015
1 parent d65e768 commit aa769fe
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
6 changes: 3 additions & 3 deletions jcdctmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ compute_reciprocal (UINT16 divisor, DCTELEM * dtbl)
dtbl[DCTSIZE2 * 0] = (DCTELEM) 1; /* reciprocal */
dtbl[DCTSIZE2 * 1] = (DCTELEM) 0; /* correction */
dtbl[DCTSIZE2 * 2] = (DCTELEM) 1; /* scale */
dtbl[DCTSIZE2 * 3] = (DCTELEM) (-sizeof(DCTELEM) * 8); /* shift */
dtbl[DCTSIZE2 * 3] = -(DCTELEM) (sizeof(DCTELEM) * 8); /* shift */
return 0;
}

Expand Down Expand Up @@ -427,12 +427,12 @@ quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace)
temp = -temp;
product = (UDCTELEM2)(temp + corr) * recip;
product >>= shift + sizeof(DCTELEM)*8;
temp = product;
temp = (DCTELEM)product;
temp = -temp;
} else {
product = (UDCTELEM2)(temp + corr) * recip;
product >>= shift + sizeof(DCTELEM)*8;
temp = product;
temp = (DCTELEM)product;
}
output_ptr[i] = (JCOEF) temp;
}
Expand Down
4 changes: 2 additions & 2 deletions jcphuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct {
*/
JOCTET * next_output_byte; /* => next byte to write in buffer */
size_t free_in_buffer; /* # of byte spaces remaining in buffer */
JLONG put_buffer; /* current bit-accumulation buffer */
size_t put_buffer; /* current bit-accumulation buffer */
int put_bits; /* # of bits now in it */
j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */

Expand Down Expand Up @@ -241,7 +241,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
if (entropy->gather_statistics)
return; /* do nothing if we're only getting stats */

put_buffer &= (((JLONG) 1)<<size) - 1; /* mask off any extra bits in code */
put_buffer &= (((size_t) 1)<<size) - 1; /* mask off any extra bits in code */

put_bits += size; /* new number of bits in buffer */

Expand Down
24 changes: 12 additions & 12 deletions jdcol565.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
SCALEBITS))];
b = range_limit[y + Cbbtab[cb]];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
Expand Down Expand Up @@ -88,7 +88,7 @@ ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
SCALEBITS))];
b = range_limit[y + Cbbtab[cb]];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}
}
Expand Down Expand Up @@ -134,7 +134,7 @@ ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
SCALEBITS)), d0)];
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
Expand Down Expand Up @@ -174,7 +174,7 @@ ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
SCALEBITS)), d0)];
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}
}
Expand Down Expand Up @@ -206,7 +206,7 @@ rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
g = GETJSAMPLE(*inptr1++);
b = GETJSAMPLE(*inptr2++);
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
Expand All @@ -229,7 +229,7 @@ rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
g = GETJSAMPLE(*inptr1);
b = GETJSAMPLE(*inptr2);
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}
}
Expand Down Expand Up @@ -263,7 +263,7 @@ rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
Expand All @@ -288,7 +288,7 @@ rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2), d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}
}
Expand All @@ -313,7 +313,7 @@ gray_rgb565_convert_internal (j_decompress_ptr cinfo,
if (PACK_NEED_ALIGNMENT(outptr)) {
g = *inptr++;
rgb = PACK_SHORT_565(g, g, g);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
Expand All @@ -328,7 +328,7 @@ gray_rgb565_convert_internal (j_decompress_ptr cinfo,
if (num_cols & 1) {
g = *inptr;
rgb = PACK_SHORT_565(g, g, g);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}
}
Expand Down Expand Up @@ -356,7 +356,7 @@ gray_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = *inptr++;
g = range_limit[DITHER_565_R(g, d0)];
rgb = PACK_SHORT_565(g, g, g);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
Expand All @@ -378,7 +378,7 @@ gray_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = *inptr;
g = range_limit[DITHER_565_R(g, d0)];
rgb = PACK_SHORT_565(g, g, g);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}
}
8 changes: 4 additions & 4 deletions jdmerge.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,12 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)

#define WRITE_TWO_PIXELS_LE(addr, pixels) { \
((INT16*)(addr))[0] = (pixels); \
((INT16*)(addr))[1] = (pixels) >> 16; \
((INT16*)(addr))[0] = (INT16)(pixels); \
((INT16*)(addr))[1] = (INT16)((pixels) >> 16); \
}
#define WRITE_TWO_PIXELS_BE(addr, pixels) { \
((INT16*)(addr))[1] = (pixels); \
((INT16*)(addr))[0] = (pixels) >> 16; \
((INT16*)(addr))[1] = (INT16)(pixels); \
((INT16*)(addr))[0] = (INT16)((pixels) >> 16); \
}

#define DITHER_565_R(r, dither) ((r) + ((dither) & 0xFF))
Expand Down
12 changes: 6 additions & 6 deletions jdmrg565.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo,
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}

Expand Down Expand Up @@ -153,7 +153,7 @@ h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo,
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr = rgb;
*(INT16*)outptr = (INT16)rgb;
}
}

Expand Down Expand Up @@ -242,14 +242,14 @@ h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo,
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr0 = rgb;
*(INT16*)outptr0 = (INT16)rgb;

y = GETJSAMPLE(*inptr01);
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr1 = rgb;
*(INT16*)outptr1 = (INT16)rgb;
}
}

Expand Down Expand Up @@ -344,13 +344,13 @@ h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr0 = rgb;
*(INT16*)outptr0 = (INT16)rgb;

y = GETJSAMPLE(*inptr01);
r = range_limit[DITHER_565_R(y + cred, d1)];
g = range_limit[DITHER_565_G(y + cgreen, d1)];
b = range_limit[DITHER_565_B(y + cblue, d1)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16*)outptr1 = rgb;
*(INT16*)outptr1 = (INT16)rgb;
}
}
3 changes: 1 addition & 2 deletions rdppm.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ read_pbm_integer (j_compress_ptr cinfo, FILE * infile, int maxval)
/* Note that on a 16-bit-int machine, only values up to 64k can be read. */
/* This should not be a problem in practice. */
{
register int ch;
register unsigned int val;
register int ch, val;

/* Skip any leading whitespace */
do {
Expand Down

0 comments on commit aa769fe

Please sign in to comment.