]> granicus.if.org Git - imagemagick/blobdiff - coders/cals.c
(no commit message)
[imagemagick] / coders / cals.c
index a89a804e73b018e0880e58fead1635ed1ea654c8..bba5409e7e7b5d85f1bdb5f45134509dd53b2bea 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  %
 #include "magick/string_.h"
 #include "magick/module.h"
 \f
+#if defined(MAGICKCORE_TIFF_DELEGATE)
 /*
  Forward declarations.
 */
 static MagickBooleanType
   WriteCALSImage(const ImageInfo *,Image *);
+#endif
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -161,7 +163,7 @@ static Image *ReadCALSImage(const ImageInfo *image_info,
   MagickBooleanType
     status;
 
-  register long
+  register ssize_t
     i;
 
   unsigned long
@@ -226,7 +228,7 @@ static Image *ReadCALSImage(const ImageInfo *image_info,
             if (pel_path == 90)
               orientation=5;
             else
-              if (pel_path == 90)
+              if (pel_path == 180)
                 orientation=3;
               else
                 if (pel_path == 270)
@@ -260,7 +262,7 @@ static Image *ReadCALSImage(const ImageInfo *image_info,
   image=DestroyImage(image);
   read_info=CloneImageInfo(image_info);
   SetImageInfoBlob(read_info,(void *) NULL,0);
-  (void) FormatMagickString(read_info->filename,MaxTextExtent,"group4:%.1024s",
+  (void) FormatMagickString(read_info->filename,MaxTextExtent,"group4:%s",
     filename);
   (void) FormatMagickString(message,MaxTextExtent,"%lux%lu",width,height);
   read_info->size=ConstantString(message);
@@ -301,10 +303,10 @@ static Image *ReadCALSImage(const ImageInfo *image_info,
 %
 %  The format of the RegisterCALSImage method is:
 %
-%      unsigned long RegisterCALSImage(void)
+%      size_t RegisterCALSImage(void)
 %
 */
-ModuleExport unsigned long RegisterCALSImage(void)
+ModuleExport size_t RegisterCALSImage(void)
 {
   MagickInfo
     *entry;
@@ -312,7 +314,7 @@ ModuleExport unsigned long RegisterCALSImage(void)
   static const char
     *CALSDescription=
     {
-      "Continuous Acquisition and Life-cycle Support Type 1 Image"
+      "Continuous Acquisition and Life-cycle Support Type 1"
     },
     *CALSNote=
     {
@@ -402,15 +404,15 @@ static ssize_t WriteCALSRecord(Image *image,const char *data)
   char
     pad[128];
 
-  ssize_t
-    count;
-
   register const char
     *p;
 
-  register long
+  register ssize_t
     i;
 
+  ssize_t
+    count;
+
   i=0;
   if (data != (const char *) NULL)
     {
@@ -442,23 +444,21 @@ static MagickBooleanType WriteCALSImage(const ImageInfo *image_info,
   MagickBooleanType
     status;
 
-  register long
+  register ssize_t
     i;
 
+  size_t
+    density,
+    length,
+    orient_x,
+    orient_y;
+
   ssize_t
     count;
 
-  size_t
-    length;
-
   unsigned char
     *group4;
 
-  unsigned long
-    density,
-    orient_x,
-    orient_y;
-
   /*
     Open output image file.
   */
@@ -475,6 +475,7 @@ static MagickBooleanType WriteCALSImage(const ImageInfo *image_info,
     Create standard CALS header.
   */
   count=WriteCALSRecord(image,"srcdocid: NONE");
+  (void) count;
   count=WriteCALSRecord(image,"dstdocid: NONE");
   count=WriteCALSRecord(image,"txtfilid: NONE");
   count=WriteCALSRecord(image,"figid: NONE");
@@ -530,10 +531,10 @@ static MagickBooleanType WriteCALSImage(const ImageInfo *image_info,
     }
   }
   (void) FormatMagickString(header,MaxTextExtent,"rorient: %03ld,%03ld",
-    orient_x,orient_y);
+    (long) orient_x,(long) orient_y);
   count=WriteCALSRecord(image,header);
   (void) FormatMagickString(header,MaxTextExtent,"rpelcnt: %06lu,%06lu",
-    image->columns,image->rows);
+    (unsigned long) image->columns,(unsigned long) image->rows);
   count=WriteCALSRecord(image,header);  
   density=200;
   if (image_info->density != (char *) NULL)
@@ -542,9 +543,10 @@ static MagickBooleanType WriteCALSImage(const ImageInfo *image_info,
         geometry_info;
 
       (void) ParseGeometry(image_info->density,&geometry_info);
-      density=(unsigned long) (geometry_info.rho+0.5);
+      density=(size_t) floor(geometry_info.rho+0.5);
     }
-  (void) FormatMagickString(header,MaxTextExtent,"rdensty: %04lu",density);
+  (void) FormatMagickString(header,MaxTextExtent,"rdensty: %04lu",
+    (unsigned long) density);
   count=WriteCALSRecord(image,header);
   count=WriteCALSRecord(image,"notes: NONE");
   (void) ResetMagickMemory(header,' ',128);