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

« back to all changes in this revision

Viewing changes to magick/property.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-06-15 11:05:28 UTC
  • mfrom: (6.2.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110615110528-08jgo07a4846xh8d
Tags: 8:6.6.0.4-3ubuntu1
* Resynchronise with Debian (LP: #797595).  Remaining changes:
  - Make ufraw-batch (universe) a suggestion instead of a recommendation.
  - Make debian/rules install target depend on check; they cannot reliably
    be run in parallel.
  - Don't set MAKEFLAGS in debian/rules; just pass it to the build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
381
381
*/
382
382
 
383
383
static char
384
 
  *TracePSClippath(const unsigned char *,size_t,const size_t,
385
 
    const size_t),
386
 
  *TraceSVGClippath(const unsigned char *,size_t,const size_t,
387
 
    const size_t);
 
384
  *TracePSClippath(const unsigned char *,size_t,const unsigned long,
 
385
    const unsigned long),
 
386
  *TraceSVGClippath(const unsigned char *,size_t,const unsigned long,
 
387
    const unsigned long);
388
388
 
389
389
static MagickBooleanType GetIPTCProperty(const Image *image,const char *key)
390
390
{
400
400
    dataset,
401
401
    record;
402
402
 
403
 
  register ssize_t
 
403
  register long
404
404
    i;
405
405
 
406
406
  size_t
415
415
  if (count != 2)
416
416
    return(MagickFalse);
417
417
  attribute=(char *) NULL;
418
 
  for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=(ssize_t) length)
 
418
  for (i=0; i < (long) GetStringInfoLength(profile); i+=(long) length)
419
419
  {
420
420
    length=1;
421
 
    if ((ssize_t) GetStringInfoDatum(profile)[i] != 0x1c)
 
421
    if ((long) GetStringInfoDatum(profile)[i] != 0x1c)
422
422
      continue;
423
423
    length=(size_t) (GetStringInfoDatum(profile)[i+3] << 8);
424
424
    length|=GetStringInfoDatum(profile)[i+4];
451
451
  return(MagickTrue);
452
452
}
453
453
 
454
 
static inline ssize_t MagickMax(const ssize_t x,const ssize_t y)
 
454
static inline long MagickMax(const long x,const long y)
455
455
{
456
456
  if (x > y)
457
457
    return(x);
470
470
  return(c);
471
471
}
472
472
 
473
 
static inline size_t ReadPropertyMSBLong(const unsigned char **p,
 
473
static inline unsigned long ReadPropertyMSBLong(const unsigned char **p,
474
474
  size_t *length)
475
475
{
476
476
  int
477
477
    c;
478
478
 
479
 
  register ssize_t
 
479
  register long
480
480
    i;
481
481
 
482
482
  unsigned char
483
483
    buffer[4];
484
484
 
485
 
  size_t
 
485
  unsigned long
486
486
    value;
487
487
 
488
488
  if (*length < 4)
493
493
    (*length)--;
494
494
    buffer[i]=(unsigned char) c;
495
495
  }
496
 
  value=(size_t) (buffer[0] << 24);
 
496
  value=(unsigned long) (buffer[0] << 24);
497
497
  value|=buffer[1] << 16;
498
498
  value|=buffer[2] << 8;
499
499
  value|=buffer[3];
506
506
  int
507
507
    c;
508
508
 
509
 
  register ssize_t
 
509
  register long
510
510
    i;
511
511
 
512
512
  unsigned char
543
543
    *info;
544
544
 
545
545
  long
 
546
    id,
546
547
    start,
547
 
    stop;
548
 
 
549
 
  MagickBooleanType
550
 
    status;
551
 
 
552
 
  register ssize_t
553
 
    i;
554
 
 
555
 
  ssize_t
556
 
    count,
557
 
    id,
 
548
    stop,
558
549
    sub_number;
559
550
 
 
551
  MagickBooleanType
 
552
    status;
 
553
 
 
554
  register long
 
555
    i;
 
556
 
 
557
  ssize_t
 
558
    count;
 
559
 
560
560
  size_t
561
561
    length;
562
562
 
592
592
      continue;
593
593
    if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')
594
594
      continue;
595
 
    id=(ssize_t) ReadPropertyMSBShort(&info,&length);
596
 
    if (id < (ssize_t) start)
 
595
    id=(long) ReadPropertyMSBShort(&info,&length);
 
596
    if (id < start)
597
597
      continue;
598
 
    if (id > (ssize_t) stop)
 
598
    if (id > stop)
599
599
      continue;
600
600
    if (resource != (char *) NULL)
601
601
      resource=DestroyString(resource);
608
608
            sizeof(*resource));
609
609
        if (resource != (char *) NULL)
610
610
          {
611
 
            for (i=0; i < (ssize_t) count; i++)
 
611
            for (i=0; i < (long) count; i++)
612
612
              resource[i]=(char) ReadPropertyByte(&info,&length);
613
613
            resource[count]='\0';
614
614
          }
691
691
  return((unsigned short) (value & 0xffff));
692
692
}
693
693
 
694
 
static inline size_t ReadPropertyLong(const EndianType endian,
 
694
static inline unsigned long ReadPropertyLong(const EndianType endian,
695
695
  const unsigned char *buffer)
696
696
{
697
 
  size_t
 
697
  unsigned long
698
698
    value;
699
699
 
700
700
  if (endian == MSBEndian)
701
701
    {
702
 
      value=(size_t) ((buffer[0] << 24) | (buffer[1] << 16) |
 
702
      value=(unsigned long) ((buffer[0] << 24) | (buffer[1] << 16) |
703
703
        (buffer[2] << 8) | buffer[3]);
704
 
      return((size_t) (value & 0xffffffff));
 
704
      return((unsigned long) (value & 0xffffffff));
705
705
    }
706
 
  value=(size_t) ((buffer[3] << 24) | (buffer[2] << 16) |
 
706
  value=(unsigned long) ((buffer[3] << 24) | (buffer[2] << 16) |
707
707
    (buffer[1] << 8 ) | (buffer[0]));
708
 
  return((size_t) (value & 0xffffffff));
 
708
  return((unsigned long) (value & 0xffffffff));
709
709
}
710
710
 
711
711
static MagickBooleanType GetEXIFProperty(const Image *image,
732
732
 
733
733
#define EXIFMultipleValues(size, format, arg) \
734
734
{ \
735
 
   ssize_t \
 
735
   long \
736
736
     component; \
737
737
 \
738
738
   size_t \
758
758
 
759
759
#define EXIFMultipleFractions(size, format, arg1, arg2) \
760
760
{ \
761
 
   ssize_t \
 
761
   long \
762
762
     component; \
763
763
 \
764
764
   size_t \
787
787
    const unsigned char
788
788
      *directory;
789
789
 
790
 
    size_t
 
790
    unsigned long
791
791
      entry,
792
792
      offset;
793
793
  } DirectoryInfo;
794
794
 
795
795
  typedef struct _TagInfo
796
796
  {
797
 
    size_t
 
797
    unsigned long
798
798
      tag;
799
799
 
800
800
    const char
1090
1090
  EndianType
1091
1091
    endian;
1092
1092
 
1093
 
  ssize_t
 
1093
  long
1094
1094
    all,
1095
1095
    id,
1096
1096
    level,
1097
1097
    tag_value;
1098
1098
 
1099
 
  register ssize_t
 
1099
  register long
1100
1100
    i;
1101
1101
 
1102
1102
  size_t
1108
1108
  static int
1109
1109
    tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
1110
1110
 
1111
 
  size_t
 
1111
  unsigned long
1112
1112
    entry,
1113
1113
    number_entries,
1114
1114
    tag_offset,
1166
1166
      n/=4;
1167
1167
      do
1168
1168
      {
1169
 
        for (i=(ssize_t) n-1L; i >= 0; i--)
 
1169
        for (i=(long) n-1L; i >= 0; i--)
1170
1170
        {
1171
1171
          c=(*property++);
1172
1172
          tag<<=4;
1195
1195
          break;
1196
1196
        if (LocaleCompare(EXIFTag[i].description,property) == 0)
1197
1197
          {
1198
 
            tag=(size_t) EXIFTag[i].tag;
 
1198
            tag=(unsigned long) EXIFTag[i].tag;
1199
1199
            break;
1200
1200
          }
1201
1201
      }
1224
1224
  }
1225
1225
  if (length < 16)
1226
1226
    return(MagickFalse);
1227
 
  id=(ssize_t) ReadPropertyShort(LSBEndian,exif);
 
1227
  id=(long) ReadPropertyShort(LSBEndian,exif);
1228
1228
  endian=LSBEndian;
1229
1229
  if (id == 0x4949)
1230
1230
    endian=LSBEndian;
1266
1266
    number_entries=ReadPropertyShort(endian,directory);
1267
1267
    for ( ; entry < number_entries; entry++)
1268
1268
    {
1269
 
      ssize_t
 
1269
      long
1270
1270
        components;
1271
1271
 
1272
1272
      register unsigned char
1276
1276
      size_t
1277
1277
        number_bytes;
1278
1278
 
1279
 
      size_t
 
1279
      unsigned long
1280
1280
        format;
1281
1281
 
1282
1282
      q=(unsigned char *) (directory+2+(12*entry));
1283
 
      tag_value=(ssize_t) (ReadPropertyShort(endian,q)+tag_offset);
1284
 
      format=(size_t) ReadPropertyShort(endian,q+2);
 
1283
      tag_value=(long) ReadPropertyShort(endian,q)+tag_offset;
 
1284
      format=(unsigned long) ReadPropertyShort(endian,q+2);
1285
1285
      if (format >= (sizeof(tag_bytes)/sizeof(*tag_bytes)))
1286
1286
        break;
1287
 
      components=(ssize_t) ReadPropertyLong(endian,q+4);
 
1287
      components=(long) ReadPropertyLong(endian,q+4);
1288
1288
      number_bytes=(size_t) components*tag_bytes[format];
1289
1289
      if (number_bytes <= 4)
1290
1290
        p=q+8;
1301
1301
            continue;
1302
1302
          p=(unsigned char *) (exif+offset);
1303
1303
        }
1304
 
      if ((all != 0) || (tag == (size_t) tag_value))
 
1304
      if ((all != 0) || (tag == (unsigned long) tag_value))
1305
1305
        {
1306
1306
          char
1307
1307
            buffer[MaxTextExtent],
1312
1312
            case EXIF_FMT_BYTE:
1313
1313
            case EXIF_FMT_UNDEFINED:
1314
1314
            {
1315
 
              EXIFMultipleValues(1,"%.20g",(double)
 
1315
              EXIFMultipleValues(1,"%lu",(unsigned long)
1316
1316
                (*(unsigned char *) p1));
1317
1317
              break;
1318
1318
            }
1319
1319
            case EXIF_FMT_SBYTE:
1320
1320
            {
1321
 
              EXIFMultipleValues(1,"%.20g",(double) (*(signed char *) p1));
 
1321
              EXIFMultipleValues(1,"%ld",(long) (*(signed char *) p1));
1322
1322
              break;
1323
1323
            }
1324
1324
            case EXIF_FMT_SSHORT:
1333
1333
            }
1334
1334
            case EXIF_FMT_ULONG:
1335
1335
            {
1336
 
              EXIFMultipleValues(4,"%.20g",(double)
1337
 
                ReadPropertyLong(endian,p1));
 
1336
              EXIFMultipleValues(4,"%lu",ReadPropertyLong(endian,p1));
1338
1337
              break;
1339
1338
            }
1340
1339
            case EXIF_FMT_SLONG:
1341
1340
            {
1342
 
              EXIFMultipleValues(4,"%.20g",(double)
1343
 
                ReadPropertyLong(endian,p1));
 
1341
              EXIFMultipleValues(4,"%ld",ReadPropertyLong(endian,p1));
1344
1342
              break;
1345
1343
            }
1346
1344
            case EXIF_FMT_URATIONAL:
1347
1345
            {
1348
 
              EXIFMultipleFractions(8,"%.20g/%.20g",(double)
1349
 
                ReadPropertyLong(endian,p1),(double)
 
1346
              EXIFMultipleFractions(8,"%ld/%ld",ReadPropertyLong(endian,p1),
1350
1347
                ReadPropertyLong(endian,p1+4));
1351
1348
              break;
1352
1349
            }
1353
1350
            case EXIF_FMT_SRATIONAL:
1354
1351
            {
1355
 
              EXIFMultipleFractions(8,"%.20g/%.20g",(double)
1356
 
                ReadPropertyLong(endian,p1),(double)
 
1352
              EXIFMultipleFractions(8,"%ld/%ld",ReadPropertyLong(endian,p1),
1357
1353
                ReadPropertyLong(endian,p1+4));
1358
1354
              break;
1359
1355
            }
1376
1372
                  sizeof(*value));
1377
1373
              if (value != (char *) NULL)
1378
1374
                {
1379
 
                  register ssize_t
 
1375
                  register long
1380
1376
                    i;
1381
1377
 
1382
 
                  for (i=0; i < (ssize_t) number_bytes; i++)
 
1378
                  for (i=0; i < (long) number_bytes; i++)
1383
1379
                  {
1384
1380
                    value[i]='.';
1385
1381
                    if ((isprint((int) p[i]) != 0) || (p[i] == '\0'))
1406
1402
                  const char
1407
1403
                    *description;
1408
1404
 
1409
 
                  register ssize_t
 
1405
                  register long
1410
1406
                    i;
1411
1407
 
1412
1408
                  description="unknown";
1414
1410
                  {
1415
1411
                    if (EXIFTag[i].tag == 0)
1416
1412
                      break;
1417
 
                    if ((ssize_t) EXIFTag[i].tag == tag_value)
 
1413
                    if ((long) EXIFTag[i].tag == tag_value)
1418
1414
                      {
1419
1415
                        description=EXIFTag[i].description;
1420
1416
                        break;
1428
1424
                {
1429
1425
                  if (tag_value < 0x10000)
1430
1426
                    (void) FormatMagickString(key,MaxTextExtent,"#%04lx",
1431
 
                      (unsigned long) tag_value);
 
1427
                      tag_value);
1432
1428
                  else
1433
1429
                    if (tag_value < 0x20000)
1434
1430
                      (void) FormatMagickString(key,MaxTextExtent,"@%04lx",
1435
 
                        (unsigned long) (tag_value & 0xffff));
 
1431
                        tag_value & 0xffff);
1436
1432
                    else
1437
1433
                      (void) FormatMagickString(key,MaxTextExtent,"unknown");
1438
1434
                  break;
1457
1453
            offset=(size_t) ReadPropertyLong(endian,p);
1458
1454
            if ((offset < length) && (level < (MaxDirectoryStack-2)))
1459
1455
              {
1460
 
                size_t
 
1456
                unsigned long
1461
1457
                  tag_offset1;
1462
1458
 
1463
1459
                tag_offset1=(tag_value == TAG_GPS_OFFSET) ? 0x10000UL : 0UL;
1568
1564
}
1569
1565
 
1570
1566
static char *TracePSClippath(const unsigned char *blob,size_t length,
1571
 
  const size_t magick_unused(columns),
1572
 
  const size_t magick_unused(rows))
 
1567
  const unsigned long magick_unused(columns),
 
1568
  const unsigned long magick_unused(rows))
1573
1569
{
1574
1570
  char
1575
1571
    *path,
1576
1572
    *message;
1577
1573
 
1578
 
  ssize_t
 
1574
  long
1579
1575
    knot_count,
1580
1576
    selector,
1581
1577
    y;
1588
1584
    last[3],
1589
1585
    point[3];
1590
1586
 
1591
 
  register ssize_t
 
1587
  register long
1592
1588
    i,
1593
1589
    x;
1594
1590
 
1628
1624
  in_subpath=MagickFalse;
1629
1625
  while (length > 0)
1630
1626
  {
1631
 
    selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
 
1627
    selector=(long) ReadPropertyMSBShort(&blob,&length);
1632
1628
    switch (selector)
1633
1629
    {
1634
1630
      case 0:
1643
1639
        /*
1644
1640
          Expected subpath length record.
1645
1641
        */
1646
 
        knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
 
1642
        knot_count=(long) ReadPropertyMSBShort(&blob,&length);
1647
1643
        blob+=22;
1648
1644
        length-=22;
1649
1645
        break;
1667
1663
        */
1668
1664
        for (i=0; i < 3; i++)
1669
1665
        {
1670
 
          size_t 
 
1666
          unsigned long 
1671
1667
            xx,
1672
1668
            yy;
1673
1669
 
1674
1670
          yy=ReadPropertyMSBLong(&blob,&length);
1675
1671
          xx=ReadPropertyMSBLong(&blob,&length);
1676
 
          x=(ssize_t) xx;
 
1672
          x=(long) xx;
1677
1673
          if (xx > 2147483647)
1678
 
            x=(ssize_t) xx-4294967295-1;
1679
 
          y=(ssize_t) yy;
 
1674
            x=xx-4294967295-1;
 
1675
          y=(long) yy;
1680
1676
          if (yy > 2147483647)
1681
 
            y=(ssize_t) yy-4294967295-1;
 
1677
            y=yy-4294967295-1;
1682
1678
          point[i].x=(double) x/4096/4096;
1683
1679
          point[i].y=1.0-(double) y/4096/4096;
1684
1680
        }
1777
1773
}
1778
1774
 
1779
1775
static char *TraceSVGClippath(const unsigned char *blob,size_t length,
1780
 
  const size_t columns,const size_t rows)
 
1776
  const unsigned long columns,const unsigned long rows)
1781
1777
{
1782
1778
  char
1783
1779
    *path,
1784
1780
    *message;
1785
1781
 
1786
 
  ssize_t
 
1782
  long
1787
1783
    knot_count,
1788
1784
    selector,
1789
1785
    x,
1797
1793
    last[3],
1798
1794
    point[3];
1799
1795
 
1800
 
  register ssize_t
 
1796
  register long
1801
1797
    i;
1802
1798
 
1803
1799
  path=AcquireString((char *) NULL);
1808
1804
    "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
1809
1805
  (void) ConcatenateString(&path,message);
1810
1806
  (void) FormatMagickString(message,MaxTextExtent,
1811
 
    "<svg width=\"%.20g\" height=\"%.20g\">\n",(double) columns,(double) rows);
 
1807
    "<svg width=\"%lu\" height=\"%lu\">\n",columns,rows);
1812
1808
  (void) ConcatenateString(&path,message);
1813
1809
  (void) FormatMagickString(message,MaxTextExtent,"<g>\n");
1814
1810
  (void) ConcatenateString(&path,message);
1825
1821
  in_subpath=MagickFalse;
1826
1822
  while (length != 0)
1827
1823
  {
1828
 
    selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
 
1824
    selector=(long) ReadPropertyMSBShort(&blob,&length);
1829
1825
    switch (selector)
1830
1826
    {
1831
1827
      case 0:
1840
1836
        /*
1841
1837
          Expected subpath length record.
1842
1838
        */
1843
 
        knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
 
1839
        knot_count=(long) ReadPropertyMSBShort(&blob,&length);
1844
1840
        blob+=22;
1845
1841
        length-=22;
1846
1842
        break;
1864
1860
        */
1865
1861
        for (i=0; i < 3; i++)
1866
1862
        {
1867
 
          size_t 
 
1863
          unsigned long 
1868
1864
            xx,
1869
1865
            yy;
1870
1866
 
1871
1867
          yy=ReadPropertyMSBLong(&blob,&length);
1872
1868
          xx=ReadPropertyMSBLong(&blob,&length);
1873
 
          x=(ssize_t) xx;
 
1869
          x=(long) xx;
1874
1870
          if (xx > 2147483647)
1875
 
            x=(ssize_t) xx-4294967295-1;
1876
 
          y=(ssize_t) yy;
 
1871
            x=xx-4294967295-1;
 
1872
          y=(long) yy;
1877
1873
          if (yy > 2147483647)
1878
 
            y=(ssize_t) yy-4294967295-1;
 
1874
            y=yy-4294967295-1;
1879
1875
          point[i].x=(double) x*columns/4096/4096;
1880
1876
          point[i].y=(double) y*rows/4096/4096;
1881
1877
        }
2151
2147
    filename[MaxTextExtent];
2152
2148
 
2153
2149
  *value='\0';
2154
 
  switch (*property)
 
2150
  switch (*(property))
2155
2151
  {
2156
2152
    case 'b':
2157
2153
    {
2171
2167
            Image channels.
2172
2168
          */
2173
2169
          (void) FormatMagickString(value,MaxTextExtent,"%s",
2174
 
            MagickOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
 
2170
            MagickOptionToMnemonic(MagickColorspaceOptions,(long)
2175
2171
            image->colorspace));
2176
2172
          LocaleLower(value);
2177
2173
          if (image->matte != MagickFalse)
2190
2186
          if (IsGrayImage(image,&image->exception) != MagickFalse)
2191
2187
            colorspace=GRAYColorspace;
2192
2188
          (void) FormatMagickString(value,MaxTextExtent,"%s",
2193
 
            MagickOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
2194
 
            colorspace));
 
2189
            MagickOptionToMnemonic(MagickColorspaceOptions,(long) colorspace));
2195
2190
          break;
2196
2191
        }
2197
2192
      break;
2200
2195
    {
2201
2196
      if (LocaleNCompare("depth",property,5) == 0)
2202
2197
        {
2203
 
          (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
2204
 
            image->depth);
 
2198
          (void) FormatMagickString(value,MaxTextExtent,"%lu",image->depth);
2205
2199
          break;
2206
2200
        }
2207
2201
      if (LocaleNCompare("directory",property,9) == 0)
2227
2221
      if (LocaleNCompare("group",property,5) == 0)
2228
2222
        {
2229
2223
          (void) FormatMagickString(value,MaxTextExtent,"0x%lx",
2230
 
            (unsigned long) image_info->group);
 
2224
            image_info->group);
2231
2225
          break;
2232
2226
        }
2233
2227
      break;
2236
2230
    {
2237
2231
      if (LocaleNCompare("height",property,6) == 0)
2238
2232
        {
2239
 
          (void) FormatMagickString(value,MaxTextExtent,"%.20g",
2240
 
            image->magick_rows != 0 ? (double) image->magick_rows : 256.0);
 
2233
          (void) FormatMagickString(value,MaxTextExtent,"%lu",
 
2234
            image->magick_rows != 0 ? image->magick_rows : 256UL);
2241
2235
          break;
2242
2236
        }
2243
2237
      break;
2335
2329
          register const Image
2336
2330
            *p;
2337
2331
 
2338
 
          size_t
 
2332
          unsigned long
2339
2333
            page;
2340
2334
 
2341
2335
          p=image;
2342
2336
          for (page=1; GetPreviousImageInList(p) != (Image *) NULL; page++)
2343
2337
            p=GetPreviousImageInList(p);
2344
 
          (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
2345
 
            page);
 
2338
          (void) FormatMagickString(value,MaxTextExtent,"%lu",page);
2346
2339
          break;
2347
2340
        }
2348
2341
      break;
2355
2348
            format[MaxTextExtent];
2356
2349
 
2357
2350
          (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
2358
 
          (void) FormatMagickString(value,MaxTextExtent,"%sB",format);
 
2351
          (void) FormatMagickString(value,MaxTextExtent,"%s",format);
2359
2352
          break;
2360
2353
        }
2361
2354
      if (LocaleNCompare("scenes",property,6) == 0)
2362
2355
        {
2363
 
          (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
2364
 
            GetImageListLength(image));
 
2356
          (void) FormatMagickString(value,MaxTextExtent,"%lu",
 
2357
            (unsigned long) GetImageListLength(image));
2365
2358
          break;
2366
2359
        }
2367
2360
      if (LocaleNCompare("scene",property,5) == 0)
2368
2361
        {
2369
 
          (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
2370
 
            image->scene);
 
2362
          (void) FormatMagickString(value,MaxTextExtent,"%lu",image->scene);
2371
2363
          if (image_info->number_scenes != 0)
2372
 
            (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
 
2364
            (void) FormatMagickString(value,MaxTextExtent,"%lu",
2373
2365
              image_info->scene);
2374
2366
          break;
2375
2367
        }
2414
2406
    {
2415
2407
      if (LocaleNCompare("width",property,5) == 0)
2416
2408
        {
2417
 
          (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double) 
2418
 
            (image->magick_columns != 0 ? image->magick_columns : 256));
 
2409
          (void) FormatMagickString(value,MaxTextExtent,"%lu",
 
2410
            image->magick_columns != 0 ? image->magick_columns : 256UL);
2419
2411
          break;
2420
2412
        }
2421
2413
      break;
2545
2537
  register const char
2546
2538
    *p;
2547
2539
 
2548
 
  register ssize_t
 
2540
  register long
2549
2541
    i;
2550
2542
 
2551
2543
  size_t
2618
2610
        /*
2619
2611
          File size.
2620
2612
        */
2621
 
        (void) FormatMagickString(format,MaxTextExtent,"%.20g",(double)
 
2613
        (void) FormatMagickString(format,MaxTextExtent,"%lu",(unsigned long)
2622
2614
          image->extent);
2623
2615
        if (image->extent != (MagickSizeType) ((size_t) image->extent))
2624
2616
          (void) FormatMagickSize(image->extent,MagickFalse,format);
2625
2617
        q+=ConcatenateMagickString(q,format,extent);
2626
 
        q+=ConcatenateMagickString(q,"B",extent);
2627
2618
        break;
2628
2619
      }
2629
2620
      case 'c':
2704
2695
        /*
2705
2696
          Image geometry.
2706
2697
        */
2707
 
        q+=FormatMagickString(q,extent,"%.20gx%.20g%+.20g%+.20g",(double)
2708
 
          image->page.width,(double) image->page.height,(double)
2709
 
          image->page.x,(double) image->page.y);
 
2698
        q+=FormatMagickString(q,extent,"%lux%lu%+ld%+ld",image->page.width,
 
2699
          image->page.height,image->page.x,image->page.y);
2710
2700
        break;
2711
2701
      }
2712
2702
      case 'h':
2714
2704
        /*
2715
2705
          Image height.
2716
2706
        */
2717
 
        q+=FormatMagickString(q,extent,"%.20g",(double)
2718
 
          (image->rows != 0 ? image->rows : image->magick_rows));
 
2707
        q+=FormatMagickString(q,extent,"%lu",image->rows != 0 ? image->rows :
 
2708
          image->magick_rows);
2719
2709
        break;
2720
2710
      }
2721
2711
      case 'i':
2731
2721
        /*
2732
2722
          Number of unique colors.
2733
2723
        */
2734
 
        q+=FormatMagickString(q,extent,"%.20g",(double)
2735
 
          GetNumberColors(image,(FILE *) NULL,&image->exception));
 
2724
        q+=FormatMagickString(q,extent,"%lu",GetNumberColors(image,
 
2725
          (FILE *) NULL,&image->exception));
2736
2726
        break;
2737
2727
      }
2738
2728
      case 'l':
2777
2767
        /*
2778
2768
          Number of images in the list.
2779
2769
        */
2780
 
        q+=FormatMagickString(q,extent,"%.20g",(double)
 
2770
        q+=FormatMagickString(q,extent,"%lu",(unsigned long)
2781
2771
          GetImageListLength(image));
2782
2772
        break;
2783
2773
      }
2794
2784
        register const Image
2795
2785
          *p;
2796
2786
 
2797
 
        size_t
 
2787
        unsigned long
2798
2788
          page;
2799
2789
 
2800
2790
        /*
2803
2793
        p=image;
2804
2794
        for (page=1; GetPreviousImageInList(p) != (Image *) NULL; page++)
2805
2795
          p=GetPreviousImageInList(p);
2806
 
        q+=FormatMagickString(q,extent,"%.20g",(double) page);
 
2796
        q+=FormatMagickString(q,extent,"%lu",page);
2807
2797
        break;
2808
2798
      }
2809
2799
      case 'q':
2811
2801
        /*
2812
2802
          Image depth.
2813
2803
        */
2814
 
        q+=FormatMagickString(q,extent,"%.20g",(double) image->depth);
 
2804
        q+=FormatMagickString(q,extent,"%lu",image->depth);
2815
2805
        break;
2816
2806
      }
2817
2807
      case 'r':
2826
2816
        if (IsGrayImage(image,&image->exception) != MagickFalse)
2827
2817
          colorspace=GRAYColorspace;
2828
2818
        q+=FormatMagickString(q,extent,"%s%s%s",MagickOptionToMnemonic(
2829
 
          MagickClassOptions,(ssize_t) image->storage_class),
2830
 
          MagickOptionToMnemonic(MagickColorspaceOptions,(ssize_t) colorspace),
 
2819
          MagickClassOptions,(long) image->storage_class),
 
2820
          MagickOptionToMnemonic(MagickColorspaceOptions,(long) colorspace),
2831
2821
          image->matte != MagickFalse ? "Matte" : "");
2832
2822
        break;
2833
2823
      }
2837
2827
          Image scene number.
2838
2828
        */
2839
2829
        if (text_info->number_scenes == 0)
2840
 
          q+=FormatMagickString(q,extent,"%.20g",(double) image->scene);
 
2830
          q+=FormatMagickString(q,extent,"%lu",image->scene);
2841
2831
        else
2842
 
          q+=FormatMagickString(q,extent,"%.20g",(double) text_info->scene);
 
2832
          q+=FormatMagickString(q,extent,"%lu",text_info->scene);
2843
2833
        break;
2844
2834
      }
2845
2835
      case 'u':
2856
2846
        /*
2857
2847
          Image width.
2858
2848
        */
2859
 
        q+=FormatMagickString(q,extent,"%.20g",(double)
2860
 
          (image->columns != 0 ? image->columns : image->magick_columns));
 
2849
        q+=FormatMagickString(q,extent,"%lu",image->columns != 0 ?
 
2850
          image->columns : image->magick_columns);
2861
2851
        break;
2862
2852
      }
2863
2853
      case 'x':
2866
2856
          Image horizontal resolution.
2867
2857
        */
2868
2858
        q+=FormatMagickString(q,extent,"%g %s",image->x_resolution,
2869
 
          MagickOptionToMnemonic(MagickResolutionOptions,(ssize_t)
2870
 
            image->units));
 
2859
          MagickOptionToMnemonic(MagickResolutionOptions,(long) image->units));
2871
2860
        break;
2872
2861
      }
2873
2862
      case 'y':
2876
2865
          Image vertical resolution.
2877
2866
        */
2878
2867
        q+=FormatMagickString(q,extent,"%g %s",image->y_resolution,
2879
 
          MagickOptionToMnemonic(MagickResolutionOptions,(ssize_t)
2880
 
          image->units));
 
2868
          MagickOptionToMnemonic(MagickResolutionOptions,(long) image->units));
2881
2869
        break;
2882
2870
      }
2883
2871
      case 'z':
2885
2873
        /*
2886
2874
          Image depth.
2887
2875
        */
2888
 
        q+=FormatMagickString(q,extent,"%.20g",(double) image->depth);
 
2876
        q+=FormatMagickString(q,extent,"%lu",image->depth);
2889
2877
        break;
2890
2878
      }
2891
2879
      case 'A':
2894
2882
          Image alpha channel.
2895
2883
        */
2896
2884
        q+=FormatMagickString(q,extent,"%s",MagickOptionToMnemonic(
2897
 
          MagickBooleanOptions,(ssize_t) image->matte));
 
2885
          MagickBooleanOptions,(long) image->matte));
