Skip to content

Commit f351b8d

Browse files
authored
Merge pull request #70 from hattne/libtiff
Only use the public LibTIFF API
2 parents 1475d4f + db4602d commit f351b8d

File tree

11 files changed

+599
-539
lines changed

11 files changed

+599
-539
lines changed

CMakeLists.txt

Lines changed: 286 additions & 255 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@ $(BIN)/tiff2cbf: $(LIB)/libcbf.a $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c
23052305
$(GOPTLIB) $(GOPTINC) $(TIFF)
23062306
mkdir -p $(BIN)
23072307
$(CC) $(CFLAGS) $(LDFLAGS) $(MISCFLAG) $(CBF_REGEXFLAG) $(INCLUDES) $(WARNINGS) \
2308-
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(GOPTLIB) -L$(LIB) \
2308+
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c $(GOPTLIB) -L$(LIB) \
23092309
-lcbf -L$(TIFF_PREFIX)/lib -ltiff $(REGEX_LIBS_STATIC) $(HDF5LIBS_LOCAL) $(EXTRALIBS) $(HDF5LIBS_SYSTEM) -limg -o $@
23102310

23112311
#

Makefile_LINUX

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ $(BIN)/tiff2cbf: $(LIB)/libcbf.a $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c
23012301
$(GOPTLIB) $(GOPTINC) $(TIFF)
23022302
mkdir -p $(BIN)
23032303
$(CC) $(CFLAGS) $(LDFLAGS) $(MISCFLAG) $(CBF_REGEXFLAG) $(INCLUDES) $(WARNINGS) \
2304-
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(GOPTLIB) -L$(LIB) \
2304+
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c $(GOPTLIB) -L$(LIB) \
23052305
-lcbf -L$(TIFF_PREFIX)/lib -ltiff $(REGEX_LIBS_STATIC) $(HDF5LIBS_LOCAL) $(EXTRALIBS) $(HDF5LIBS_SYSTEM) -limg -o $@
23062306

23072307
#

Makefile_MINGW

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2315,7 +2315,7 @@ $(BIN)/tiff2cbf: $(LIB)/libcbf.a $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c
23152315
$(GOPTLIB) $(GOPTINC) $(TIFF)
23162316
mkdir -p $(BIN)
23172317
$(CC) $(CFLAGS) $(LDFLAGS) $(MISCFLAG) $(CBF_REGEXFLAG) $(INCLUDES) $(WARNINGS) \
2318-
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(GOPTLIB) -L$(LIB) \
2318+
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c $(GOPTLIB) -L$(LIB) \
23192319
-lcbf -L$(TIFF_PREFIX)/lib -ltiff $(REGEX_LIBS_STATIC) $(HDF5LIBS_LOCAL) $(EXTRALIBS) $(HDF5LIBS_SYSTEM) -limg -o $@
23202320

23212321
#

Makefile_MSYS2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,7 @@ $(BIN)/tiff2cbf: $(LIB)/libcbf.a $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c
23002300
$(GOPTLIB) $(GOPTINC) $(TIFF)
23012301
mkdir -p $(BIN)
23022302
$(CC) $(CFLAGS) $(LDFLAGS) $(MISCFLAG) $(CBF_REGEXFLAG) $(INCLUDES) $(WARNINGS) \
2303-
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(GOPTLIB) -L$(LIB) \
2303+
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c $(GOPTLIB) -L$(LIB) \
23042304
-lcbf -L$(TIFF_PREFIX)/lib -ltiff $(REGEX_LIBS_STATIC) $(HDF5LIBS_LOCAL) $(EXTRALIBS) $(HDF5LIBS_SYSTEM) -limg -o $@
23052305

23062306
#

Makefile_OSX

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ $(BIN)/tiff2cbf: $(LIB)/libcbf.a $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c
22992299
$(GOPTLIB) $(GOPTINC) $(TIFF)
23002300
mkdir -p $(BIN)
23012301
$(CC) $(CFLAGS) $(LDFLAGS) $(MISCFLAG) $(CBF_REGEXFLAG) $(INCLUDES) $(WARNINGS) \
2302-
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(GOPTLIB) -L$(LIB) \
2302+
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c $(GOPTLIB) -L$(LIB) \
23032303
-lcbf -L$(TIFF_PREFIX)/lib -ltiff $(REGEX_LIBS_STATIC) $(HDF5LIBS_LOCAL) $(EXTRALIBS) $(HDF5LIBS_SYSTEM) -limg -o $@
23042304

