~ubuntu-branches/ubuntu/oneiric/imagemagick/oneiric-updates

« back to all changes in this revision

Viewing changes to coders/miff.c

  • Committer: Bazaar Package Importer
  • Author(s): Nelson A. de Oliveira
  • Date: 2010-06-20 19:59:55 UTC
  • mfrom: (6.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100620195955-n3eq0yenhycw888i
Tags: 7:6.6.2.6-1
* New upstream release;
* Change Recommends on ufraw to ufraw-batch (Closes: #579775);
* Fix FTBFS when using dash to run the configure script, by setting
  CONFIG_SHELL=/bin/bash (Closes: #582073, #583024). Thank you, Niko Tyni!

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
%                                 July 1992                                   %
18
18
%                                                                             %
19
19
%                                                                             %
20
 
%  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
 
20
%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
21
21
%  dedicated to making software imaging solutions freely available.           %
22
22
%                                                                             %
23
23
%  You may not use this file except in compliance with the License.  You may  %
45
45
#include "magick/blob-private.h"
46
46
#include "magick/cache.h"
47
47
#include "magick/color.h"
 
48
#include "magick/color-private.h"
 
49
#include "magick/colormap.h"
48
50
#include "magick/colormap-private.h"
49
 
#include "magick/color-private.h"
50
51
#include "magick/colorspace.h"
51
52
#include "magick/constitute.h"
52
53
#include "magick/exception.h"
58
59
#include "magick/list.h"
59
60
#include "magick/magick.h"
60
61
#include "magick/memory_.h"
 
62
#include "magick/module.h"
61
63
#include "magick/monitor.h"
62
64
#include "magick/monitor-private.h"
63
65
#include "magick/option.h"
68
70
#include "magick/static.h"
69
71
#include "magick/statistic.h"
70
72
#include "magick/string_.h"
71
 
#include "magick/module.h"
 
73
#include "magick/string-private.h"
72
74
#if defined(MAGICKCORE_ZLIB_DELEGATE)
73
75
#include "zlib.h"
74
76
#endif
212
214
          (void) ThrowMagickException(&image->exception,GetMagickModule(),
213
215
            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
214
216
      }
215
 
      *pixel=image->colormap[(long) *index];
 
217
      *pixel=image->colormap[(ssize_t) *index];
216
218
      switch (image->depth)
217
219
      {
218
220
        case 8:
242
244
        }
243
245
        case 32:
244
246
        {
245
 
          unsigned long
 
247
          unsigned int
246
248
            quantum;
247
249
 
248
250
          if (image->matte != MagickFalse)
314
316
    }
315
317
    case 32:
316
318
    {
317
 
      unsigned long
 
319
      unsigned int
318
320
        quantum;
319
321
 
320
322
      p=PushLongPixel(MSBEndian,p,&quantum);
400
402
  LinkedListInfo
401
403
    *profiles;
402
404
 
403
 
  long
 
405
  ssize_t
404
406
    y;
405
407
 
406
408
  MagickBooleanType
421
423
  QuantumType
422
424
    quantum_type;
423
425
 
424
 
  register long
 
426
  register ssize_t
425
427
    i;
426
428
 
427
429
  size_t
435
437
    *compress_pixels,
436
438
    *pixels;
437
439
 
438
 
  unsigned long
 
440
  size_t
439
441
    colors;
440
442
 
441
443
#if defined(MAGICKCORE_ZLIB_DELEGATE)
611
613
              {
612
614
                if (LocaleCompare(keyword,"class") == 0)
613
615
                  {
614
 
                    long
 
616
                    ssize_t
615
617
                      storage_class;
616
618
 
617
619
                    storage_class=ParseMagickOption(MagickClassOptions,
623
625
                  }
624
626
                if (LocaleCompare(keyword,"colors") == 0)
625
627
                  {
626
 
                    colors=(unsigned long) atol(options);
 
628
                    colors=StringToUnsignedLong(options);
627
629
                    break;
628
630
                  }
629
631
                if (LocaleCompare(keyword,"colorspace") == 0)
630
632
                  {
631
 
                    long
 
633
                    ssize_t
632
634
                      colorspace;
633
635
 
634
636
                    colorspace=ParseMagickOption(MagickColorspaceOptions,
640
642
                  }
641
643
                if (LocaleCompare(keyword,"compression") == 0)
642
644
                  {
643
 
                    long
 
645
                    ssize_t
644
646
                      compression;
645
647
 
646
648
                    compression=ParseMagickOption(MagickCompressOptions,
652
654
                  }
653
655
                if (LocaleCompare(keyword,"columns") == 0)
654
656
                  {
655
 
                    image->columns=(unsigned long) atol(options);
 
657
                    image->columns=StringToUnsignedLong(options);
656
658
                    break;
657
659
                  }
658
660
                (void) SetImageProperty(image,keyword,options);
663
665
              {
664
666
                if (LocaleCompare(keyword,"delay") == 0)
665
667
                  {
666
 
                    image->delay=(unsigned long) atol(options);
 
668
                    image->delay=StringToUnsignedLong(options);
667
669
                    break;
668
670
                  }
669
671
                if (LocaleCompare(keyword,"depth") == 0)
670
672
                  {
671
 
                    image->depth=(unsigned long) atol(options);
 
673
                    image->depth=StringToUnsignedLong(options);
672
674
                    break;
673
675
                  }
674
676
                if (LocaleCompare(keyword,"dispose") == 0)
675
677
                  {
676
 
                    long
 
678
                    ssize_t
677
679
                      dispose;
678
680
 
679
681
                    dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,
691
693
              {
692
694
                if (LocaleCompare(keyword,"endian") == 0)
693
695
                  {
694
 
                    long
 
696
                    ssize_t
695
697
                      endian;
696
698
 
697
699
                    endian=ParseMagickOption(MagickEndianOptions,MagickFalse,
709
711
              {
710
712
                if (LocaleCompare(keyword,"gamma") == 0)
711
713
                  {
712
 
                    image->gamma=atof(options);
 
714
                    image->gamma=StringToDouble(options);
713
715
                    break;
714
716
                  }
715
717
                if (LocaleCompare(keyword,"gravity") == 0)
716
718
                  {
717
 
                    long
 
719
                    ssize_t
718
720
                      gravity;
719
721
 
720
722
                    gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,
747
749
                  }
748
750
                if (LocaleCompare(keyword,"iterations") == 0)
749
751
                  {
750
 
                    image->iterations=(unsigned long) atol(options);
 
752
                    image->iterations=StringToUnsignedLong(options);
751
753
                    break;
752
754
                  }
753
755
                (void) SetImageProperty(image,keyword,options);
758
760
              {
759
761
                if (LocaleCompare(keyword,"matte") == 0)
760
762
                  {
761
 
                    long
 
763
                    ssize_t
762
764
                      matte;
763
765
 
764
766
                    matte=ParseMagickOption(MagickBooleanOptions,MagickFalse,
787
789
              {
788
790
                if (LocaleCompare(keyword,"opaque") == 0)
789
791
                  {
790
 
                    long
 
792
                    ssize_t
791
793
                      matte;
792
794
 
793
795
                    matte=ParseMagickOption(MagickBooleanOptions,MagickFalse,
799
801
                  }
800
802
                if (LocaleCompare(keyword,"orientation") == 0)
801
803
                  {
802
 
                    long
 
804
                    ssize_t
803
805
                      orientation;
804
806
 
805
807
                    orientation=ParseMagickOption(MagickOrientationOptions,
835
837
                      profiles=NewLinkedList(0);
836
838
                    (void) AppendValueToLinkedList(profiles,
837
839
                      AcquireString(keyword+8));
838
 
                    profile=AcquireStringInfo((size_t) atol(options));
 
840
                    profile=AcquireStringInfo((size_t) StringToLong(options));
839
841
                    (void) SetImageProfile(image,keyword+8,profile);
840
842
                    profile=DestroyStringInfo(profile);
841
843
                    break;
848
850
              {
849
851
                if (LocaleCompare(keyword,"quality") == 0)
850
852
                  {
851
 
                    image->quality=(unsigned long) atol(options);
 
853
                    image->quality=StringToUnsignedLong(options);
852
854
                    break;
853
855
                  }
854
856
                if ((LocaleCompare(keyword,"quantum-format") == 0) ||
855
857
                    (LocaleCompare(keyword,"quantum:format") == 0))
856
858
                  {
857
 
                    long
 
859
                    ssize_t
858
860
                      format;
859
861
 
860
862
                    format=ParseMagickOption(MagickQuantumFormatOptions,
882
884
                  }
883
885
                if (LocaleCompare(keyword,"rendering-intent") == 0)
884
886
                  {
885
 
                    long
 
887
                    ssize_t
886
888
                      rendering_intent;
887
889
 
888
890
                    rendering_intent=ParseMagickOption(MagickIntentOptions,
903
905
                  }
904
906
                if (LocaleCompare(keyword,"rows") == 0)
905
907
                  {
906
 
                    image->rows=(unsigned long) atol(options);
 
908
                    image->rows=StringToUnsignedLong(options);
907
909
                    break;
908
910
                  }
909
911
                (void) SetImageProperty(image,keyword,options);
914
916
              {
915
917
                if (LocaleCompare(keyword,"scene") == 0)
916
918
                  {
917
 
                    image->scene=(unsigned long) atol(options);
 
919
                    image->scene=StringToUnsignedLong(options);
918
920
                    break;
919
921
                  }
920
922
                (void) SetImageProperty(image,keyword,options);
925
927
              {
926
928
                if (LocaleCompare(keyword,"ticks-per-second") == 0)
927
929
                  {
928
 
                    image->ticks_per_second=atol(options);
 
930
                    image->ticks_per_second=StringToLong(options);
929
931
                    break;
930
932
                  }
931
933
                if (LocaleCompare(keyword,"tile-offset") == 0)
940
942
                  }
941
943
                if (LocaleCompare(keyword,"type") == 0)
942
944
                  {
943
 
                    long
 
945
                    ssize_t
944
946
                      type;
945
947
 
946
948
                    type=ParseMagickOption(MagickTypeOptions,MagickFalse,
958
960
              {
959
961
                if (LocaleCompare(keyword,"units") == 0)
960
962
                  {
961
 
                    long
 
963
                    ssize_t
962
964
                      units;
963
965
 
964
966
                    units=ParseMagickOption(MagickResolutionOptions,MagickFalse,
976
978
              {
977
979
                if (LocaleCompare(keyword,"version") == 0)
978
980
                  {
979
 
                    version=atof(options);
 
981
                    version=StringToDouble(options);
980
982
                    break;
981
983
                  }
982
984
                (void) SetImageProperty(image,keyword,options);
1114
1116
                unsigned char
1115
1117
                  pixel;
1116
1118
 
1117
 
                for (i=0; i < (long) image->colors; i++)
 
1119
                for (i=0; i < (ssize_t) image->colors; i++)
1118
1120
                {
1119
1121
                  p=PushCharPixel(p,&pixel);
1120
1122
                  image->colormap[i].red=ScaleCharToQuantum(pixel);
1130
1132
                unsigned short
1131
1133
                  pixel;
1132
1134
 
1133
 
                for (i=0; i < (long) image->colors; i++)
 
1135
                for (i=0; i < (ssize_t) image->colors; i++)
1134
1136
                {
1135
1137
                  p=PushShortPixel(MSBEndian,p,&pixel);
1136
1138
                  image->colormap[i].red=ScaleShortToQuantum(pixel);
1143
1145
              }
1144
1146
              case 32:
1145
1147
              {
1146
 
                unsigned long
 
1148
                unsigned int
1147
1149
                  pixel;
1148
1150
 
1149
 
                for (i=0; i < (long) image->colors; i++)
 
1151
                for (i=0; i < (ssize_t) image->colors; i++)
1150
1152
                {
1151
1153
                  p=PushLongPixel(MSBEndian,p,&pixel);
1152
1154
                  image->colormap[i].red=ScaleLongToQuantum(pixel);
1219
1221
    pixels=GetQuantumPixels(quantum_info);
1220
1222
    index=(IndexPacket) 0;
1221
1223
    length=0;
1222
 
    for (y=0; y < (long) image->rows; y++)
 
1224
    for (y=0; y < (ssize_t) image->rows; y++)
1223
1225
    {
1224
1226
      register IndexPacket
1225
 
        *__restrict indexes;
 
1227
        *restrict indexes;
1226
1228
 
1227
 
      register long
 
1229
      register ssize_t
1228
1230
        x;
1229
1231
 
1230
1232
      register PixelPacket
1231
 
        *__restrict q;
 
1233
        *restrict q;
1232
1234
 
1233
1235
      q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
1234
1236
      if (q == (PixelPacket *) NULL)
1266
1268
            if (inflate(&zip_info,Z_SYNC_FLUSH) == Z_STREAM_END)
1267
1269
              break;
1268
1270
          } while (zip_info.avail_out != 0);
1269
 
          if (y == (long) (image->rows-1))
 
1271
          if (y == (ssize_t) (image->rows-1))
1270
1272
            {
1271
1273
              if (version == 0)
1272
1274
                {
1318
1320
            if (BZ2_bzDecompress(&bzip_info) == BZ_STREAM_END)
1319
1321
              break;
1320
1322
          } while (bzip_info.avail_out != 0);
1321
 
          if (y == (long) (image->rows-1))
 
1323
          if (y == (ssize_t) (image->rows-1))
1322
1324
            {
1323
1325
              if (version == 0)
1324
1326
                {
1348
1350
              pixel.opacity=(Quantum) TransparentOpacity;
1349
1351
              index=(IndexPacket) 0;
1350
1352
            }
1351
 
          for (x=0; x < (long) image->columns; x++)
 
1353
          for (x=0; x < (ssize_t) image->columns; x++)
1352
1354
          {
1353
1355
            if (length == 0)
1354
1356
              {
1377
1379
    SetQuantumImageType(image,quantum_type);
1378
1380
    quantum_info=DestroyQuantumInfo(quantum_info);
1379
1381
    compress_pixels=(unsigned char *) RelinquishMagickMemory(compress_pixels);
1380
 
    if (((y != (long) image->rows)) || (status == MagickFalse))
 
1382
    if (((y != (ssize_t) image->rows)) || (status == MagickFalse))
1381
1383
      {
1382
1384
        image=DestroyImageList(image);
1383
1385
        return((Image *) NULL);
1439
1441
%
1440
1442
%  The format of the RegisterMIFFImage method is:
1441
1443
%
1442
 
%      unsigned long RegisterMIFFImage(void)
 
1444
%      size_t RegisterMIFFImage(void)
1443
1445
%
1444
1446
*/
1445
 
ModuleExport unsigned long RegisterMIFFImage(void)
 
1447
ModuleExport size_t RegisterMIFFImage(void)
1446
1448
{
1447
1449
  char
1448
1450
    version[MaxTextExtent];
1534
1536
      {
1535
1537
        case 32:
1536
1538
        {
1537
 
          *pixels++=(unsigned char) ((unsigned long) index >> 24);
1538
 
          *pixels++=(unsigned char) ((unsigned long) index >> 16);
 
1539
          *pixels++=(unsigned char) ((size_t) index >> 24);
 
1540
          *pixels++=(unsigned char) ((size_t) index >> 16);
1539
1541
        }
1540
1542
        case 16:
1541
 
          *pixels++=(unsigned char) ((unsigned long) index >> 8);
 
1543
          *pixels++=(unsigned char) ((size_t) index >> 8);
1542
1544
        case 8:
1543
1545
        {
1544
1546
          *pixels++=(unsigned char) index;
1552
1554
      {
1553
1555
        case 32:
1554
1556
        {
1555
 
          unsigned long
 
1557
          unsigned int
1556
1558
            value;
1557
1559
 
1558
1560
          if (image->matte != MagickFalse)
1597
1599
  {
1598
1600
    case 32:
1599
1601
    {
1600
 
      unsigned long
 
1602
      unsigned int
1601
1603
        value;
1602
1604
 
1603
1605
      value=ScaleQuantumToLong(pixel.red);
1696
1698
  int
1697
1699
    code;
1698
1700
 
1699
 
  long
 
1701
  ssize_t
1700
1702
    y;
1701
1703
 
1702
1704
  MagickBooleanType
1714
1716
  QuantumType
1715
1717
    quantum_type;
1716
1718
 
1717
 
  register long
 
1719
  register ssize_t
1718
1720
    i;
1719
1721
 
1720
1722
  size_t
1764
1766
          ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1765
1767
      }
1766
1768
    if ((image->storage_class == PseudoClass) &&
1767
 
        (image->colors > (unsigned long) (GetQuantumRange(image->depth)+1)))
 
1769
        (image->colors > (size_t) (GetQuantumRange(image->depth)+1)))
1768
1770
      (void) SetImageStorageClass(image,DirectClass);
1769
1771
    if (IsGrayImage(image,&image->exception) != MagickFalse)
1770
1772
      {
1816
1818
    */
1817
1819
    (void) WriteBlobString(image,"id=ImageMagick  version=1.0\n");
1818
1820
    (void) FormatMagickString(buffer,MaxTextExtent,
1819
 
      "class=%s  colors=%lu  matte=%s\n",MagickOptionToMnemonic(
1820
 
      MagickClassOptions,image->storage_class),image->colors,
1821
 
      MagickOptionToMnemonic(MagickBooleanOptions,(long) image->matte));
 
1821
      "class=%s  colors=%.20g  matte=%s\n",MagickOptionToMnemonic(
 
1822
      MagickClassOptions,image->storage_class),(double) image->colors,
 
1823
      MagickOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte));
1822
1824
    (void) WriteBlobString(image,buffer);
1823
 
    (void) FormatMagickString(buffer,MaxTextExtent,"columns=%lu  rows=%lu  "
1824
 
      "depth=%lu\n",image->columns,image->rows,image->depth);
 
1825
    (void) FormatMagickString(buffer,MaxTextExtent,"columns=%.20g  rows=%.20g  "
 
1826
      "depth=%.20g\n",(double) image->columns,(double) image->rows,(double)
 
1827
      image->depth);
1825
1828
    (void) WriteBlobString(image,buffer);
1826
1829
    if (image->type != UndefinedType)
1827
1830
      {
1838
1841
    if (compression != UndefinedCompression)
1839
1842
      {
1840
1843
        (void) FormatMagickString(buffer,MaxTextExtent,"compression=%s  "
1841
 
          "quality=%lu\n",MagickOptionToMnemonic(MagickCompressOptions,
1842
 
          compression),image->quality);
 
1844
          "quality=%.20g\n",MagickOptionToMnemonic(MagickCompressOptions,
 
1845
          compression),(double) image->quality);
1843
1846
        (void) WriteBlobString(image,buffer);
1844
1847
      }
1845
1848
    if (image->units != UndefinedResolution)
1850
1853
      }
1851
1854
    if ((image->x_resolution != 0) || (image->y_resolution != 0))
1852
1855
      {
1853
 
        (void) FormatMagickString(buffer,MaxTextExtent,"resolution=%gx%g\n",
1854
 
          image->x_resolution,image->y_resolution);
 
1856
        (void) FormatMagickString(buffer,MaxTextExtent,
 
1857
          "resolution=%gx%g\n",image->x_resolution,image->y_resolution);
1855
1858
        (void) WriteBlobString(image,buffer);
1856
1859
      }
1857
1860
    if ((image->page.width != 0) || (image->page.height != 0))
1858
1861
      {
1859
 
        (void) FormatMagickString(buffer,MaxTextExtent,"page=%lux%lu%+ld%+ld\n",
1860
 
          image->page.width,image->page.height,image->page.x,image->page.y);
 
1862
        (void) FormatMagickString(buffer,MaxTextExtent,
 
1863
          "page=%.20gx%.20g%+.20g%+.20g\n",(double) image->page.width,(double)
 
1864
          image->page.height,(double) image->page.x,(double) image->page.y);
1861
1865
        (void) WriteBlobString(image,buffer);
1862
1866
      }
1863
1867
    else
1864
1868
      if ((image->page.x != 0) || (image->page.y != 0))
1865
1869
        {
1866
1870
          (void) FormatMagickString(buffer,MaxTextExtent,"page=%+ld%+ld\n",
1867
 
            image->page.x,image->page.y);
 
1871
            (long) image->page.x,(long) image->page.y);
1868
1872
          (void) WriteBlobString(image,buffer);
1869
1873
        }
1870
1874
    if ((image->tile_offset.x != 0) || (image->tile_offset.y != 0))
1871
1875
      {
1872
1876
        (void) FormatMagickString(buffer,MaxTextExtent,"tile-offset=%+ld%+ld\n",
1873
 
          image->tile_offset.x,image->tile_offset.y);
 
1877
          (long) image->tile_offset.x,(long) image->tile_offset.y);
1874
1878
        (void) WriteBlobString(image,buffer);
1875
1879
      }
1876
1880
    if ((GetNextImageInList(image) != (Image *) NULL) ||
1877
1881
        (GetPreviousImageInList(image) != (Image *) NULL))
1878
1882
      {
1879
1883
        if (image->scene == 0)
1880
 
          (void) FormatMagickString(buffer,MaxTextExtent,"iterations=%lu  "
1881
 
            "delay=%lu  ticks-per-second=%lu\n",image->iterations,image->delay,
1882
 
             image->ticks_per_second);
 
1884
          (void) FormatMagickString(buffer,MaxTextExtent,"iterations=%.20g  "
 
1885
            "delay=%.20g  ticks-per-second=%.20g\n",(double) image->iterations,
 
1886
            (double) image->delay,(double) image->ticks_per_second);
1883
1887
        else
1884
 
          (void) FormatMagickString(buffer,MaxTextExtent,"scene=%lu  "
1885
 
            "iterations=%lu  delay=%lu  ticks-per-second=%lu\n",image->scene,
1886
 
            image->iterations,image->delay,image->ticks_per_second);
 
1888
          (void) FormatMagickString(buffer,MaxTextExtent,"scene=%.20g  "
 
1889
            "iterations=%.20g  delay=%.20g  ticks-per-second=%.20g\n",(double)
 
1890
            image->scene,(double) image->iterations,(double) image->delay,
 
1891
            (double) image->ticks_per_second);
1887
1892
        (void) WriteBlobString(image,buffer);
1888
1893
      }
1889
1894
    else
1890
1895
      {
1891
1896
        if (image->scene != 0)
1892
1897
          {
1893
 
            (void) FormatMagickString(buffer,MaxTextExtent,"scene=%lu\n",
1894
 
              image->scene);
 
1898
            (void) FormatMagickString(buffer,MaxTextExtent,"scene=%.20g\n",
 
1899
              (double) image->scene);
1895
1900
            (void) WriteBlobString(image,buffer);
1896
1901
          }
1897
1902
        if (image->iterations != 0)
1898
1903
          {
1899
 
            (void) FormatMagickString(buffer,MaxTextExtent,"iterations=%lu\n",
1900
 
              image->iterations);
 
1904
            (void) FormatMagickString(buffer,MaxTextExtent,"iterations=%.20g\n",
 
1905
              (double) image->iterations);
1901
1906
            (void) WriteBlobString(image,buffer);
1902
1907
          }
1903
1908
        if (image->delay != 0)
1904
1909
          {
1905
 
            (void) FormatMagickString(buffer,MaxTextExtent,"delay=%lu\n",
1906
 
              image->delay);
 
1910
            (void) FormatMagickString(buffer,MaxTextExtent,"delay=%.20g\n",
 
1911
              (double) image->delay);
1907
1912
            (void) WriteBlobString(image,buffer);
1908
1913
          }
1909
1914
        if (image->ticks_per_second != UndefinedTicksPerSecond)
1910
1915
          {
1911
1916
            (void) FormatMagickString(buffer,MaxTextExtent,
1912
 
              "ticks-per-second=%lu\n",image->ticks_per_second);
 
1917
              "ticks-per-second=%.20g\n",(double) image->ticks_per_second);
1913
1918
            (void) WriteBlobString(image,buffer);
1914
1919
          }
1915
1920
      }
1943
1948
        /*
1944
1949
          Note chomaticity points.
1945
1950
        */
1946
 
        (void) FormatMagickString(buffer,MaxTextExtent,"red-primary=%g,%g  "
1947
 
          "green-primary=%g,%g  blue-primary=%g,%g\n",
 
1951
        (void) FormatMagickString(buffer,MaxTextExtent,"red-primary=%g,"
 
1952
          "%g  green-primary=%g,%g  blue-primary=%g,%g\n",
1948
1953
          image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,
1949
1954
          image->chromaticity.green_primary.x,
1950
1955
          image->chromaticity.green_primary.y,
1951
1956
          image->chromaticity.blue_primary.x,
1952
1957
          image->chromaticity.blue_primary.y);
1953
1958
        (void) WriteBlobString(image,buffer);
1954
 
        (void) FormatMagickString(buffer,MaxTextExtent,"white-point=%g,%g\n",
1955
 
          image->chromaticity.white_point.x,image->chromaticity.white_point.y);
 
1959
        (void) FormatMagickString(buffer,MaxTextExtent,
 
1960
          "white-point=%g,%g\n",image->chromaticity.white_point.x,
 
1961
          image->chromaticity.white_point.y);
1956
1962
        (void) WriteBlobString(image,buffer);
1957
1963
      }
1958
1964
    if (image->orientation != UndefinedOrientation)
1979
1985
          profile=GetImageProfile(image,name);
1980
1986
          if (profile != (StringInfo *) NULL)
1981
1987
            {
1982
 
              (void) FormatMagickString(buffer,MaxTextExtent,"profile:%s=%lu\n",
1983
 
                name,(unsigned long) GetStringInfoLength(profile));
 
1988
              (void) FormatMagickString(buffer,MaxTextExtent,
 
1989
                "profile:%s=%.20g\n",name,(double)
 
1990
                GetStringInfoLength(profile));
1984
1991
              (void) WriteBlobString(image,buffer);
1985
1992
            }
1986
1993
          name=GetNextImageProfile(image);
2003
2010
      value=GetImageProperty(image,property);
2004
2011
      if (value != (const char *) NULL)
2005
2012
        {
2006
 
          for (i=0; i < (long) strlen(value); i++)
 
2013
          for (i=0; i < (ssize_t) strlen(value); i++)
2007
2014
            if (isspace((int) ((unsigned char) value[i])) != 0)
2008
2015
              break;
2009
 
          if (i <= (long) strlen(value))
 
2016
          if (i <= (ssize_t) strlen(value))
2010
2017
            (void) WriteBlobByte(image,'{');
2011
2018
          (void) WriteBlob(image,strlen(value),(const unsigned char *) value);
2012
 
          if (i <= (long) strlen(value))
 
2019
          if (i <= (ssize_t) strlen(value))
2013
2020
            (void) WriteBlobByte(image,'}');
2014
2021
        }
2015
2022
      (void) WriteBlobByte(image,'\n');
2068
2075
          Write colormap to file.
2069
2076
        */
2070
2077
        q=colormap;
2071
 
        for (i=0; i < (long) image->colors; i++)
 
2078
        for (i=0; i < (ssize_t) image->colors; i++)
2072
2079
        {
2073
2080
          switch (quantum_info->depth)
2074
2081
          {
2076
2083
              ThrowWriterException(CorruptImageError,"ImageDepthNotSupported");
2077
2084
            case 32:
2078
2085
            {
2079
 
              register unsigned long
 
2086
              register unsigned int
2080
2087
                pixel;
2081
2088
 
2082
2089
              pixel=ScaleQuantumToLong(image->colormap[i].red);
2125
2132
    quantum_type=GetQuantumType(image,&image->exception);
2126
2133
    pixels=GetQuantumPixels(quantum_info);
2127
2134
    status=MagickTrue;
2128
 
    for (y=0; y < (long) image->rows; y++)
 
2135
    for (y=0; y < (ssize_t) image->rows; y++)
2129
2136
    {
2130
2137
      register const IndexPacket
2131
 
        *__restrict indexes;
 
2138
        *restrict indexes;
2132
2139
 
2133
2140
      register const PixelPacket
2134
 
        *__restrict p;
 
2141
        *restrict p;
2135
2142
 
2136
 
      register long
 
2143
      register ssize_t
2137
2144
        x;
2138
2145
 
2139
2146
      p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
2176
2183
                (void) WriteBlob(image,length,compress_pixels);
2177
2184
              }
2178
2185
          } while (zip_info.avail_in != 0);
2179
 
          if (y == (long) (image->rows-1))
 
2186
          if (y == (ssize_t) (image->rows-1))
2180
2187
            {
2181
2188
              for ( ; ; )
2182
2189
              {
2232
2239
                (void) WriteBlob(image,length,compress_pixels);
2233
2240
              }
2234
2241
          } while (bzip_info.avail_in != 0);
2235
 
          if (y == (long) (image->rows-1))
 
2242
          if (y == (ssize_t) (image->rows-1))
2236
2243
            {
2237
2244
              for ( ; ; )
2238
2245
              {
2262
2269
          if (indexes != (IndexPacket *) NULL)
2263
2270
            index=(*indexes);
2264
2271
          length=255;
2265
 
          for (x=0; x < (long) image->columns; x++)
 
2272
          for (x=0; x < (ssize_t) image->columns; x++)
2266
2273
          {
2267
 
            if ((length < 255) && (x < (long) (image->columns-1)) &&
 
2274
            if ((length < 255) && (x < (ssize_t) (image->columns-1)) &&
2268
2275
                (IsColorEqual(p,&pixel) != MagickFalse) &&
2269
2276
                ((image->matte == MagickFalse) ||
2270
2277
                 (p->opacity == pixel.opacity)) &&
2293
2300
          break;
2294
2301
        }
2295
2302
      }
2296
 
      if ((image->previous == (Image *) NULL) &&
2297
 
          (SetImageProgress(image,SaveImageTag,y,image->rows) == MagickFalse))
2298
 
        break;
 
2303
      if (image->previous == (Image *) NULL)
 
2304
        {
 
2305
          status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
 
2306
            image->rows);
 
2307
          if (status == MagickFalse)
 
2308
            break;
 
2309
        }
2299
2310
    }
2300
2311
    quantum_info=DestroyQuantumInfo(quantum_info);
2301
2312
    compress_pixels=(unsigned char *) RelinquishMagickMemory(compress_pixels);