]>
git.saurik.com Git - wxWidgets.git/blob - src/tiff/test/check_tag.c
3 * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
5 * Permission to use, copy, modify, distribute, and sell this software and
6 * its documentation for any purpose is hereby granted without fee, provided
7 * that (i) the above copyright notices and this permission notice appear in
8 * all copies of the software and related documentation, and (ii) the names of
9 * Sam Leffler and Silicon Graphics may not be used in any advertising or
10 * publicity relating to the software without the specific, prior written
11 * permission of Sam Leffler and Silicon Graphics.
13 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
28 * Helper testing routines.
34 CheckShortField(TIFF
*tif
, const ttag_t field
, const uint16 value
)
38 if (!TIFFGetField(tif
, field
, &tmp
)) {
39 fprintf (stderr
, "Problem fetching tag %lu.\n",
40 (unsigned long) field
);
44 fprintf (stderr
, "Wrong SHORT value fetched for tag %lu.\n",
45 (unsigned long) field
);
53 CheckShortPairedField(TIFF
*tif
, const ttag_t field
, const uint16
*values
)
55 uint16 tmp
[2] = { 123, 456 };
57 if (!TIFFGetField(tif
, field
, tmp
, tmp
+ 1)) {
58 fprintf (stderr
, "Problem fetching tag %lu.\n",
59 (unsigned long) field
);
62 if (tmp
[0] != values
[0] || tmp
[1] != values
[1]) {
63 fprintf (stderr
, "Wrong SHORT PAIR fetched for tag %lu.\n",
64 (unsigned long) field
);
72 CheckLongField(TIFF
*tif
, const ttag_t field
, const uint32 value
)
76 if (!TIFFGetField(tif
, field
, &tmp
)) {
77 fprintf (stderr
, "Problem fetching tag %lu.\n",
78 (unsigned long) field
);
82 fprintf (stderr
, "Wrong LONG value fetched for tag %lu.\n",
83 (unsigned long) field
);