Eliminate a few more warnings in Windows builds

This commit is contained in:
Steve Underwood 2013-10-16 01:33:37 +08:00
parent 15ca745cd4
commit 348e9ba1d1
6 changed files with 20 additions and 26 deletions

View File

@ -72,7 +72,7 @@ int main(int argc, char *argv[])
r = floorf(r*256.0f);
srgb = (r < 0) ? 0 : (r <= 255) ? r : 255;
srgb = (uint8_t) ((r < 0) ? 0 : (r <= 255) ? r : 255);
printf((i < 4095) ? " %d,\n" : " %d\n", srgb);
}

View File

@ -42,7 +42,7 @@ int main(int argc, char *argv[])
for (i = 0; i < 129; i++)
{
val = 32768.0*128.0/(128 + i) + 0.5;
ival = val;
ival = (int) val;
if (i < 128)
printf(" %6d,\n", ival);
else
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
printf("{\n");
for (i = 64; i <= 256; i++)
{
ival = sqrt(i/256.0)*65536.0 + 0.5;
ival = (int) (sqrt(i/256.0)*65536.0 + 0.5);
if (ival > 65535)
ival = 65535;
if (i < 256)
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
printf("{\n");
for (i = 128; i <= 256; i++)
{
ival = log10(i/256.0)*32768.0 - 0.5;
ival = (int) (log10(i/256.0)*32768.0 - 0.5);
if (i <= 255)
printf(" %6d,\n", ival);
else
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
for (i = 0; i <= 256; i++)
{
val = sin(i*3.1415926535/512.0)*32768.0;
ival = val + 0.5;
ival = (int) (val + 0.5);
if (ival > 32767)
ival = 32767;
if (i <= 255)
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
for (i = 0; i <= 256; i++)
{
val = atan(i/256.0)*65536.0/(2.0*3.1415926535);
ival = val + 0.5;
ival = (int) (val + 0.5);
/* Nudge the result away from zero, so things sit consistently on
the correct side of the axes. */
if (ival == 0)

View File

@ -258,7 +258,6 @@ static int set_next_tx_type(t38_gateway_state_t *s)
int indicator;
fax_modems_state_t *t;
t38_gateway_hdlc_state_t *u;
int bit_rate;
int short_train;
int use_hdlc;
@ -348,20 +347,18 @@ static int set_next_tx_type(t38_gateway_state_t *s)
break;
case T38_IND_V27TER_2400_TRAINING:
case T38_IND_V27TER_4800_TRAINING:
bit_rate =
t->tx_bit_rate = (indicator == T38_IND_V27TER_4800_TRAINING) ? 4800 : 2400;
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_TX, bit_rate, s->core.short_train, use_hdlc);
fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_TX, t->tx_bit_rate, s->core.short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx);
fax_modems_set_rx_active(t, true);
break;
case T38_IND_V29_7200_TRAINING:
case T38_IND_V29_9600_TRAINING:
bit_rate =
t->tx_bit_rate = (indicator == T38_IND_V29_9600_TRAINING) ? 9600 : 7200;
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
fax_modems_start_fast_modem(t, FAX_MODEM_V29_TX, bit_rate, s->core.short_train, use_hdlc);
fax_modems_start_fast_modem(t, FAX_MODEM_V29_TX, t->tx_bit_rate, s->core.short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx);
fax_modems_set_rx_active(t, true);
@ -379,37 +376,36 @@ static int set_next_tx_type(t38_gateway_state_t *s)
{
case T38_IND_V17_7200_SHORT_TRAINING:
short_train = true;
bit_rate = 7200;
t->tx_bit_rate = 7200;
break;
case T38_IND_V17_7200_LONG_TRAINING:
bit_rate = 7200;
t->tx_bit_rate = 7200;
break;
case T38_IND_V17_9600_SHORT_TRAINING:
short_train = true;
bit_rate = 9600;
t->tx_bit_rate = 9600;
break;
case T38_IND_V17_9600_LONG_TRAINING:
bit_rate = 9600;
t->tx_bit_rate = 9600;
break;
case T38_IND_V17_12000_SHORT_TRAINING:
short_train = true;
bit_rate = 12000;
t->tx_bit_rate = 12000;
break;
case T38_IND_V17_12000_LONG_TRAINING:
bit_rate = 12000;
t->tx_bit_rate = 12000;
break;
case T38_IND_V17_14400_SHORT_TRAINING:
short_train = true;
bit_rate = 14400;
t->tx_bit_rate = 14400;
break;
case T38_IND_V17_14400_LONG_TRAINING:
bit_rate = 14400;
t->tx_bit_rate = 14400;
break;
}
/*endswitch*/
t->tx_bit_rate = bit_rate;
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
fax_modems_start_fast_modem(t, FAX_MODEM_V17_TX, bit_rate, short_train, use_hdlc);
fax_modems_start_fast_modem(t, FAX_MODEM_V17_TX, t->tx_bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx);
fax_modems_set_rx_active(t, true);

View File

@ -763,6 +763,7 @@ SPAN_DECLARE(int) t43_decode_put(t43_decode_state_t *s, const uint8_t data[], si
/* Now deal the bit-planes, one after another. */
total_len = 0;
result = 0;
while (s->current_bit_plane < s->t85.bit_planes)
{
j = s->current_bit_plane;

View File

@ -219,6 +219,7 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
bits_per_sample = 1;
samples_per_pixel = 1;
photometric = PHOTOMETRIC_MINISWHITE;
output_t4_options = 0;
switch (t->compression)
{
case T4_COMPRESSION_T4_1D:

View File

@ -762,10 +762,7 @@ static int tiff_row_read_handler(void *user_data, uint8_t buf[], size_t len)
if (s->tiff.row >= s->tiff.image_length)
return 0;
if (s->tiff.image_buffer == NULL)
{
exit(2);
return 0;
}
memcpy(buf, &s->tiff.image_buffer[s->tiff.row*len], len);
s->tiff.row++;
@ -1158,7 +1155,6 @@ static int read_tiff_image(t4_tx_state_t *s)
{
int total_len;
int i;
int len;
int alter_image;
uint8_t *t;
@ -1204,7 +1200,7 @@ static int read_tiff_image(t4_tx_state_t *s)
{
if (alter_image)
{
if ((len = read_tiff_t43_image(s)) < 0)
if ( read_tiff_t43_image(s) < 0)
return -1;
s->pack_buf = s->tiff.image_buffer;
}