23052305
#

examples/tif_sprint.c

Lines changed: 287 additions & 270 deletions
Large diffs are not rendered by default.

examples/tiff2cbf.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@
183183
#include <ctype.h>
184184
#include <time.h>
185185

186+
size_t
187+
cbf_TIFFSNPrintDirectory(TIFF* tif, char * str, const size_t xstrlen, long flags);
188+
186189
int local_exit(int);
187190

188191
int local_exit(int status) {
@@ -212,9 +215,9 @@ int main (int argc, char *argv [])
212215
TIFF *tif;
213216
cbf_handle cbf;
214217
clock_t a,b;
215-
uint32 width;
216-
uint32 height;
217-
uint32 npixels;
218+
uint32_t width;
219+
uint32_t height;
220+
uint32_t npixels;
218221
unsigned char * raster;
219222
char * tiffile;
220223
char * cbffile;
@@ -325,7 +328,7 @@ int main (int argc, char *argv [])
325328

326329
a = clock ();
327330

328-
if (!(tif=TIFFOpen(tiffile, "r"))) {
331+
if (!(tif=TIFFOpen(tiffile, "rC"))) {
329332

330333
fprintf(stderr,"tiff2cbf: unable to open tiff image %s, abort\n", tiffile);
331334
local_exit(-1);
@@ -364,7 +367,7 @@ int main (int argc, char *argv [])
364367
tstrip_t nstrips, strip;
365368
tsize_t stripsize;
366369
int elsize, elsign, real, plex, treturn;
367-
uint16 sampleformat, samplesperpixel, bitspersample, planarconfig;
370+
uint16_t sampleformat, samplesperpixel, bitspersample, planarconfig;
368371
size_t dimslow, dimmid, dimfast;
369372

370373
plex = 1;
@@ -391,12 +394,12 @@ int main (int argc, char *argv [])
391394
cbf_failnez (cbf_require_column (cbf, "binary_id"))
392395
cbf_failnez (cbf_set_integervalue (cbf, imageno))
393396
cbf_failnez (cbf_require_column (cbf, "header_contents"))
394-
headsize = 1+TIFFSNPrintDirectory(tif,buffer,0,TIFFPRINT_COLORMAP|TIFFPRINT_CURVES);
397+
headsize = 1+cbf_TIFFSNPrintDirectory(tif,buffer,0,TIFFPRINT_COLORMAP|TIFFPRINT_CURVES);
395398
headstring = (char *) _TIFFmalloc(headsize);
396399
if (!headstring) {
397400
cbf_failnez(CBF_ALLOC);
398401
}
399-
nheadsize = TIFFSNPrintDirectory(tif,headstring,headsize-1,TIFFPRINT_COLORMAP|TIFFPRINT_CURVES);
402+
nheadsize = cbf_TIFFSNPrintDirectory(tif,headstring,headsize-1,TIFFPRINT_COLORMAP|TIFFPRINT_CURVES);
400403
if (nheadsize > headsize-1) {
401404
_TIFFfree(headstring);
402405
cbf_failnez(CBF_ALLOC);

m4/Makefile.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,7 @@ $(BIN)/tiff2cbf: $(LIB)/libcbf.a $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c
26742674
$(GOPTLIB) $(GOPTINC) $(TIFF)
26752675
mkdir -p $(BIN)
26762676
$(CC) $(CFLAGS) $(LDFLAGS) $(MISCFLAG) $(CBF_REGEXFLAG) $(INCLUDES) $(WARNINGS) \
2677-
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(GOPTLIB) -L$(LIB) \
2677+
-I$(TIFF)/libtiff $(EXAMPLES)/tiff2cbf.c $(EXAMPLES)/tif_sprint.c $(GOPTLIB) -L$(LIB) \
26782678
-lcbf -L$(TIFF_PREFIX)/lib -ltiff $(REGEX_LIBS_STATIC) $(HDF5LIBS_LOCAL) $(EXTRALIBS) $(HDF5LIBS_SYSTEM) -limg -o $@
26792679

26802680
#
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--- a/XRD1621_orig.cbf
2+
+++ b/XRD1621_orig.cbf
3+
@@ -1,5 +1,5 @@
4+
###CBF: VERSION 1.7.11
5+
-# CBF file written by CBFlib v0.9.6
6+
+# CBF file written by CBFlib v0.9.7
7+
8+
data_image_1
9+

0 commit comments

Comments
 (0)