]> granicus.if.org Git - imagemagick/blobdiff - coders/cin.c
Added new coder to take a screen shot of a monitor in Windows.
[imagemagick] / coders / cin.c
index 1d1e9c3cf52d2f7da189aa8ee7f5f2aa682e9b3a..27ffc90d28a791d16c48a034c9dcb1fdb9940b1e 100644 (file)
 %                                                                             %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                             Kelly Bergougnoux                               %
 %                               October 2003                                  %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2014 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 declarations.
 */
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/colorspace.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/option.h"
-#include "magick/profile.h"
-#include "magick/property.h"
-#include "magick/quantum-private.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/string-private.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/artifact.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/colorspace.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/option.h"
+#include "MagickCore/profile.h"
+#include "MagickCore/property.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/string-private.h"
+#include "MagickCore/module.h"
 \f
 /*
   Typedef declaration.
@@ -227,7 +228,7 @@ typedef struct CINInfo
   Forward declaractions.
 */
 static MagickBooleanType
-  WriteCINImage(const ImageInfo *,Image *);
+  WriteCINImage(const ImageInfo *,Image *,ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -375,24 +376,17 @@ static inline MagickBooleanType IsFloatDefined(const float value)
   return(MagickTrue);
 }
 
-static Image *ReadCINImage(const ImageInfo *image_info,
-  ExceptionInfo *exception)
+static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
 #define MonoColorType  1
 #define RGBColorType  3
 
-  char
-    magick[4];
-
   CINInfo
     cin;
 
   Image
     *image;
 
-  ssize_t
-    y;
-
   MagickBooleanType
     status;
 
