~cosme/ubuntu/precise/freeimage/freeimage-3.15.1

« back to all changes in this revision

Viewing changes to Source/LibTIFF/tif_dirread.c

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-07-20 13:42:15 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100720134215-xt1454zaedv3b604
Tags: 3.13.1-0ubuntu1
* New upstream release. Closes: (LP: #607800)
 - Updated debian/freeimage-get-orig-source script.
 - Removing no longer necessary debian/patches/* and
   the patch system in debian/rules.
 - Updated debian/rules to work with the new Makefiles.
 - Drop from -O3 to -O2 and use lzma compression saves
   ~10 MB of free space. 
* lintian stuff
 - fixed debhelper-but-no-misc-depends
 - fixed ldconfig-symlink-missing-for-shlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: tif_dirread.c,v 1.21 2007/11/10 18:40:57 drolon Exp $ */
 
1
/* $Id: tif_dirread.c,v 1.29 2009/11/07 19:18:27 drolon Exp $ */
2
2
 
3
3
/*
4
4
 * Copyright (c) 1988-1997 Sam Leffler
100
100
                                      &dir, &tif->tif_nextdiroff);
101
101
        if (!dircount) {
102
102
                TIFFErrorExt(tif->tif_clientdata, module,
103
 
                             "%s: Failed to read directory at offset %lu",
 
103
                             "%s: Failed to read directory at offset %u",
104
104
                             tif->tif_name, tif->tif_nextdiroff);
105
105
                return 0;
106
106
        }
188
188
                        "%s: unknown field with tag %d (0x%x) encountered",
189
189
                                                       tif->tif_name,
190
190
                                                       dp->tdir_tag,
191
 
                                                       dp->tdir_tag,
192
 
                                                       dp->tdir_type);
 
191
                                                       dp->tdir_tag);
193
192
 
194
193
                                        if (!_TIFFMergeFieldInfo(tif,
195
194
                                                _TIFFCreateAnonFieldInfo(tif,
776
775
        dircount = TIFFFetchDirectory(tif, diroff, &dir, NULL);
777
776
        if (!dircount) {
778
777
                TIFFErrorExt(tif->tif_clientdata, module,
779
 
                        "%s: Failed to read custom directory at offset %lu",
 
778
                        "%s: Failed to read custom directory at offset %u",
780
779
                             tif->tif_name, diroff);
781
780
                return 0;
782
781
        }
783
782
 
784
783
        TIFFFreeDirectory(tif);
 
784
        _TIFFmemset(&tif->tif_dir, 0, sizeof(TIFFDirectory));
785
785
 
786
786
        fix = 0;
787
787
        for (dp = dir, i = dircount; i > 0; i--, dp++) {
802
802
 
803
803
                        TIFFWarningExt(tif->tif_clientdata, module,
804
804
                        "%s: unknown field with tag %d (0x%x) encountered",
805
 
                                    tif->tif_name, dp->tdir_tag, dp->tdir_tag,
806
 
                                    dp->tdir_type);
 
805
                                    tif->tif_name, dp->tdir_tag, dp->tdir_tag);
807
806
                        if (!_TIFFMergeFieldInfo(tif,
808
807
                                                 _TIFFCreateAnonFieldInfo(tif,
809
808
                                                 dp->tdir_tag,
905
904
        td->td_stripbytecount = (uint32*)
906
905
            _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint32),
907
906
                "for \"StripByteCounts\" array");
 
907
        if( td->td_stripbytecount == NULL )
 
908
            return -1;
 
909
 
908
910
        if (td->td_compression != COMPRESSION_NONE) {
909
911
                uint32 space = (uint32)(sizeof (TIFFHeader)
910
912
                    + sizeof (uint16)
1024
1026
{
1025
1027
        if (count > dir->tdir_count) {
1026
1028
                TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
1027
 
        "incorrect count for field \"%s\" (%lu, expecting %lu); tag ignored",
 
1029
        "incorrect count for field \"%s\" (%u, expecting %u); tag ignored",
1028
1030
                    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
1029
1031
                    dir->tdir_count, count);
1030
1032
                return (0);
1031
1033
        } else if (count < dir->tdir_count) {
1032
1034
                TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
1033
 
        "incorrect count for field \"%s\" (%lu, expecting %lu); tag trimmed",
 
1035
        "incorrect count for field \"%s\" (%u, expecting %u); tag trimmed",
1034
1036
                    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
1035
1037
                    dir->tdir_count, count);
1036
1038
                return (1);
1228
1230
{
1229
1231
        if (denom == 0) {
1230
1232
                TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
1231
 
                    "%s: Rational with zero denominator (num = %lu)",
 
1233
                    "%s: Rational with zero denominator (num = %u)",
1232
1234
                    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);
1233
1235
                return (0);
1234
1236
        } else {
1350
1352
         */
1351
1353
        if (dir->tdir_count > 2) {
1352
1354
                TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
1353
 
                "unexpected count for field \"%s\", %lu, expected 2; ignored",
 
1355
                "unexpected count for field \"%s\", %u, expected 2; ignored",
1354
1356
                        _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
1355
1357
                        dir->tdir_count);
1356
1358
                return 0;
1424
1426
{
1425
1427
 
1426
1428
        if (dir->tdir_count == 1) {
1427
 
                v[0] = *(float*) &dir->tdir_offset;
 
1429
                union
 
1430
                {
 
1431
                  float  f;
 
1432
                  uint32 i;
 
1433
                } float_union;
 
1434
 
 
1435
                float_union.i=dir->tdir_offset;
 
1436
                v[0]=float_union.f;
1428
1437
                TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);
1429
1438
                return (1);
1430
1439
        } else  if (TIFFFetchData(tif, dir, (char*) v)) {