From: Arnar Mar Hrafnkelsson <addi@cpan.org> Date: Sat, 27 Oct 2001 07:33:57 +0000 (+0000) Subject: Fixed warnings for ~0 for unsigned int variables. Also a fix for a bug X-Git-Tag: Imager-0.48^2~523 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/9a88a5e6b7a2a685d04c1c18d402a3735e5a3e37 Fixed warnings for ~0 for unsigned int variables. Also a fix for a bug in the tga code which shows on big endian machines. --- diff --git a/image.c b/image.c index 1537e9dd..2f549866 100644 --- a/image.c +++ b/image.c @@ -202,7 +202,7 @@ static i_img IIM_base_8bit_direct = { 0, /* channels set */ 0, 0, 0, /* xsize, ysize, bytes */ - ~0, /* ch_mask */ + ~0U, /* ch_mask */ i_8_bits, /* bits */ i_direct_type, /* type */ 0, /* virtual */ diff --git a/img16.c b/img16.c index 3d02b1e9..0aa31349 100644 --- a/img16.c +++ b/img16.c @@ -49,7 +49,7 @@ static i_img IIM_base_16bit_direct = { 0, /* channels set */ 0, 0, 0, /* xsize, ysize, bytes */ - ~0, /* ch_mask */ + ~0U, /* ch_mask */ i_16_bits, /* bits */ i_direct_type, /* type */ 0, /* virtual */ diff --git a/imgdouble.c b/imgdouble.c index df5df969..7770f7a9 100644 --- a/imgdouble.c +++ b/imgdouble.c @@ -49,7 +49,7 @@ static i_img IIM_base_double_direct = { 0, /* channels set */ 0, 0, 0, /* xsize, ysize, bytes */ - ~0, /* ch_mask */ + ~0U, /* ch_mask */ i_double_bits, /* bits */ i_direct_type, /* type */ 0, /* virtual */ diff --git a/maskimg.c b/maskimg.c index 80397110..21af1b92 100644 --- a/maskimg.c +++ b/maskimg.c @@ -60,7 +60,7 @@ static i_img IIM_base_masked = { 0, /* channels set */ 0, 0, 0, /* xsize, ysize, bytes */ - ~0, /* ch_mask */ + ~0U, /* ch_mask */ i_8_bits, /* bits */ i_palette_type, /* type */ 1, /* virtual */ diff --git a/palimg.c b/palimg.c index 844bf219..ad873424 100644 --- a/palimg.c +++ b/palimg.c @@ -42,7 +42,7 @@ static i_img IIM_base_8bit_pal = { 0, /* channels set */ 0, 0, 0, /* xsize, ysize, bytes */ - ~0, /* ch_mask */ + ~0U, /* ch_mask */ i_8_bits, /* bits */ i_palette_type, /* type */ 0, /* virtual */ diff --git a/tga.c b/tga.c index e11c7a8e..8368ddb2 100644 --- a/tga.c +++ b/tga.c @@ -387,6 +387,10 @@ tga_source_read(tga_source *s, unsigned char *buf, size_t pixels) { s->len = (s->hdr &~(1<<7))+1; s->state = (s->hdr & (1<<7)) ? Rle : Raw; + { + static cnt = 0; + printf("%04d %s: %d\n", cnt++, s->state==Rle?"RLE":"RAW", s->len); + } if (s->state == Rle && s->ig->readcb(s->ig, s->cval, s->bytepp) != s->bytepp) return 0; break; @@ -439,7 +443,7 @@ tga_dest_write(tga_dest *s, unsigned char *buf, size_t pixels) { int nxtrip = find_repeat(buf+cp*s->bytepp, pixels-cp, s->bytepp); tlen = (nxtrip == -1) ? pixels-cp : nxtrip; while(tlen) { - int clen = (tlen>128) ? 128 : tlen; + unsigned char clen = (tlen>128) ? 128 : tlen; clen--; if (s->ig->writecb(s->ig, &clen, 1) != 1) return 0; clen++; @@ -451,7 +455,7 @@ tga_dest_write(tga_dest *s, unsigned char *buf, size_t pixels) { tlen = find_span(buf+cp*s->bytepp, pixels-cp, s->bytepp); if (tlen <3) continue; while (tlen) { - int clen = (tlen>128) ? 128 : tlen; + unsigned char clen = (tlen>128) ? 128 : tlen; clen = (clen - 1) | 0x80; if (s->ig->writecb(s->ig, &clen, 1) != 1) return 0; clen = (clen & ~0x80) + 1;