@@ -408,21 +402,20 @@ static Image *ReadCINImage(const ImageInfo *image_info,
   register ssize_t
     i;
 
-  register PixelPacket
+  register Quantum
     *q;
 
   size_t
     length;
 
   ssize_t
-    count;
+    count,
+    y;
 
   unsigned char
+    magick[4],
     *pixels;
 
-  size_t
-    lsb_first;
-
   /*
     Open image file.
   */
@@ -433,7 +426,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,
       image_info->filename);
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
-  image=AcquireImage(image_info);
+  image=AcquireImage(image_info,exception);
   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
   if (status == MagickFalse)
     {
@@ -444,15 +437,13 @@ static Image *ReadCINImage(const ImageInfo *image_info,
     File information.
   */
   offset=0;
-  count=ReadBlob(image,4,(unsigned char *) magick);
+  count=ReadBlob(image,4,magick);
   offset+=count;
   if ((count != 4) ||
       ((LocaleNCompare((char *) magick,"\200\052\137\327",4) != 0)))
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
-  image->endian=LSBEndian;
-  lsb_first=1;
-  if ((int) (*(char *) &lsb_first) != 0)
-    image->endian=MSBEndian;
+  image->endian=(magick[0] == 0x80) && (magick[1] == 0x2a) &&
+    (magick[2] == 0x5f) && (magick[3] == 0xd7) ? MSBEndian : LSBEndian;
   cin.file.image_offset=ReadBlobLong(image);
   offset+=4;
   cin.file.generic_length=ReadBlobLong(image);
@@ -465,16 +456,19 @@ static Image *ReadCINImage(const ImageInfo *image_info,
   offset+=4;
   offset+=ReadBlob(image,sizeof(cin.file.version),(unsigned char *)
     cin.file.version);
-  (void) SetImageProperty(image,"dpx:file.version",cin.file.version);
+  (void) SetImageProperty(image,"dpx:file.version",cin.file.version,exception);
   offset+=ReadBlob(image,sizeof(cin.file.filename),(unsigned char *)
     cin.file.filename);
-  (void) SetImageProperty(image,"dpx:file.filename",cin.file.filename);
+  (void) SetImageProperty(image,"dpx:file.filename",cin.file.filename,
+    exception);
   offset+=ReadBlob(image,sizeof(cin.file.create_date),(unsigned char *)
     cin.file.create_date);
-  (void) SetImageProperty(image,"dpx:file.create_date",cin.file.create_date);
+  (void) SetImageProperty(image,"dpx:file.create_date",cin.file.create_date,
+    exception);
   offset+=ReadBlob(image,sizeof(cin.file.create_time),(unsigned char *)
     cin.file.create_time);
-  (void) SetImageProperty(image,"dpx:file.create_time",cin.file.create_time);
+  (void) SetImageProperty(image,"dpx:file.create_time",cin.file.create_time,
+    exception);
   offset+=ReadBlob(image,sizeof(cin.file.reserve),(unsigned char *)
     cin.file.reserve);
   /*
@@ -482,20 +476,20 @@ static Image *ReadCINImage(const ImageInfo *image_info,
   */
   cin.image.orientation=(unsigned char) ReadBlobByte(image);
   offset++;
-  if (cin.image.orientation != (unsigned char) (~0U))
+  if (cin.image.orientation != (unsigned char) (~0))
     (void) FormatImageProperty(image,"dpx:image.orientation","%d",
       cin.image.orientation);
   switch (cin.image.orientation)
   {
     default:
-    case 0:  image->orientation=TopLeftOrientation; break;
-    case 1:  image->orientation=TopRightOrientation; break;
-    case 2:  image->orientation=BottomLeftOrientation; break;
-    case 3:  image->orientation=BottomRightOrientation; break;
-    case 4:  image->orientation=LeftTopOrientation; break;
-    case 5:  image->orientation=RightTopOrientation; break;
-    case 6:  image->orientation=LeftBottomOrientation; break;
-    case 7:  image->orientation=RightBottomOrientation; break;
+    case 0: image->orientation=TopLeftOrientation; break;
+    case 1: image->orientation=TopRightOrientation; break;
+    case 2: image->orientation=BottomLeftOrientation; break;
+    case 3: image->orientation=BottomRightOrientation; break;
+    case 4: image->orientation=LeftTopOrientation; break;
+    case 5: image->orientation=RightTopOrientation; break;
+    case 6: image->orientation=LeftBottomOrientation; break;
+    case 7: image->orientation=RightBottomOrientation; break;
   }
   cin.image.number_channels=(unsigned char) ReadBlobByte(image);
   offset++;
@@ -558,7 +552,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,
     image->chromaticity.blue_primary.y=cin.image.blue_primary_chromaticity[1];
   offset+=ReadBlob(image,sizeof(cin.image.label),(unsigned char *)
     cin.image.label);
-  (void) SetImageProperty(image,"dpx:image.label",cin.image.label);
+  (void) SetImageProperty(image,"dpx:image.label",cin.image.label,exception);
   offset+=ReadBlob(image,sizeof(cin.image.reserve),(unsigned char *)
     cin.image.reserve);
   /*
@@ -586,7 +580,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,
   if ((size_t) cin.origination.x_offset != ~0UL)
     (void) FormatImageProperty(image,"dpx:origination.x_offset","%.20g",
       (double) cin.origination.x_offset);
-  cin.origination.y_offset=(int) ReadBlobLong(image);
+  cin.origination.y_offset=(ssize_t) ReadBlobLong(image);
   offset+=4;
   if ((size_t) cin.origination.y_offset != ~0UL)
     (void) FormatImageProperty(image,"dpx:origination.y_offset","%.20g",
@@ -594,26 +588,27 @@ static Image *ReadCINImage(const ImageInfo *image_info,
   offset+=ReadBlob(image,sizeof(cin.origination.filename),(unsigned char *)
     cin.origination.filename);
   (void) SetImageProperty(image,"dpx:origination.filename",
-    cin.origination.filename);
+    cin.origination.filename,exception);
   offset+=ReadBlob(image,sizeof(cin.origination.create_date),(unsigned char *)
     cin.origination.create_date);
   (void) SetImageProperty(image,"dpx:origination.create_date",
-    cin.origination.create_date);
+    cin.origination.create_date,exception);
   offset+=ReadBlob(image,sizeof(cin.origination.create_time),(unsigned char *)
     cin.origination.create_time);
   (void) SetImageProperty(image,"dpx:origination.create_time",
-    cin.origination.create_time);
+    cin.origination.create_time,exception);
   offset+=ReadBlob(image,sizeof(cin.origination.device),(unsigned char *)
     cin.origination.device);
   (void) SetImageProperty(image,"dpx:origination.device",
-    cin.origination.device);
+    cin.origination.device,exception);
   offset+=ReadBlob(image,sizeof(cin.origination.model),(unsigned char *)
     cin.origination.model);
-  (void) SetImageProperty(image,"dpx:origination.model",cin.origination.model);
+  (void) SetImageProperty(image,"dpx:origination.model",cin.origination.model,
+    exception);
   offset+=ReadBlob(image,sizeof(cin.origination.serial),(unsigned char *)
     cin.origination.serial);
   (void) SetImageProperty(image,"dpx:origination.serial",
-    cin.origination.serial);
+    cin.origination.serial,exception);
   cin.origination.x_pitch=ReadBlobFloat(image);
   offset+=4;
   cin.origination.y_pitch=ReadBlobFloat(image);
@@ -626,20 +621,26 @@ static Image *ReadCINImage(const ImageInfo *image_info,
     cin.origination.reserve);
   if ((cin.file.image_offset > 2048) && (cin.file.user_length != 0))
     {
+      int
+        c;
+
       /*
         Image film information.
       */
       cin.film.id=ReadBlobByte(image);
       offset++;
-      if (((size_t) cin.film.id) != ~0UL)
+      c=cin.film.id;
+      if (c != ~0)
         (void) FormatImageProperty(image,"dpx:film.id","%d",cin.film.id);
       cin.film.type=ReadBlobByte(image);
       offset++;
-      if (((size_t) cin.film.type) != ~0UL)
+      c=cin.film.type;
+      if (c != ~0)
         (void) FormatImageProperty(image,"dpx:film.type","%d",cin.film.type);
       cin.film.offset=ReadBlobByte(image);
       offset++;
-      if (((size_t) cin.film.offset) != ~0UL)
+      c=cin.film.offset;
+      if (c != ~0)
         (void) FormatImageProperty(image,"dpx:film.offset","%d",
           cin.film.offset);
       cin.film.reserve1=ReadBlobByte(image);
@@ -653,7 +654,8 @@ static Image *ReadCINImage(const ImageInfo *image_info,
       offset+=4;
       offset+=ReadBlob(image,sizeof(cin.film.format),(unsigned char *)
         cin.film.format);
-      (void) SetImageProperty(image,"dpx:film.format",cin.film.format);
+      (void) SetImageProperty(image,"dpx:film.format",cin.film.format,
+        exception);
       cin.film.frame_position=ReadBlobLong(image);
       offset+=4;
       if (cin.film.frame_position != ~0UL)
@@ -666,10 +668,12 @@ static Image *ReadCINImage(const ImageInfo *image_info,
           cin.film.frame_rate);
       offset+=ReadBlob(image,sizeof(cin.film.frame_id),(unsigned char *)
         cin.film.frame_id);
-      (void) SetImageProperty(image,"dpx:film.frame_id",cin.film.frame_id);
+      (void) SetImageProperty(image,"dpx:film.frame_id",cin.film.frame_id,
+        exception);
       offset+=ReadBlob(image,sizeof(cin.film.slate_info),(unsigned char *)
         cin.film.slate_info);
-      (void) SetImageProperty(image,"dpx:film.slate_info",cin.film.slate_info);
+      (void) SetImageProperty(image,"dpx:film.slate_info",cin.film.slate_info,
+        exception);
       offset+=ReadBlob(image,sizeof(cin.film.reserve),(unsigned char *)
         cin.film.reserve);
     }
@@ -681,13 +685,15 @@ static Image *ReadCINImage(const ImageInfo *image_info,
       /*
         User defined data.
       */
-      profile=AcquireStringInfo(cin.file.user_length);
+      profile=BlobToStringInfo((const void *) NULL,cin.file.user_length);
+      if (profile == (StringInfo *) NULL)
+        ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
       offset+=ReadBlob(image,GetStringInfoLength(profile),
         GetStringInfoDatum(profile));
-      (void) SetImageProfile(image,"dpx:user.data",profile);
+      (void) SetImageProfile(image,"dpx:user.data",profile,exception);
       profile=DestroyStringInfo(profile);
     }
-  for ( ; offset < (ssize_t) cin.file.image_offset; offset++)
+  for ( ; offset < (MagickOffsetType) cin.file.image_offset; offset++)
     (void) ReadBlobByte(image);
   image->depth=cin.image.channel[0].bits_per_pixel;
   image->columns=cin.image.channel[0].pixels_per_line;
@@ -717,7 +723,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,
   for (y=0; y < (ssize_t) image->rows; y++)
   {
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
-    if (q == (PixelPacket *) NULL)
+    if (q == (Quantum *) NULL)
       break;
     count=ReadBlob(image,length,pixels);
     if ((size_t) count != length)
@@ -739,7 +745,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,
   if (EOFBlob(image) != MagickFalse)
     ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
       image->filename);
-  image->colorspace=LogColorspace;
+  SetImageColorspace(image,LogColorspace,exception);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
 }
@@ -775,6 +781,7 @@ ModuleExport size_t RegisterCINImage(void)
   entry->decoder=(DecodeImageHandler *) ReadCINImage;
   entry->encoder=(EncodeImageHandler *) WriteCINImage;
   entry->magick=(IsImageFormatHandler *) IsCIN;
+  entry->adjoin=MagickFalse;
   entry->description=ConstantString("Cineon Image File");
   entry->module=ConstantString("CIN");
   (void) RegisterMagickInfo(entry);
@@ -820,7 +827,8 @@ ModuleExport void UnregisterCINImage(void)
 %
 %  The format of the WriteCINImage method is:
 %
-%      MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
+%      MagickBooleanType WriteCINImage(const ImageInfo *image_info,
+%        Image *image,ExceptionInfo *exception)
 %
 %  A description of each parameter follows.
 %
@@ -828,10 +836,12 @@ ModuleExport void UnregisterCINImage(void)
 %
 %    o image:  The image.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
 
 static inline const char *GetCINProperty(const ImageInfo *image_info,
-  const Image *image,const char *property)
+  const Image *image,const char *property,ExceptionInfo *exception)
 {
   const char
     *value;
@@ -839,10 +849,11 @@ static inline const char *GetCINProperty(const ImageInfo *image_info,
   value=GetImageOption(image_info,property);
   if (value != (const char *) NULL)
     return(value);
-  return(GetImageProperty(image,property));
+  return(GetImageProperty(image,property,exception));
 }
 
-static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image,
+  ExceptionInfo *exception)
 {
   const char
     *value;
@@ -853,9 +864,6 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
   const StringInfo
     *profile;
 
-  ssize_t
-    y;
-
   MagickBooleanType
     status;
 
@@ -868,7 +876,7 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
   QuantumType
     quantum_type;
 
-  register const PixelPacket
+  register const Quantum
     *p;
 
   register ssize_t
@@ -878,7 +886,8 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
     length;
 
   ssize_t
-    count;
+    count,
+    y;
 
   struct tm
     local_time;
@@ -898,11 +907,13 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
   assert(image->signature == MagickSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+  assert(exception != (ExceptionInfo *) NULL);
+  assert(exception->signature == MagickSignature);
+  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
   if (status == MagickFalse)
     return(status);
   if (image->colorspace != LogColorspace)
-    (void) TransformImageColorspace(image,LogColorspace);
+    (void) TransformImageColorspace(image,LogColorspace,exception);
   /*
     Write image information.
   */
@@ -929,7 +940,7 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
   (void) CopyMagickString(cin.file.version,"V4.5",sizeof(cin.file.version));
   offset+=WriteBlob(image,sizeof(cin.file.version),(unsigned char *)
     cin.file.version);
-  value=GetCINProperty(image_info,image,"dpx:file.filename");
+  value=GetCINProperty(image_info,image,"dpx:file.filename",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.file.filename,value,sizeof(cin.file.filename));
   else
@@ -992,7 +1003,7 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
   offset+=WriteBlobFloat(image,image->chromaticity.green_primary.y);
   offset+=WriteBlobFloat(image,image->chromaticity.blue_primary.x);
   offset+=WriteBlobFloat(image,image->chromaticity.blue_primary.y);
-  value=GetCINProperty(image_info,image,"dpx:image.label");
+  value=GetCINProperty(image_info,image,"dpx:image.label",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.image.label,value,sizeof(cin.image.label));
   offset+=WriteBlob(image,sizeof(cin.image.label),(unsigned char *)
@@ -1020,16 +1031,16 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
     Write origination information.
   */
   cin.origination.x_offset=0UL;
-  value=GetCINProperty(image_info,image,"dpx:origination.x_offset");
+  value=GetCINProperty(image_info,image,"dpx:origination.x_offset",exception);
   if (value != (const char *) NULL)
-    cin.origination.x_offset=StringToLong(value);
+    cin.origination.x_offset=(ssize_t) StringToLong(value);
   offset+=WriteBlobLong(image,(unsigned int) cin.origination.x_offset);
   cin.origination.y_offset=0UL;
-  value=GetCINProperty(image_info,image,"dpx:origination.y_offset");
+  value=GetCINProperty(image_info,image,"dpx:origination.y_offset",exception);
   if (value != (const char *) NULL)
-    cin.origination.y_offset=StringToLong(value);
+    cin.origination.y_offset=(ssize_t) StringToLong(value);
   offset+=WriteBlobLong(image,(unsigned int) cin.origination.y_offset);
-  value=GetCINProperty(image_info,image,"dpx:origination.filename");
+  value=GetCINProperty(image_info,image,"dpx:origination.filename",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.origination.filename,value,
       sizeof(cin.origination.filename));
@@ -1047,33 +1058,33 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
     sizeof(cin.origination.create_time),"%H:%M:%S%Z",&local_time);
   offset+=WriteBlob(image,sizeof(cin.origination.create_time),(unsigned char *)
     cin.origination.create_time);
-  value=GetCINProperty(image_info,image,"dpx:origination.device");
+  value=GetCINProperty(image_info,image,"dpx:origination.device",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.origination.device,value,
       sizeof(cin.origination.device));
   offset+=WriteBlob(image,sizeof(cin.origination.device),(unsigned char *)
     cin.origination.device);
-  value=GetCINProperty(image_info,image,"dpx:origination.model");
+  value=GetCINProperty(image_info,image,"dpx:origination.model",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.origination.model,value,
       sizeof(cin.origination.model));
   offset+=WriteBlob(image,sizeof(cin.origination.model),(unsigned char *)
     cin.origination.model);
-  value=GetCINProperty(image_info,image,"dpx:origination.serial");
+  value=GetCINProperty(image_info,image,"dpx:origination.serial",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.origination.serial,value,
       sizeof(cin.origination.serial));
   offset+=WriteBlob(image,sizeof(cin.origination.serial),(unsigned char *)
     cin.origination.serial);
   cin.origination.x_pitch=0.0f;
-  value=GetCINProperty(image_info,image,"dpx:origination.x_pitch");
+  value=GetCINProperty(image_info,image,"dpx:origination.x_pitch",exception);
   if (value != (const char *) NULL)
-    cin.origination.x_pitch=StringToDouble(value);
+    cin.origination.x_pitch=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,cin.origination.x_pitch);
   cin.origination.y_pitch=0.0f;
-  value=GetCINProperty(image_info,image,"dpx:origination.y_pitch");
+  value=GetCINProperty(image_info,image,"dpx:origination.y_pitch",exception);
   if (value != (const char *) NULL)
-    cin.origination.y_pitch=StringToDouble(value);
+    cin.origination.y_pitch=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,cin.origination.y_pitch);
   cin.origination.gamma=image->gamma;
   offset+=WriteBlobFloat(image,cin.origination.gamma);
@@ -1083,52 +1094,52 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
     Image film information.
   */
   cin.film.id=0;
-  value=GetCINProperty(image_info,image,"dpx:film.id");
+  value=GetCINProperty(image_info,image,"dpx:film.id",exception);
   if (value != (const char *) NULL)
     cin.film.id=(char) StringToLong(value);
   offset+=WriteBlobByte(image,(unsigned char) cin.film.id);
   cin.film.type=0;
-  value=GetCINProperty(image_info,image,"dpx:film.type");
+  value=GetCINProperty(image_info,image,"dpx:film.type",exception);
   if (value != (const char *) NULL)
     cin.film.type=(char) StringToLong(value);
   offset+=WriteBlobByte(image,(unsigned char) cin.film.type);
   cin.film.offset=0;
-  value=GetCINProperty(image_info,image,"dpx:film.offset");
+  value=GetCINProperty(image_info,image,"dpx:film.offset",exception);
   if (value != (const char *) NULL)
     cin.film.offset=(char) StringToLong(value);
   offset+=WriteBlobByte(image,(unsigned char) cin.film.offset);
   offset+=WriteBlobByte(image,(unsigned char) cin.film.reserve1);
   cin.film.prefix=0UL;
-  value=GetCINProperty(image_info,image,"dpx:film.prefix");
+  value=GetCINProperty(image_info,image,"dpx:film.prefix",exception);
   if (value != (const char *) NULL)
     cin.film.prefix=StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,(unsigned int) cin.film.prefix);
   cin.film.count=0UL;
