~ubuntu-branches/ubuntu/trusty/tiff/trusty

« back to all changes in this revision

Viewing changes to tools/ras2tiff.c

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2012-06-24 13:45:42 UTC
  • mfrom: (15.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20120624134542-u7dltcqwnb6orprf
Tags: 4.0.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: ras2tiff.c,v 1.15.2.1 2010-06-08 18:50:44 bfriesen Exp $ */
 
1
/* $Id: ras2tiff.c,v 1.18 2010-03-10 18:56:49 bfriesen Exp $ */
2
2
 
3
3
/*
4
4
 * Copyright (c) 1988-1997 Sam Leffler
35
35
# include <unistd.h>
36
36
#endif
37
37
 
 
38
#ifdef NEED_LIBPORT
 
39
# include "libport.h"
 
40
#endif
 
41
 
38
42
#include "rasterfile.h"
39
43
#include "tiffio.h"
40
44
 
90
94
        }
91
95
        if (fread(&h, sizeof (h), 1, in) != 1) {
92
96
                fprintf(stderr, "%s: Can not read header.\n", argv[optind]);
 
97
                fclose(in);
93
98
                return (-2);
94
99
        }
95
100
        if (strcmp(h.ras_magic, RAS_MAGIC) == 0) {
114
119
#endif
115
120
        } else {
116
121
                fprintf(stderr, "%s: Not a rasterfile.\n", argv[optind]);
 
122
                fclose(in);
117
123
                return (-3);
118
124
        }
119
125
        out = TIFFOpen(argv[optind+1], "w");
120
126
        if (out == NULL)
 
127
        {
 
128
                fclose(in);
121
129
                return (-4);
 
130
        }
122
131
        TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) h.ras_width);
123
132
        TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h.ras_height);
124
133
        TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
220
229
                        break;
221
230
        }
222
231
        (void) TIFFClose(out);
 
232
        fclose(in);
223
233
        return (0);
224
234
}
225
235