2898
2886
        break;
2899
2887
      }
2900
2888
      case 'C':
2903
2891
          Image compression method.
2904
2892
        */
2905
2893
        q+=FormatMagickString(q,extent,"%s",MagickOptionToMnemonic(
2906
 
          MagickCompressOptions,(ssize_t) image->compression));
 
2894
          MagickCompressOptions,(long) image->compression));
2907
2895
        break;
2908
2896
      }
2909
2897
      case 'D':
2912
2900
          Image dispose method.
2913
2901
        */
2914
2902
        q+=FormatMagickString(q,extent,"%s",MagickOptionToMnemonic(
2915
 
          MagickDisposeOptions,(ssize_t) image->dispose));
 
2903
          MagickDisposeOptions,(long) image->dispose));
2916
2904
        break;
2917
2905
      }
2918
2906
      case 'G':
2919
2907
      {
2920
 
        q+=FormatMagickString(q,extent,"%.20gx%.20g",(double)
2921
 
          image->magick_columns,(double) image->magick_rows);
 
2908
        q+=FormatMagickString(q,extent,"%lux%lu",image->magick_columns,
 
2909
          image->magick_rows);
2922
2910
        break;
2923
2911
      }
2924
2912
      case 'H':
2925
2913
      {
2926
 
        q+=FormatMagickString(q,extent,"%.20g",(double)
2927
 
          image->page.height);
 
2914
        q+=FormatMagickString(q,extent,"%ld",image->page.height);
2928
2915
        break;
2929
2916
      }