-  value=GetCINProperty(image_info,image,"dpx:film.count");
+  value=GetCINProperty(image_info,image,"dpx:film.count",exception);
   if (value != (const char *) NULL)
     cin.film.count=StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,(unsigned int) cin.film.count);
-  value=GetCINProperty(image_info,image,"dpx:film.format");
+  value=GetCINProperty(image_info,image,"dpx:film.format",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.film.format,value,sizeof(cin.film.format));
   offset+=WriteBlob(image,sizeof(cin.film.format),(unsigned char *)
     cin.film.format);
   cin.film.frame_position=0UL;
-  value=GetCINProperty(image_info,image,"dpx:film.frame_position");
+  value=GetCINProperty(image_info,image,"dpx:film.frame_position",exception);
   if (value != (const char *) NULL)
     cin.film.frame_position=StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,(unsigned int) cin.film.frame_position);
   cin.film.frame_rate=0.0f;
-  value=GetCINProperty(image_info,image,"dpx:film.frame_rate");
+  value=GetCINProperty(image_info,image,"dpx:film.frame_rate",exception);
   if (value != (const char *) NULL)
-    cin.film.frame_rate=StringToDouble(value);
+    cin.film.frame_rate=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,cin.film.frame_rate);
-  value=GetCINProperty(image_info,image,"dpx:film.frame_id");
+  value=GetCINProperty(image_info,image,"dpx:film.frame_id",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.film.frame_id,value,sizeof(cin.film.frame_id));
   offset+=WriteBlob(image,sizeof(cin.film.frame_id),(unsigned char *)
     cin.film.frame_id);
-  value=GetCINProperty(image_info,image,"dpx:film.slate_info");
+  value=GetCINProperty(image_info,image,"dpx:film.slate_info",exception);
   if (value != (const char *) NULL)
     (void) CopyMagickString(cin.film.slate_info,value,
       sizeof(cin.film.slate_info));
@@ -1152,18 +1163,20 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image)
   quantum_type=RGBQuantum;
   pixels=GetQuantumPixels(quantum_info);
   length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue);
+DisableMSCWarning(4127)
   if (0)
+RestoreMSCWarning
     {
       quantum_type=GrayQuantum;
-      length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue);
+      length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue);
     }
   for (y=0; y < (ssize_t) image->rows; y++)
   {
-    p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-    if (p == (const PixelPacket *) NULL)
+    p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+    if (p == (const Quantum *) NULL)
       break;
-    (void) ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
-      quantum_type,pixels,&image->exception);
+    (void) ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
+      quantum_type,pixels,exception);
     count=WriteBlob(image,length,pixels);
     if (count != (ssize_t) length)
       break;