Blame test/check_tag.c

Packit 994f1a
/* $Id: check_tag.c,v 1.2.2.1 2010-06-08 18:50:43 bfriesen Exp $ */
Packit 994f1a
Packit 994f1a
/*
Packit 994f1a
 * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>
Packit 994f1a
 *
Packit 994f1a
 * Permission to use, copy, modify, distribute, and sell this software and 
Packit 994f1a
 * its documentation for any purpose is hereby granted without fee, provided
Packit 994f1a
 * that (i) the above copyright notices and this permission notice appear in
Packit 994f1a
 * all copies of the software and related documentation, and (ii) the names of
Packit 994f1a
 * Sam Leffler and Silicon Graphics may not be used in any advertising or
Packit 994f1a
 * publicity relating to the software without the specific, prior written
Packit 994f1a
 * permission of Sam Leffler and Silicon Graphics.
Packit 994f1a
 * 
Packit 994f1a
 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
Packit 994f1a
 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
Packit 994f1a
 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
Packit 994f1a
 * 
Packit 994f1a
 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
Packit 994f1a
 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
Packit 994f1a
 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
Packit 994f1a
 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
Packit 994f1a
 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
Packit 994f1a
 * OF THIS SOFTWARE.
Packit 994f1a
 */
Packit 994f1a
Packit 994f1a
/*
Packit 994f1a
 * TIFF Library
Packit 994f1a
 *
Packit 994f1a
 * Module to test LONG tags read/write functions.
Packit 994f1a
 */
Packit 994f1a
Packit 994f1a
#include "tiffio.h"
Packit 994f1a
Packit 994f1a
int
Packit 994f1a
CheckShortField(TIFF *tif, ttag_t field, uint16 value)
Packit 994f1a
{
Packit 994f1a
	uint16 tmp = 0;
Packit 994f1a
Packit 994f1a
	if (!TIFFGetField(tif, field, &tmp)) {
Packit 994f1a
		fprintf (stderr, "Problem fetching tag %lu.\n",
Packit 994f1a
			 (unsigned long) field);
Packit 994f1a
		return -1;
Packit 994f1a
	}
Packit 994f1a
	if (tmp != value) {
Packit 994f1a
		fprintf (stderr, "Wrong SHORT value fetched for tag %lu.\n",
Packit 994f1a
			 (unsigned long) field);
Packit 994f1a
		return -1;
Packit 994f1a
	}
Packit 994f1a
Packit 994f1a
	return 0;
Packit 994f1a
}
Packit 994f1a
Packit 994f1a
int
Packit 994f1a
CheckLongField(TIFF *tif, ttag_t field, uint32 value)
Packit 994f1a
{
Packit 994f1a
	uint32 tmp = 0;
Packit 994f1a
Packit 994f1a
	if (!TIFFGetField(tif, field, &tmp)) {
Packit 994f1a
		fprintf (stderr, "Problem fetching tag %lu.\n",
Packit 994f1a
			 (unsigned long) field);
Packit 994f1a
		return -1;
Packit 994f1a
	}
Packit 994f1a
	if (tmp != value) {
Packit 994f1a
		fprintf (stderr, "Wrong LONG value fetched for tag %lu.\n",
Packit 994f1a
			 (unsigned long) field);
Packit 994f1a
		return -1;
Packit 994f1a
	}
Packit 994f1a
Packit 994f1a
	return 0;
Packit 994f1a
}
Packit 994f1a
Packit 994f1a
Packit 994f1a
/*
Packit 994f1a
 * Local Variables:
Packit 994f1a
 * mode: c
Packit 994f1a
 * c-basic-offset: 8
Packit 994f1a
 * fill-column: 78
Packit 994f1a
 * End:
Packit 994f1a
 */