2930
2917
      case 'O':
2931
2918
      {
2932
 
        q+=FormatMagickString(q,extent,"%+ld%+ld",(long) image->page.x,
2933
 
          (long) image->page.y);
 
2919
        q+=FormatMagickString(q,extent,"%+ld%+ld",image->page.x,image->page.y);
2934
2920
        break;
2935
2921
      }
2936
2922
      case 'P':
2937
2923
      {
2938
 
        q+=FormatMagickString(q,extent,"%.20gx%.20g",(double) image->page.width,
2939
 
          (double) image->page.height);
 
2924
        q+=FormatMagickString(q,extent,"%lux%lu",image->page.width,
 
2925
          image->page.height);
2940
2926
        break;
2941
2927
      }
2942
2928
      case 'Q':
2943
2929
      {
2944
 
        q+=FormatMagickString(q,extent,"%.20g",(double) image->quality);
 
2930
        q+=FormatMagickString(q,extent,"%lu",image->quality);
2945
2931
        break;
2946
2932
      }
2947
2933
      case 'S':
2952
2938
        if (text_info->number_scenes == 0)
2953
2939
          q+=CopyMagickString(q,"2147483647",extent);
2954
2940
        else
2955
 
          q+=FormatMagickString(q,extent,"%.20g",(double)
2956
 
            (text_info->scene+text_info->number_scenes));
 
