]> git.imager.perl.org - imager.git/commitdiff
Fixed warnings for ~0 for unsigned int variables. Also a fix for a bug
authorArnar Mar Hrafnkelsson <addi@cpan.org>
Sat, 27 Oct 2001 07:33:57 +0000 (07:33 +0000)
committerArnar Mar Hrafnkelsson <addi@cpan.org>
Sat, 27 Oct 2001 07:33:57 +0000 (07:33 +0000)
in the tga code which shows on big endian machines.

image.c
img16.c
imgdouble.c
maskimg.c
palimg.c
tga.c

diff --git a/image.c b/image.c
index 1537e9ddc298e6611ec068155e980b112ec00601..2f549866dbec67c4db5762f1b385e79c940303a0 100644 (file)
--- 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 3d02b1e91544b4353183bffeb8f62f1803ca7aa3..0aa31349afb2baf6beeab0403bafd0ff55b88a8c 100644 (file)
--- 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 */
index df5df969838ccef5bd987173a866dbb2e2a0c825..7770f7a924788e3d980e565c2fc986f2aae6b2ad 100644 (file)
@@ -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 */
index 80397110b2cb916f0c56b92c072c33e6c5a39894..21af1b92e3fd7f15cc35a4aff52b866e7a27786e 100644 (file)
--- 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 */
index 844bf219aaf7d6e9b11b163d9637081e40d15b94..ad87342445e0eb4c443a41d5128ec5bc8fed874d 100644 (file)
--- 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 e11c7a8e3c801cadc9a1251995abe6cfc3d86b35..8368ddb2a75dcde18c551b99a47483d55f8a1ba1 100644 (file)
--- 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;