Fixed problem with unused data comparing as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=349 `-z' option now can be used to set the number of reported different bytes.
This commit is contained in:
parent
2f4d3521b4
commit
adc20ad9b0
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffcmp.c,v 1.3 2001-06-29 02:48:00 warmerda Exp $ */
|
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffcmp.c,v 1.4 2003-06-18 09:57:55 dron Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@ -37,6 +37,7 @@ static uint16 samplesperpixel = 1;
|
|||||||
static uint32 imagewidth;
|
static uint32 imagewidth;
|
||||||
static uint32 imagelength;
|
static uint32 imagelength;
|
||||||
|
|
||||||
|
static void usage(void);
|
||||||
static int tiffcmp(TIFF*, TIFF*);
|
static int tiffcmp(TIFF*, TIFF*);
|
||||||
static int cmptags(TIFF*, TIFF*);
|
static int cmptags(TIFF*, TIFF*);
|
||||||
static void ContigCompare(int, uint32, unsigned char*, unsigned char*, int);
|
static void ContigCompare(int, uint32, unsigned char*, unsigned char*, int);
|
||||||
@ -44,27 +45,21 @@ static void PrintDiff(uint32, int, uint32, int, int);
|
|||||||
static void SeparateCompare(int, int, uint32, unsigned char*, unsigned char*);
|
static void SeparateCompare(int, int, uint32, unsigned char*, unsigned char*);
|
||||||
static void eof(const char*, uint32, int);
|
static void eof(const char*, uint32, int);
|
||||||
|
|
||||||
static void
|
|
||||||
usage(void)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Usage: tiffcmp [-l] [-t] [-z] file1 file2\n");
|
|
||||||
exit(-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TIFF *tif1, *tif2;
|
TIFF *tif1, *tif2;
|
||||||
int c, dirnum;
|
int c, dirnum;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
extern char* optarg;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "ltz")) != -1)
|
while ((c = getopt(argc, argv, "ltz:")) != -1)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'l':
|
case 'l':
|
||||||
stopondiff = 0;
|
stopondiff = 0;
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
stopondiff += 100;
|
stopondiff = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
stoponfirsttag = 0;
|
stoponfirsttag = 0;
|
||||||
@ -99,6 +94,28 @@ main(int argc, char* argv[])
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* stuff[] = {
|
||||||
|
"usage: tiffcmp [options] file1 file2",
|
||||||
|
"where options are:",
|
||||||
|
" -l list each byte of image data that differs between the files",
|
||||||
|
" -z # list specified number of bytes that differs between the files",
|
||||||
|
" -t ignore any differences in directory tags",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
setbuf(stderr, buf);
|
||||||
|
fprintf(stderr, "%s\n\n", TIFFGetVersion());
|
||||||
|
for (i = 0; stuff[i] != NULL; i++)
|
||||||
|
fprintf(stderr, "%s\n", stuff[i]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
#define checkEOF(tif, row, sample) { \
|
#define checkEOF(tif, row, sample) { \
|
||||||
eof(TIFFFileName(tif), row, sample); \
|
eof(TIFFFileName(tif), row, sample); \
|
||||||
goto bad; \
|
goto bad; \
|
||||||
@ -345,7 +362,7 @@ PrintDiff(uint32 row, int sample, uint32 pix, int w1, int w2)
|
|||||||
mask1 = ~((-1)<<bps);
|
mask1 = ~((-1)<<bps);
|
||||||
s = (8-bps);
|
s = (8-bps);
|
||||||
mask2 = mask1<<s;
|
mask2 = mask1<<s;
|
||||||
for (; mask2; mask2 >>= bps, s -= bps, pix++) {
|
for (; mask2 && pix < imagewidth; mask2 >>= bps, s -= bps, pix++) {
|
||||||
if ((w1 & mask2) ^ (w2 & mask2)) {
|
if ((w1 & mask2) ^ (w2 & mask2)) {
|
||||||
printf(
|
printf(
|
||||||
"Scanline %lu, pixel %lu, sample %d: %01x %01x\n",
|
"Scanline %lu, pixel %lu, sample %d: %01x %01x\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user