]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Tue, 26 Apr 2016 14:21:41 +0000 (10:21 -0400)
committerCristy <urban-warrior@imagemagick.org>
Tue, 26 Apr 2016 14:21:41 +0000 (10:21 -0400)
MagickCore/blob-private.h
MagickCore/blob.c
coders/bmp.c
configure

index 25e45a240bf41d5a41c6f293f7782ef7c0bb760c..c9f2f343e5e1f42c83122a49ef090555a181169d 100644 (file)
@@ -115,6 +115,8 @@ extern MagickExport ssize_t
   WriteBlobShort(Image *,const unsigned short),
   WriteBlobLSBLong(Image *,const unsigned int),
   WriteBlobLSBShort(Image *,const unsigned short),
+  WriteBlobLSBSignedLong(Image *,const signed int),
+  WriteBlobLSBSignedShort(Image *,const signed short),
   WriteBlobMSBLong(Image *,const unsigned int),
   WriteBlobMSBLongLong(Image *,const MagickSizeType),
   WriteBlobMSBShort(Image *,const unsigned short),
index 4d6f08deb086577c99564f2450916b4771ec45e3..d84a9cf1e326cd2374ed4352a50293c1df241d76 100644 (file)
@@ -4813,6 +4813,103 @@ MagickExport ssize_t WriteBlobLSBShort(Image *image,const unsigned short value)
 %                                                                             %
 %                                                                             %
 %                                                                             %
++  W r i t e B l o b L S B S i g n e d L o n g                                %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  WriteBlobLSBSignedLong() writes a signed value as a 32-bit quantity in
+%  least-significant byte first order.
+%
+%  The format of the WriteBlobLSBSignedLong method is:
+%
+%      ssize_t WriteBlobLSBSignedLong(Image *image,const signed int value)
+%
+%  A description of each parameter follows.
+%
+%    o image: the image.
+%
+%    o value: Specifies the value to write.
+%
+*/
+MagickExport ssize_t WriteBlobLSBSignedLong(Image *image,const signed int value)
+{
+  union
+  {
+    unsigned int
+      unsigned_value;
+
+    signed int
+      signed_value;
+  } quantum;
+
+  unsigned char
+    buffer[4];
+
+  assert(image != (Image *) NULL);
+  assert(image->signature == MagickCoreSignature);
+  quantum.signed_value=value;
+  buffer[0]=(unsigned char) quantum.unsigned_value;
+  buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);
+  buffer[2]=(unsigned char) (quantum.unsigned_value >> 16);
+  buffer[3]=(unsigned char) (quantum.unsigned_value >> 24);
+  return(WriteBlobStream(image,4,buffer));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
++   W r i t e B l o b L S B S i g n e d S h o r t                             %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  WriteBlobLSBSignedShort() writes a signed short value as a 16-bit quantity
+%  in least-significant byte first order.
+%
+%  The format of the WriteBlobLSBSignedShort method is:
+%
+%      ssize_t WriteBlobLSBSignedShort(Image *image,const signed short value)
+%
+%  A description of each parameter follows.
+%
+%    o image: the image.
+%
+%    o value:  Specifies the value to write.
+%
+*/
+MagickExport ssize_t WriteBlobLSBSignedShort(Image *image,
+  const signed short value)
+{
+  union
+  {
+    unsigned short
+      unsigned_value;
+
+    signed short
+      signed_value;
+  } quantum;
+
+  unsigned char
+    buffer[2];
+
+  assert(image != (Image *) NULL);
+  assert(image->signature == MagickCoreSignature);
+  quantum.signed_value=value;
+  buffer[0]=(unsigned char) quantum.unsigned_value;
+  buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);
+  return(WriteBlobStream(image,2,buffer));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 +  W r i t e B l o b M S B L o n g                                            %
 %                                                                             %
 %                                                                             %
index a34b088dce7fe46f39c0524917b61b77091138f4..b42b9ff0535fe77b12a3a1366619639de4b79689 100644 (file)
@@ -2000,8 +2000,8 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
           Write 12-byte version 2 bitmap header.
         */
         (void) WriteBlobLSBLong(image,bmp_info.size);
-        (void) WriteBlobLSBShort(image,(unsigned short) bmp_info.width);
-        (void) WriteBlobLSBShort(image,(unsigned short) bmp_info.height);
+        (void) WriteBlobLSBSignedShort(image,bmp_info.width);
+        (void) WriteBlobLSBSignedShort(image,bmp_info.height);
         (void) WriteBlobLSBShort(image,bmp_info.planes);
         (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);
       }
@@ -2011,8 +2011,8 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
           Write 40-byte version 3+ bitmap header.
         */
         (void) WriteBlobLSBLong(image,bmp_info.size);
-        (void) WriteBlobLSBLong(image,(unsigned int) bmp_info.width);
-        (void) WriteBlobLSBLong(image,(unsigned int) bmp_info.height);
+        (void) WriteBlobLSBSignedLong(image,bmp_info.width);
+        (void) WriteBlobLSBSignedLong(image,bmp_info.height);
         (void) WriteBlobLSBShort(image,bmp_info.planes);
         (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);
         (void) WriteBlobLSBLong(image,bmp_info.compression);
index 5ca507b828a70ff6b4681e114543da8c509ab3be..ca5415556b025486d5d0a8a54d10658e39194101 100755 (executable)
--- a/configure
+++ b/configure
@@ -24506,7 +24506,7 @@ fi
 
 
 # Check additional headers
-for ac_header in arm/limits.h arpa/inet.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h netinet/in.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/sendfile.h sys/socket.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h wchar.h xlocale.h
+for ac_header in arm/limits.h arpa/inet.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h netinet/in.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/sendfile.h sys/socket.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h utime.h wchar.h xlocale.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"