]> granicus.if.org Git - imagemagick/blobdiff - coders/pdb.c
(no commit message)
[imagemagick] / coders / pdb.c
index 160a3553be57fa761d0c858d8a39905fd4752581..f373afb50b4a78dbdb03952f8cd4f81b825839f8 100644 (file)
@@ -17,7 +17,7 @@
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -304,8 +304,9 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
     *pixels;
 
   size_t
-    num_pad_bytes, /* TS */
     bits_per_pixel,
+    num_pad_bytes, /* TS */
+    one,
     packets;
 
   /*
@@ -350,7 +351,7 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
   /*
     Read record header.
   */
-  img_offset=(ssize_t) ReadBlobMSBLong(image); /* TS */
+  img_offset=(int) ReadBlobMSBLong(image); /* TS */
   attributes=(unsigned char) ReadBlobByte(image);
   count=ReadBlob(image,3,(unsigned char *) tag);
   if (count != 3  ||  memcmp(tag,"\x6f\x80\x00",3) != 0)
@@ -358,7 +359,7 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
   if (pdb_info.number_records > 1)
     {
-      comment_offset=(ssize_t) ReadBlobMSBLong(image);
+      comment_offset=(int) ReadBlobMSBLong(image);
       attributes=(unsigned char) ReadBlobByte(image);
       count=ReadBlob(image,3,(unsigned char *) tag);
       if (count != 3  ||  memcmp(tag,"\x6f\x80\x01",3) != 0)
@@ -390,7 +391,8 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
   image->depth=8;
   image->storage_class=PseudoClass;
   bits_per_pixel=pdb_image.type == 0 ? 2UL : pdb_image.type == 2 ? 4UL : 1UL;
-  if (AcquireImageColormap(image,1 << bits_per_pixel) == MagickFalse)
+  one=1;
+  if (AcquireImageColormap(image,one << bits_per_pixel) == MagickFalse)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   if (image_info->ping != MagickFalse)
     {
@@ -451,7 +453,8 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         }
         if (SyncAuthenticPixels(image,exception) == MagickFalse)
           break;
-        status=SetImageProgress(image,LoadImageTag,y,image->rows);
+        status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+                image->rows);
         if (status == MagickFalse)
           break;
       }
@@ -486,7 +489,8 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         }
         if (SyncAuthenticPixels(image,exception) == MagickFalse)
           break;
-        status=SetImageProgress(image,LoadImageTag,y,image->rows);
+        status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+                image->rows);
         if (status == MagickFalse)
           break;
       }
@@ -515,7 +519,8 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         }
         if (SyncAuthenticPixels(image,exception) == MagickFalse)
           break;
-        status=SetImageProgress(image,LoadImageTag,y,image->rows);
+        status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+                image->rows);
         if (status == MagickFalse)
           break;
       }
@@ -771,16 +776,16 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image)
   (void) WriteBlob(image,32,(unsigned char *) pdb_info.name);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_info.attributes);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_info.version);
-  (void) WriteBlobMSBLong(image,pdb_info.create_time);
-  (void) WriteBlobMSBLong(image,pdb_info.modify_time);
-  (void) WriteBlobMSBLong(image,pdb_info.archive_time);
-  (void) WriteBlobMSBLong(image,pdb_info.modify_number);
-  (void) WriteBlobMSBLong(image,pdb_info.application_info);
-  (void) WriteBlobMSBLong(image,pdb_info.sort_info);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.create_time);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.modify_time);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.archive_time);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.modify_number);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.application_info);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.sort_info);
   (void) WriteBlob(image,4,(unsigned char *) pdb_info.type);
   (void) WriteBlob(image,4,(unsigned char *) pdb_info.id);
-  (void) WriteBlobMSBLong(image,(size_t) pdb_info.seed);
-  (void) WriteBlobMSBLong(image,(size_t) pdb_info.next_record);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.seed);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_info.next_record);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_info.number_records);
   (void) CopyMagickString(pdb_image.name,pdb_info.name,32);
   pdb_image.version=1;  /* RLE Compressed */
@@ -822,7 +827,7 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image)
   quantum_info=AcquireQuantumInfo(image_info,image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
-  bits=8/(ssize_t) bits_per_pixel-1;  /* start at most significant bits */
+  bits=8/(int) bits_per_pixel-1;  /* start at most significant bits */
   literal=0;
   repeat=0;
   q=runlength;
@@ -877,11 +882,12 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image)
                   literal-=0x80;
                 }
             }
-        bits=8/(ssize_t) bits_per_pixel-1;
+        bits=8/(int) bits_per_pixel-1;
         buffer[literal+repeat]=0x00;
       }
     }
-    status=SetImageProgress(image,SaveImageTag,y,image->rows);
+    status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+                image->rows);
     if (status == MagickFalse)
       break;
   }
@@ -892,7 +898,7 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image)
   /*
     Write the Image record header.
   */
-  (void) WriteBlobMSBLong(image,(size_t)
+  (void) WriteBlobMSBLong(image,(unsigned int)
     (TellBlob(image)+8*pdb_info.number_records));
   (void) WriteBlobByte(image,0x40);
   (void) WriteBlobByte(image,0x6f);
@@ -903,7 +909,7 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image)
       /*
         Write the comment record header.
       */
-      (void) WriteBlobMSBLong(image,(size_t) (TellBlob(image)+8+58+q-
+      (void) WriteBlobMSBLong(image,(unsigned int) (TellBlob(image)+8+58+q-
         runlength));
       (void) WriteBlobByte(image,0x40);
       (void) WriteBlobByte(image,0x6f);
@@ -916,11 +922,11 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image)
   (void) WriteBlob(image,32,(unsigned char *) pdb_image.name);
   (void) WriteBlobByte(image,(unsigned char) pdb_image.version);
   (void) WriteBlobByte(image,(unsigned char) pdb_image.type);
-  (void) WriteBlobMSBLong(image,pdb_image.reserved_1);
-  (void) WriteBlobMSBLong(image,pdb_image.note);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_image.reserved_1);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_image.note);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.x_last);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.y_last);
-  (void) WriteBlobMSBLong(image,pdb_image.reserved_2);
+  (void) WriteBlobMSBLong(image,(unsigned int) pdb_image.reserved_2);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.x_anchor);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.y_anchor);
   (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.width);