2941
          q+=FormatMagickString(q,extent,"%lu",text_info->scene+
 
2942
            text_info->number_scenes);
2957
2943
        break;
2958
2944
      }
2959
2945
      case 'T':
2960
2946
      {
2961
 
        q+=FormatMagickString(q,extent,"%.20g",(double) image->delay);
 
2947
        q+=FormatMagickString(q,extent,"%lu",image->delay);
2962
2948
        break;
2963
2949
      }
2964
2950
      case 'W':
2965
2951
      {
2966
 
        q+=FormatMagickString(q,extent,"%.20g",(double) image->page.width);
 
2952
        q+=FormatMagickString(q,extent,"%ld",image->page.width);
2967
2953
        break;
2968
2954
      }
2969
2955
      case 'X':
2970
2956
      {
2971
 
        q+=FormatMagickString(q,extent,"%+.20g",(double) image->page.x);
 
2957
        q+=FormatMagickString(q,extent,"%+ld",image->page.x);
2972
2958
        break;
2973
2959
      }
2974
2960
      case 'Y':
2975
2961
      {
2976
 
        q+=FormatMagickString(q,extent,"%+.20g",(double) image->page.y);
 
2962
        q+=FormatMagickString(q,extent,"%+ld",image->page.y);
2977
2963
        break;
2978
2964
      }
2979
2965
      case 'Z':
2994
2980
          *key,
2995
2981
          *value;
2996
2982
 
2997
 
        ssize_t
 
2983
        long
2998
2984
          depth;
2999
2985
 
3000
2986
        /*
3079
3065
              }
3080
3066
            (void) CopyMagickString(q,value,extent);
3081
3067
            q+=length;
3082
 
            break;
3083
3068
          }
3084
3069
        if (image_info == (ImageInfo *) NULL)
3085
3070
          break;
3098
3083
              }
3099
3084
            (void) CopyMagickString(q,value,extent);
3100
3085
            q+=length;
3101
 
            break;
3102
3086
          }
3103
3087
        break;
3104
3088
      }
3111
3095
          Image bounding box.
3112
3096
        */
3113
3097
        page=GetImageBoundingBox(image,&image->exception);
3114
 
        q+=FormatMagickString(q,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
3115
 
          (double) page.width,(double) page.height,(double) page.x,(double)
3116
 
          page.y);
 
3098
        q+=FormatMagickString(q,MaxTextExtent,"%lux%lu%+ld%+ld",page.width,
 
3099
          page.height,page.x,page.y);
3117
3100
        break;
3118
3101
      }
3119
3102
      case '#':
3295
3278
    {
3296
3279
      if (LocaleCompare(property,"colorspace") == 0)
3297
3280
        {
3298
 
          ssize_t
 
3281
          long
3299
3282
            colorspace;
3300
3283
 
3301
3284
          colorspace=ParseMagickOption(MagickColorspaceOptions,MagickFalse,
3307
3290
        }
3308
3291
      if (LocaleCompare(property,"compose") == 0)
3309
3292
        {
3310
 
          ssize_t
 
3293
          long
3311
3294
            compose;
3312
3295
 
3313
3296
          compose=ParseMagickOption(MagickComposeOptions,MagickFalse,value);
3318
3301
        }
3319
3302
      if (LocaleCompare(property,"compress") == 0)
3320
3303
        {
3321
 
          ssize_t
 
3304
          long
3322
3305
            compression;
3323
3306
 
3324
3307
          compression=ParseMagickOption(MagickCompressOptions,MagickFalse,
3343
3326
          flags=ParseGeometry(value,&geometry_info);
3344
3327
          if ((flags & GreaterValue) != 0)
3345
3328
            {
3346
 
              if (image->delay > (size_t) floor(geometry_info.rho+0.5))
3347
 
                image->delay=(size_t) floor(geometry_info.rho+0.5);
 
3329
              if (image->delay > (unsigned long) (geometry_info.rho+0.5))
 
3330
                image->delay=(unsigned long) (geometry_info.rho+0.5);
3348
3331
            }
3349
3332
          else
3350
3333
            if ((flags & LessValue) != 0)
3351
3334
              {
3352
 
                if (image->delay < (size_t) floor(geometry_info.rho+0.5))
3353
 
                  image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
 
3335
                if (image->delay < (unsigned long) (geometry_info.rho+0.5))
 
3336
                  image->ticks_per_second=(long) (geometry_info.sigma+0.5);
3354
3337
              }
3355
3338
            else
3356
 
              image->delay=(size_t) floor(geometry_info.rho+0.5);
 
3339
              image->delay=(unsigned long) (geometry_info.rho+0.5);
3357
3340
          if ((flags & SigmaValue) != 0)
3358
 
            image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
 
3341
            image->ticks_per_second=(long) (geometry_info.sigma+0.5);
3359
3342
          break;
3360
3343
        }
3361
3344
      if (LocaleCompare(property,"depth") == 0)
3365
3348
        }
3366
3349
      if (LocaleCompare(property,"dispose") == 0)
3367
3350
        {
3368
 
          ssize_t
 
3351
          long
3369
3352
            dispose;
3370
3353
 
3371
3354
          dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,value);
3383
3366
    {
3384
3367
      if (LocaleCompare(property,"gravity") == 0)
3385
3368
        {
3386
 
          ssize_t
 
3369
          long
3387
3370
            gravity;
3388
3371
 
3389
3372
          gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,value);
3401
3384
    {
3402
3385
      if (LocaleCompare(property,"intent") == 0)
3403
3386
        {
3404
 
          ssize_t
 
3387
          long
3405
3388
            rendering_intent;
3406
3389
 
3407
3390
          rendering_intent=ParseMagickOption(MagickIntentOptions,MagickFalse,
3413
3396
        }
3414
3397
      if (LocaleCompare(property,"interpolate") == 0)
3415
3398
        {
3416
 
          ssize_t
 
3399
          long
3417
3400
            interpolate;
3418
3401
 
3419
3402
          interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
3452
3435
          geometry=DestroyString(geometry);
3453
3436
          break;
3454
3437
        }
3455
 
      if (LocaleCompare(property,"profile") == 0)
3456
 
        {
3457
 
          ImageInfo
3458
 
            *image_info;
3459
 
 
3460
 
          StringInfo
3461
 
            *profile;
3462
 
 
3463
 
          image_info=AcquireImageInfo();
3464
 
          (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
3465
 
          (void) SetImageInfo(image_info,1,&image->exception);
3466
 
          profile=FileToStringInfo(image_info->filename,~0UL,&image->exception);
3467
 
          if (profile != (StringInfo *) NULL)
3468
 
            status=SetImageProfile(image,image_info->magick,profile);
3469
 
          image_info=DestroyImageInfo(image_info);
3470
 
          break;
3471
 
        }
3472
3438
      status=AddValueToSplayTree((SplayTreeInfo *) image->properties,
3473
3439
        ConstantString(property),ConstantString(value));
3474
3440
      break;
3478
3444
    {
3479
3445
      if (LocaleCompare(property,"rendering-intent") == 0)
3480
3446
        {
3481
 
          ssize_t
 
3447
          long
3482
3448
            rendering_intent;
3483
3449
 
3484
3450
          rendering_intent=ParseMagickOption(MagickIntentOptions,MagickFalse,