New upstream version 1.7.1~rc1
Bas Couwenberg
2 years ago
11 | 11 | |
12 | 12 | ############################################################################## |
13 | 13 | # CMake settings |
14 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) | |
14 | CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) | |
15 | 15 | |
16 | 16 | SET(CMAKE_COLOR_MAKEFILE ON) |
17 | 17 | |
18 | 18 | # Version information |
19 | 19 | set(PROJECT_VERSION_MAJOR 1) |
20 | 20 | set(PROJECT_VERSION_MINOR 7) |
21 | set(PROJECT_VERSION_PATCH 0) | |
21 | set(PROJECT_VERSION_PATCH 1) | |
22 | 22 | set(PROJECT_VERSION |
23 | 23 | "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") |
24 | 24 | set(GeoTIFF_VERSION ${PROJECT_VERSION}) |
28 | 28 | # libgeotiff.so.2 -> libgeotiff.so.2.2.0 |
29 | 29 | # libgeotiff.so.2.2.0 |
30 | 30 | set(LINK_SOVERSION "5") |
31 | set(LINK_VERSION "5.1.0") | |
31 | set(LINK_VERSION "5.2.0") | |
32 | 32 | |
33 | 33 | string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) |
34 | 34 | string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) |
52 | 52 | IF(CMAKE_BUILD_TYPE MATCHES Debug) |
53 | 53 | SET(GEOTIFF_BUILD_PEDANTIC TRUE) |
54 | 54 | ENDIF() |
55 | ||
56 | if (CMAKE_MAJOR_VERSION GREATER 2) | |
57 | cmake_policy(SET CMP0022 OLD) # interface link libraries | |
58 | cmake_policy(SET CMP0042 OLD) # osx rpath | |
59 | endif() | |
60 | ||
61 | 55 | |
62 | 56 | # TODO: Still testing the output paths --mloskot |
63 | 57 | SET(GEOTIFF_BUILD_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) |
102 | 96 | |
103 | 97 | # Check required standard headers |
104 | 98 | INCLUDE(CheckIncludeFiles) |
105 | CHECK_INCLUDE_FILES(stdio.h HAVE_STDIO_H) | |
106 | CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H) | |
107 | CHECK_INCLUDE_FILES(string.h HAVE_STRING_H) | |
108 | CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H) | |
99 | CHECK_INCLUDE_FILES(strings.h GEOTIFF_HAVE_STRINGS_H) | |
109 | 100 | |
110 | 101 | ############################################################################### |
111 | 102 | # User-defined build settings |
245 | 236 | |
246 | 237 | # ${PROJECT_BINARY_DIR}/geotiff_version.h |
247 | 238 | |
248 | IF(WIN32) | |
249 | SET(DEFAULT_LIB_SUBDIR lib) | |
250 | SET(DEFAULT_DATA_SUBDIR .) | |
251 | SET(DEFAULT_INCLUDE_SUBDIR include) | |
252 | ||
253 | IF(MSVC) | |
254 | SET(DEFAULT_BIN_SUBDIR bin) | |
255 | ELSE() | |
256 | SET(DEFAULT_BIN_SUBDIR .) | |
257 | ENDIF() | |
258 | ELSE() | |
259 | # Common locatoins for Unix and Mac OS X | |
260 | SET(DEFAULT_BIN_SUBDIR bin) | |
261 | SET(DEFAULT_LIB_SUBDIR lib) | |
262 | SET(DEFAULT_DATA_SUBDIR share) | |
263 | SET(DEFAULT_INCLUDE_SUBDIR include) | |
264 | ENDIF() | |
239 | SET(DEFAULT_BIN_SUBDIR bin) | |
240 | SET(DEFAULT_LIB_SUBDIR lib) | |
241 | SET(DEFAULT_INCLUDE_SUBDIR include) | |
265 | 242 | |
266 | 243 | # Locations are changeable by user to customize layout of GeoTIFF installation |
267 | 244 | # (default values are platform-specIFic) |
271 | 248 | "Subdirectory where libraries will be installed") |
272 | 249 | SET(GEOTIFF_INCLUDE_SUBDIR ${DEFAULT_INCLUDE_SUBDIR} CACHE STRING |
273 | 250 | "Subdirectory where header files will be installed") |
274 | SET(GEOTIFF_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING | |
275 | "Subdirectory where data will be installed") | |
276 | 251 | |
277 | 252 | # Mark *_SUBDIR variables as advanced and dedicated to use by power-users only. |
278 | MARK_AS_ADVANCED(GEOTIFF_BIN_SUBDIR GEOTIFF_LIB_SUBDIR GEOTIFF_INCLUDE_SUBDIR GEOTIFF_DATA_SUBDIR) | |
253 | MARK_AS_ADVANCED(GEOTIFF_BIN_SUBDIR GEOTIFF_LIB_SUBDIR GEOTIFF_INCLUDE_SUBDIR) | |
279 | 254 | |
280 | 255 | # Full paths for the installation |
281 | 256 | SET(GEOTIFF_BIN_DIR ${GEOTIFF_BIN_SUBDIR}) |
282 | 257 | SET(GEOTIFF_LIB_DIR ${GEOTIFF_LIB_SUBDIR}) |
283 | 258 | SET(GEOTIFF_INCLUDE_DIR ${GEOTIFF_INCLUDE_SUBDIR}) |
284 | SET(GEOTIFF_DATA_DIR ${GEOTIFF_DATA_SUBDIR}) | |
285 | 259 | |
286 | 260 | # Install doc files |
287 | 261 | INSTALL(FILES |
288 | 262 | AUTHORS ChangeLog COPYING INSTALL LICENSE README README_BIN README.WIN |
289 | 263 | DESTINATION doc) |
290 | # DESTINATION ${GEOTIFF_DATA_DIR}/doc) | |
291 | 264 | |
292 | 265 | # Install man pages |
293 | 266 | INSTALL(FILES ${GEOTIFF_MAN_PAGES} DESTINATION share/man/man1) |
294 | 267 | |
295 | 268 | |
296 | 269 | # Install header files for development distribution |
297 | # INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION ${GEOTIFF_INCLUDE_DIR}) | |
298 | INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION include) | |
270 | INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION ${GEOTIFF_INCLUDE_DIR}) | |
299 | 271 | |
300 | 272 | ############################################################################### |
301 | 273 | # Build libxtiff library |
337 | 309 | ENDIF(WIN32 AND MSVC) |
338 | 310 | |
339 | 311 | # Unix, linux: |
340 | IF(UNIX) | |
312 | if(UNIX) | |
341 | 313 | SET_TARGET_PROPERTIES( |
342 | 314 | ${GEOTIFF_LIBRARY_TARGET} |
343 | 315 | PROPERTIES |
344 | OUTPUT_NAME ${GEOTIFF_LIB_NAME} | |
345 | 316 | VERSION ${LINK_VERSION} |
346 | 317 | SOVERSION ${LINK_SOVERSION} |
347 | 318 | CLEAN_DIRECT_OUTPUT 1 ) |
349 | 320 | set_target_properties( |
350 | 321 | ${GEOTIFF_LIBRARY_TARGET} |
351 | 322 | PROPERTIES |
352 | INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") | |
323 | INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${GEOTIFF_LIB_DIR}") | |
353 | 324 | endif() |
354 | ||
355 | ELSE(UNIX) | |
356 | # Default: | |
357 | SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES | |
358 | OUTPUT_NAME ${GEOTIFF_LIB_NAME}) | |
359 | ENDIF(UNIX) | |
325 | endif() | |
360 | 326 | |
361 | 327 | SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES |
362 | 328 | OUTPUT_NAME ${GEOTIFF_LIB_NAME}) |
363 | 329 | |
364 | TARGET_LINK_LIBRARIES(${GEOTIFF_LIBRARY_TARGET} | |
365 | ${TIFF_LIBRARIES} | |
366 | ${PROJ_LIBRARIES} | |
367 | ${ZLIB_LIBRARIES} | |
368 | ${JPEG_LIBRARIES}) | |
369 | ||
370 | # INSTALL(TARGETS ${GEOTIFF_ARCHIVE_TARGET} ${GEOTIFF_LIBRARY_TARGET} | |
371 | # RUNTIME DESTINATION ${GEOTIFF_BIN_DIR} | |
372 | # LIBRARY DESTINATION ${GEOTIFF_LIB_DIR} | |
373 | # ARCHIVE DESTINATION ${GEOTIFF_LIB_DIR}) | |
330 | if(TARGET TIFF::TIFF) | |
331 | target_link_libraries(${GEOTIFF_LIBRARY_TARGET} PUBLIC TIFF::TIFF) | |
332 | else() | |
333 | target_link_libraries(${GEOTIFF_LIBRARY_TARGET} PUBLIC | |
334 | ${TIFF_LIBRARIES}) | |
335 | endif() | |
336 | ||
337 | if(TARGET PROJ::proj) | |
338 | target_link_libraries(${GEOTIFF_LIBRARY_TARGET} PRIVATE PROJ::proj) | |
339 | else() | |
340 | target_link_libraries(${GEOTIFF_LIBRARY_TARGET} PRIVATE | |
341 | ${PROJ_LIBRARIES}) | |
342 | endif() | |
343 | ||
344 | target_include_directories( | |
345 | ${GEOTIFF_LIBRARY_TARGET} | |
346 | PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> | |
347 | $<INSTALL_INTERFACE:${GEOTIFF_INCLUDE_DIR}>) | |
374 | 348 | |
375 | 349 | INSTALL( TARGETS ${GEOTIFF_LIBRARY_TARGET} |
376 | EXPORT depends | |
377 | RUNTIME DESTINATION bin | |
378 | LIBRARY DESTINATION lib | |
379 | ARCHIVE DESTINATION lib ) | |
350 | EXPORT depends | |
351 | RUNTIME DESTINATION ${GEOTIFF_BIN_DIR} | |
352 | LIBRARY DESTINATION ${GEOTIFF_LIB_DIR} | |
353 | PUBLIC_HEADER DESTINATION ${GEOTIFF_INCLUDE_DIR} | |
354 | ARCHIVE DESTINATION ${GEOTIFF_LIB_DIR} ) | |
380 | 355 | |
381 | 356 | # Define grouping of source files in PROJECT file (e.g. Visual Studio) |
382 | 357 | SOURCE_GROUP("CMake Files" FILES CMakeLists.txt) |
2 | 2 | ==================== |
3 | 3 | |
4 | 4 | All the source code in this toolkit are either in the public domain, or under |
5 | an X style license. In any event it is all considered to be free to use | |
5 | the MIT License. In any event it is all considered to be free to use | |
6 | 6 | for any purpose (including commercial software). No credit is required |
7 | 7 | though some of the code requires that the specific source code modules |
8 | 8 | retain their existing copyright statements. In |
52 | 52 | geo_strtod.c \ |
53 | 53 | geotiff_proj4.c |
54 | 54 | |
55 | libgeotiff_la_LDFLAGS = -version-info 7:0:2 ${NOUNDEFINED} | |
55 | libgeotiff_la_LDFLAGS = -version-info 7:1:2 ${NOUNDEFINED} | |
56 | 56 | |
57 | 57 | libgeotiff_la_LIBADD = libxtiff/libxtiff.la |
58 | 58 |
0 | libgeotiff 1.7.1 | |
1 | ---------------- | |
2 | ||
3 | * geotiff.h: more precise signature for GTIFDirectoryInfo() | |
4 | * applygeo.c/geotifcp.c: use uint16/32_t instead of old libtiff non _t custom types | |
5 | * Bump CMake min to 3.0.0 and remove apparently unneeded cmake_policy() declarations | |
6 | * CMake: remove libjpeg and libz from linking of libgeotiff itself. | |
7 | * geo_config.h: prefix HAVE_xxx and restrict it to GEOTIFF_HAVE_STRINGS_H (fixes #61) | |
8 | * GTIFPrintDefn(): avoid potential nullptr deref. CID 1469240 | |
9 | * CMake: use variable for installation subdirectories, and make sure INTERFACE_INCLUDE_DIRECTORIES is exported (fixes #67) | |
10 | * ReadKey(): only allow reading a key with TIFFTagLocation=0 that has a count of 1 to avoid reading an illegal address (and crashing) when using GTIFKeyGet() or PrintKey() (fixes #66) | |
11 | * ReadKey(): add extra warning messages | |
12 | * CMake: avoid INTERFACE_LINK_LIBRARIES vs LINK_INTERFACE_LIBRARIES_DEBUG warning about TIFF | |
13 | ||
0 | 14 | libgeotiff 1.7.0 |
1 | 15 | ---------------- |
2 | 16 |
21 | 21 | |
22 | 22 | FOREACH(utility ${GEOTIFF_UTILITIES}) |
23 | 23 | ADD_EXECUTABLE(${utility} ${utility}.c ${GETOPT_SOURCE}) |
24 | TARGET_LINK_LIBRARIES(${utility} xtiff ${GEOTIFF_LIBRARY_TARGET}) | |
24 | TARGET_LINK_LIBRARIES(${utility} PRIVATE xtiff ${GEOTIFF_LIBRARY_TARGET}) | |
25 | 25 | ENDFOREACH() |
26 | 26 | |
27 | 27 | ADD_EXECUTABLE(geotifcp geotifcp.c ${GETOPT_SOURCE}) |
28 | 28 | TARGET_LINK_LIBRARIES(geotifcp |
29 | PRIVATE | |
29 | 30 | xtiff |
30 | 31 | ${GEOTIFF_LIBRARY_TARGET} |
31 | 32 | ${JPEG_LIBRARIES} |
0 | 0 | /* applygeo.c */ |
1 | #include <stdint.h> | |
1 | 2 | #include <stdlib.h> |
2 | 3 | #include "geotiff.h" |
3 | 4 | #include "xtiffio.h" |
9 | 10 | GTIF *gtif; /* GeoKey-level descriptor */ |
10 | 11 | FILE *fp; |
11 | 12 | |
12 | uint16 *panVI = NULL; | |
13 | uint16 nKeyCount; | |
13 | uint16_t *panVI = NULL; | |
14 | uint16_t nKeyCount; | |
14 | 15 | |
15 | 16 | tif = XTIFFOpen(tiffile, "r+"); |
16 | 17 | if (!tif) |
27 | 28 | if( TIFFGetField( tif, TIFFTAG_GEOKEYDIRECTORY, |
28 | 29 | &nKeyCount, &panVI ) ) |
29 | 30 | { |
30 | uint16 anGKVersionInfo[4] = { 1, 1, 0, 0 }; | |
31 | uint16_t anGKVersionInfo[4] = { 1, 1, 0, 0 }; | |
31 | 32 | double adfDummyDoubleParams[1] = { 0.0 }; |
32 | 33 | |
33 | 34 | TIFFSetField( tif, TIFFTAG_GEOKEYDIRECTORY, |
8 | 8 | * and a lot of legal stuff denying liability for anything. |
9 | 9 | */ |
10 | 10 | |
11 | #include <stdint.h> | |
11 | 12 | #include <stdio.h> |
12 | 13 | #include <stdlib.h> |
13 | 14 | #include <string.h> |
38 | 39 | int getopt(); |
39 | 40 | |
40 | 41 | static int outtiled = -1; |
41 | static uint32 tilewidth; | |
42 | static uint32 tilelength; | |
42 | static uint32_t tilewidth; | |
43 | static uint32_t tilelength; | |
43 | 44 | static int convert_8_to_4 = 0; |
44 | 45 | |
45 | static uint16 config; | |
46 | static uint16 compression; | |
47 | static uint16 predictor; | |
48 | static uint16 fillorder; | |
49 | static uint32 rowsperstrip; | |
50 | static uint32 g3opts; | |
46 | static uint16_t config; | |
47 | static uint16_t compression; | |
48 | static uint16_t predictor; | |
49 | static uint16_t fillorder; | |
50 | static uint32_t rowsperstrip; | |
51 | static uint32_t g3opts; | |
51 | 52 | static int ignore = FALSE; /* if true, ignore read errors */ |
52 | static uint32 defg3opts = (uint32) -1; | |
53 | static uint32_t defg3opts = (uint32_t) -1; | |
53 | 54 | static int quality = 75; /* JPEG quality */ |
54 | 55 | static int jpegcolormode = JPEGCOLORMODE_RGB; |
55 | static uint16 defcompression = (uint16) -1; | |
56 | static uint16 defpredictor = (uint16) -1; | |
56 | static uint16_t defcompression = (uint16_t) -1; | |
57 | static uint16_t defpredictor = (uint16_t) -1; | |
57 | 58 | static char *geofile=(char *)0; |
58 | 59 | static char *proj4_string = (char *) 0; |
59 | 60 | static char *worldfile=(char *)0; |
96 | 97 | int |
97 | 98 | main(int argc, char* argv[]) |
98 | 99 | { |
99 | uint16 defconfig = (uint16) -1; | |
100 | uint16 deffillorder = 0; | |
101 | uint32 deftilewidth = (uint32) -1; | |
102 | uint32 deftilelength = (uint32) -1; | |
103 | uint32 defrowsperstrip = (uint32) -1; | |
104 | uint32 diroff = 0; | |
100 | uint16_t defconfig = (uint16_t) -1; | |
101 | uint16_t deffillorder = 0; | |
102 | uint32_t deftilewidth = (uint32_t) -1; | |
103 | uint32_t deftilelength = (uint32_t) -1; | |
104 | uint32_t defrowsperstrip = (uint32_t) -1; | |
105 | uint32_t diroff = 0; | |
105 | 106 | TIFF* in; |
106 | 107 | TIFF* out; |
107 | 108 | char mode[10]; |
344 | 345 | { |
345 | 346 | GTIF *gtif; /* GeoKey-level descriptor */ |
346 | 347 | double *d_list = NULL; |
347 | int16 d_list_count; | |
348 | int16_t d_list_count; | |
348 | 349 | |
349 | 350 | /* read definition from source file. */ |
350 | 351 | gtif = GTIFNew(in); |
375 | 376 | processG3Options(char* cp) |
376 | 377 | { |
377 | 378 | if( (cp = strchr(cp, ':')) != NULL ) { |
378 | if (defg3opts == (uint32) -1) | |
379 | if (defg3opts == (uint32_t) -1) | |
379 | 380 | defg3opts = 0; |
380 | 381 | do { |
381 | 382 | cp++; |
487 | 488 | } |
488 | 489 | |
489 | 490 | static void |
490 | CheckAndCorrectColormap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b) | |
491 | CheckAndCorrectColormap(TIFF* tif, int n, uint16_t* r, uint16_t* g, uint16_t* b) | |
491 | 492 | { |
492 | 493 | int i; |
493 | 494 | |
514 | 515 | if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4) |
515 | 516 | |
516 | 517 | static struct cpTag { |
517 | uint16 tag; | |
518 | uint16 count; | |
518 | uint16_t tag; | |
519 | uint16_t count; | |
519 | 520 | TIFFDataType type; |
520 | 521 | } tags[] = { |
521 | 522 | { TIFFTAG_SUBFILETYPE, 1, TIFF_LONG }, |
539 | 540 | { TIFFTAG_DATETIME, 1, TIFF_ASCII }, |
540 | 541 | { TIFFTAG_ARTIST, 1, TIFF_ASCII }, |
541 | 542 | { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII }, |
542 | { TIFFTAG_WHITEPOINT, (uint16) -1,TIFF_RATIONAL }, | |
543 | { TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL }, | |
543 | { TIFFTAG_WHITEPOINT, (uint16_t) -1,TIFF_RATIONAL }, | |
544 | { TIFFTAG_PRIMARYCHROMATICITIES,(uint16_t) -1,TIFF_RATIONAL }, | |
544 | 545 | { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT }, |
545 | 546 | { TIFFTAG_BADFAXLINES, 1, TIFF_LONG }, |
546 | 547 | { TIFFTAG_CLEANFAXDATA, 1, TIFF_SHORT }, |
550 | 551 | { TIFFTAG_DOTRANGE, 2, TIFF_SHORT }, |
551 | 552 | { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII }, |
552 | 553 | { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT }, |
553 | { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL }, | |
554 | { TIFFTAG_YCBCRCOEFFICIENTS, (uint16_t) -1,TIFF_RATIONAL }, | |
554 | 555 | { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT }, |
555 | 556 | { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT }, |
556 | { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL }, | |
557 | { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT }, | |
557 | { TIFFTAG_REFERENCEBLACKWHITE, (uint16_t) -1,TIFF_RATIONAL }, | |
558 | { TIFFTAG_EXTRASAMPLES, (uint16_t) -1, TIFF_SHORT }, | |
558 | 559 | { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE }, |
559 | 560 | { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE }, |
560 | 561 | }; |
569 | 570 | switch (p->type) { |
570 | 571 | case TIFF_SHORT: |
571 | 572 | if (p->count == 1) { |
572 | uint16 shortv; | |
573 | uint16_t shortv; | |
573 | 574 | CopyField(p->tag, shortv); |
574 | 575 | } else if (p->count == 2) { |
575 | uint16 shortv1, shortv2; | |
576 | uint16_t shortv1, shortv2; | |
576 | 577 | CopyField2(p->tag, shortv1, shortv2); |
577 | } else if (p->count == (uint16) -1) { | |
578 | uint16 shortv1; | |
579 | uint16* shortav; | |
578 | } else if (p->count == (uint16_t) -1) { | |
579 | uint16_t shortv1; | |
580 | uint16_t* shortav; | |
580 | 581 | CopyField2(p->tag, shortv1, shortav); |
581 | 582 | } |
582 | 583 | break; |
583 | 584 | case TIFF_LONG: |
584 | { uint32 longv; | |
585 | { uint32_t longv; | |
585 | 586 | CopyField(p->tag, longv); |
586 | 587 | } |
587 | 588 | break; |
589 | 590 | if (p->count == 1) { |
590 | 591 | float floatv; |
591 | 592 | CopyField(p->tag, floatv); |
592 | } else if (p->count == (uint16) -1) { | |
593 | } else if (p->count == (uint16_t) -1) { | |
593 | 594 | float* floatav; |
594 | 595 | CopyField(p->tag, floatav); |
595 | 596 | } |
603 | 604 | if (p->count == 1) { |
604 | 605 | double doublev; |
605 | 606 | CopyField(p->tag, doublev); |
606 | } else if (p->count == (uint16) -1) { | |
607 | } else if (p->count == (uint16_t) -1) { | |
607 | 608 | double* doubleav; |
608 | 609 | CopyField(p->tag, doubleav); |
609 | 610 | } |
614 | 615 | } |
615 | 616 | |
616 | 617 | typedef int (*copyFunc) |
617 | (TIFF* in, TIFF* out, uint32 l, uint32 w, uint16 samplesperpixel); | |
618 | static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16); | |
618 | (TIFF* in, TIFF* out, uint32_t l, uint32_t w, uint16_t samplesperpixel); | |
619 | static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16_t, uint16_t); | |
619 | 620 | |
620 | 621 | static int |
621 | 622 | tiffcp(TIFF* in, TIFF* out) |
622 | 623 | { |
623 | uint16 bitspersample = 0, samplesperpixel, shortv; | |
624 | uint16_t bitspersample = 0, samplesperpixel, shortv; | |
624 | 625 | copyFunc cf; |
625 | uint32 w, l; | |
626 | uint32_t w, l; | |
626 | 627 | |
627 | 628 | CopyField(TIFFTAG_IMAGEWIDTH, w); |
628 | 629 | CopyField(TIFFTAG_IMAGELENGTH, l); |
634 | 635 | { |
635 | 636 | CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample); |
636 | 637 | } |
637 | if (compression != (uint16)-1) | |
638 | if (compression != (uint16_t)-1) | |
638 | 639 | TIFFSetField(out, TIFFTAG_COMPRESSION, compression); |
639 | 640 | else |
640 | 641 | CopyField(TIFFTAG_COMPRESSION, compression); |
661 | 662 | * input image or, if nothing is defined, use the |
662 | 663 | * library default. |
663 | 664 | */ |
664 | if (tilewidth == (uint32) -1) | |
665 | if (tilewidth == (uint32_t) -1) | |
665 | 666 | TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth); |
666 | if (tilelength == (uint32) -1) | |
667 | if (tilelength == (uint32_t) -1) | |
667 | 668 | TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength); |
668 | 669 | TIFFDefaultTileSize(out, &tilewidth, &tilelength); |
669 | 670 | TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth); |
674 | 675 | * value from the input image or, if nothing is defined, |
675 | 676 | * use the library default. |
676 | 677 | */ |
677 | if (rowsperstrip == (uint32) -1) | |
678 | if (rowsperstrip == (uint32_t) -1) | |
678 | 679 | TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); |
679 | 680 | rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip); |
680 | 681 | TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip); |
681 | 682 | } |
682 | if (config != (uint16) -1) | |
683 | if (config != (uint16_t) -1) | |
683 | 684 | TIFFSetField(out, TIFFTAG_PLANARCONFIG, config); |
684 | 685 | else |
685 | 686 | CopyField(TIFFTAG_PLANARCONFIG, config); |
686 | if (g3opts != (uint32) -1) | |
687 | if (g3opts != (uint32_t) -1) | |
687 | 688 | TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts); |
688 | 689 | else |
689 | 690 | CopyField(TIFFTAG_GROUP3OPTIONS, g3opts); |
690 | 691 | if (samplesperpixel <= 4) { |
691 | uint16 *tr, *tg, *tb, *ta; | |
692 | uint16_t *tr, *tg, *tb, *ta; | |
692 | 693 | CopyField4(TIFFTAG_TRANSFERFUNCTION, tr, tg, tb, ta); |
693 | 694 | } |
694 | { uint16 *red, *green, *blue; | |
695 | { uint16_t *red, *green, *blue; | |
695 | 696 | if (TIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue)) { |
696 | 697 | CheckAndCorrectColormap(in, 1<<bitspersample, red, green, blue); |
697 | 698 | TIFFSetField(out, TIFFTAG_COLORMAP, red, green, blue); |
705 | 706 | break; |
706 | 707 | case COMPRESSION_LZW: |
707 | 708 | case COMPRESSION_DEFLATE: |
708 | if (predictor != (uint16)-1) | |
709 | if (predictor != (uint16_t)-1) | |
709 | 710 | TIFFSetField(out, TIFFTAG_PREDICTOR, predictor); |
710 | 711 | else |
711 | 712 | CopyField(TIFFTAG_PREDICTOR, predictor); |
730 | 731 | */ |
731 | 732 | #define DECLAREcpFunc(x) \ |
732 | 733 | static int x(TIFF* in, TIFF* out, \ |
733 | uint32 imagelength, uint32 imagewidth, tsample_t spp) | |
734 | uint32_t imagelength, uint32_t imagewidth, tsample_t spp) | |
734 | 735 | |
735 | 736 | #define DECLAREreadFunc(x) \ |
736 | 737 | static void x(TIFF* in, \ |
737 | unsigned char* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp) | |
738 | typedef void (*readFunc)(TIFF*, unsigned char*, uint32, uint32, tsample_t); | |
738 | unsigned char* buf, uint32_t imagelength, uint32_t imagewidth, tsample_t spp) | |
739 | typedef void (*readFunc)(TIFF*, unsigned char*, uint32_t, uint32_t, tsample_t); | |
739 | 740 | |
740 | 741 | #define DECLAREwriteFunc(x) \ |
741 | 742 | static int x(TIFF* out, \ |
742 | unsigned char* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp) | |
743 | typedef int (*writeFunc)(TIFF*, unsigned char*, uint32, uint32, tsample_t); | |
743 | unsigned char* buf, uint32_t imagelength, uint32_t imagewidth, tsample_t spp) | |
744 | typedef int (*writeFunc)(TIFF*, unsigned char*, uint32_t, uint32_t, tsample_t); | |
744 | 745 | |
745 | 746 | /* |
746 | 747 | * Contig -> contig by scanline for rows/strip change. |
748 | 749 | DECLAREcpFunc(cpContig2ContigByRow) |
749 | 750 | { |
750 | 751 | unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in)); |
751 | uint32 row; | |
752 | uint32_t row; | |
752 | 753 | |
753 | 754 | (void) imagewidth; (void) spp; |
754 | 755 | for (row = 0; row < imagelength; row++) { |
772 | 773 | { |
773 | 774 | unsigned char *buf_in = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in)); |
774 | 775 | unsigned char *buf_out = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out)); |
775 | uint32 row; | |
776 | uint32_t row; | |
776 | 777 | |
777 | 778 | printf( "Downsample\n" ); |
778 | 779 | |
815 | 816 | (void) imagewidth; (void) spp; |
816 | 817 | if (buf) { |
817 | 818 | tstrip_t s, ns = TIFFNumberOfStrips(in); |
818 | uint32 row = 0; | |
819 | uint32_t row = 0; | |
819 | 820 | for (s = 0; s < ns; s++) { |
820 | 821 | tsize_t cc = (row + rowsperstrip > imagelength) ? |
821 | 822 | TIFFVStripSize(in, imagelength - row) : stripsize; |
839 | 840 | DECLAREcpFunc(cpSeparate2SeparateByRow) |
840 | 841 | { |
841 | 842 | unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in)); |
842 | uint32 row; | |
843 | uint32_t row; | |
843 | 844 | tsample_t s; |
844 | 845 | |
845 | 846 | (void) imagewidth; |
867 | 868 | unsigned char *inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in)); |
868 | 869 | unsigned char *outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out)); |
869 | 870 | register unsigned char *inp, *outp; |
870 | register uint32 n; | |
871 | uint32 row; | |
871 | register uint32_t n; | |
872 | uint32_t row; | |
872 | 873 | tsample_t s; |
873 | 874 | |
874 | 875 | /* unpack channels */ |
904 | 905 | unsigned char *inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in)); |
905 | 906 | unsigned char *outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out)); |
906 | 907 | register unsigned char *inp, *outp; |
907 | register uint32 n; | |
908 | uint32 row; | |
908 | register uint32_t n; | |
909 | uint32_t row; | |
909 | 910 | tsample_t s; |
910 | 911 | |
911 | 912 | for (row = 0; row < imagelength; row++) { |
935 | 936 | |
936 | 937 | static void |
937 | 938 | cpStripToTile(unsigned char* out, unsigned char* in, |
938 | uint32 rows, uint32 cols, int outskew, int inskew) | |
939 | uint32_t rows, uint32_t cols, int outskew, int inskew) | |
939 | 940 | { |
940 | 941 | while (rows-- > 0) { |
941 | uint32 j = cols; | |
942 | uint32_t j = cols; | |
942 | 943 | while (j-- > 0) |
943 | 944 | *out++ = *in++; |
944 | 945 | out += outskew; |
948 | 949 | |
949 | 950 | static void |
950 | 951 | cpContigBufToSeparateBuf(unsigned char* out, unsigned char* in, |
951 | uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp) | |
952 | uint32_t rows, uint32_t cols, int outskew, int inskew, tsample_t spp) | |
952 | 953 | { |
953 | 954 | while (rows-- > 0) { |
954 | uint32 j = cols; | |
955 | uint32_t j = cols; | |
955 | 956 | while (j-- > 0) |
956 | 957 | *out++ = *in, in += spp; |
957 | 958 | out += outskew; |
961 | 962 | |
962 | 963 | static void |
963 | 964 | cpSeparateBufToContigBuf(unsigned char* out, unsigned char* in, |
964 | uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp) | |
965 | uint32_t rows, uint32_t cols, int outskew, int inskew, tsample_t spp) | |
965 | 966 | { |
966 | 967 | while (rows-- > 0) { |
967 | uint32 j = cols; | |
968 | uint32_t j = cols; | |
968 | 969 | while (j-- > 0) |
969 | 970 | *out = *in++, out += spp; |
970 | 971 | out += outskew; |
974 | 975 | |
975 | 976 | static int |
976 | 977 | cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout, |
977 | uint32 imagelength, uint32 imagewidth, tsample_t spp) | |
978 | uint32_t imagelength, uint32_t imagewidth, tsample_t spp) | |
978 | 979 | { |
979 | 980 | int status = FALSE; |
980 | 981 | unsigned char* buf = (unsigned char *) |
991 | 992 | { |
992 | 993 | tsize_t scanlinesize = TIFFScanlineSize(in); |
993 | 994 | unsigned char *bufp = buf; |
994 | uint32 row; | |
995 | uint32_t row; | |
995 | 996 | |
996 | 997 | (void) imagewidth; (void) spp; |
997 | 998 | for (row = 0; row < imagelength; row++) { |
1009 | 1010 | (void) imagewidth; |
1010 | 1011 | if (scanline) { |
1011 | 1012 | unsigned char *bufp = buf; |
1012 | uint32 row; | |
1013 | uint32_t row; | |
1013 | 1014 | tsample_t s; |
1014 | 1015 | |
1015 | 1016 | for (row = 0; row < imagelength; row++) { |
1034 | 1035 | DECLAREreadFunc(readContigTilesIntoBuffer) |
1035 | 1036 | { |
1036 | 1037 | unsigned char* tilebuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(in)); |
1037 | uint32 imagew = TIFFScanlineSize(in); | |
1038 | uint32 tilew = TIFFTileRowSize(in); | |
1038 | uint32_t imagew = TIFFScanlineSize(in); | |
1039 | uint32_t tilew = TIFFTileRowSize(in); | |
1039 | 1040 | int iskew = imagew - tilew; |
1040 | 1041 | unsigned char *bufp = buf; |
1041 | uint32 tw, tl; | |
1042 | uint32 row; | |
1042 | uint32_t tw, tl; | |
1043 | uint32_t row; | |
1043 | 1044 | |
1044 | 1045 | (void) spp; |
1045 | 1046 | if (tilebuf == 0) |
1047 | 1048 | (void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw); |
1048 | 1049 | (void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl); |
1049 | 1050 | for (row = 0; row < imagelength; row += tl) { |
1050 | uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1051 | uint32 colb = 0; | |
1052 | uint32 col; | |
1051 | uint32_t nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1052 | uint32_t colb = 0; | |
1053 | uint32_t col; | |
1053 | 1054 | |
1054 | 1055 | for (col = 0; col < imagewidth; col += tw) { |
1055 | 1056 | if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0 && |
1056 | 1057 | !ignore) |
1057 | 1058 | goto done; |
1058 | 1059 | if (colb + tilew > imagew) { |
1059 | uint32 width = imagew - colb; | |
1060 | uint32 oskew = tilew - width; | |
1060 | uint32_t width = imagew - colb; | |
1061 | uint32_t oskew = tilew - width; | |
1061 | 1062 | cpStripToTile(bufp + colb, |
1062 | 1063 | tilebuf, nrow, width, |
1063 | 1064 | oskew + iskew, oskew); |
1075 | 1076 | |
1076 | 1077 | DECLAREreadFunc(readSeparateTilesIntoBuffer) |
1077 | 1078 | { |
1078 | uint32 imagew = TIFFScanlineSize(in); | |
1079 | uint32 tilew = TIFFTileRowSize(in); | |
1079 | uint32_t imagew = TIFFScanlineSize(in); | |
1080 | uint32_t tilew = TIFFTileRowSize(in); | |
1080 | 1081 | int iskew = imagew - tilew; |
1081 | 1082 | unsigned char* tilebuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(in)); |
1082 | 1083 | unsigned char *bufp = buf; |
1083 | uint32 tw, tl; | |
1084 | uint32 row; | |
1084 | uint32_t tw, tl; | |
1085 | uint32_t row; | |
1085 | 1086 | |
1086 | 1087 | if (tilebuf == 0) |
1087 | 1088 | return; |
1088 | 1089 | (void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw); |
1089 | 1090 | (void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl); |
1090 | 1091 | for (row = 0; row < imagelength; row += tl) { |
1091 | uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1092 | uint32 colb = 0; | |
1093 | uint32 col; | |
1092 | uint32_t nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1093 | uint32_t colb = 0; | |
1094 | uint32_t col; | |
1094 | 1095 | |
1095 | 1096 | for (col = 0; col < imagewidth; col += tw) { |
1096 | 1097 | tsample_t s; |
1103 | 1104 | * visible portion and skewing factors. |
1104 | 1105 | */ |
1105 | 1106 | if (colb + tilew > imagew) { |
1106 | uint32 width = imagew - colb; | |
1107 | uint32_t width = imagew - colb; | |
1107 | 1108 | int oskew = tilew - width; |
1108 | 1109 | cpSeparateBufToContigBuf(bufp+colb+s, |
1109 | 1110 | tilebuf, nrow, width, |
1124 | 1125 | DECLAREwriteFunc(writeBufferToContigStrips) |
1125 | 1126 | { |
1126 | 1127 | tsize_t scanline = TIFFScanlineSize(out); |
1127 | uint32 row; | |
1128 | uint32_t row; | |
1128 | 1129 | |
1129 | 1130 | (void) imagewidth; (void) spp; |
1130 | 1131 | for (row = 0; row < imagelength; row++) { |
1143 | 1144 | if (obuf == NULL) |
1144 | 1145 | return (0); |
1145 | 1146 | for (s = 0; s < spp; s++) { |
1146 | uint32 row; | |
1147 | uint32_t row; | |
1147 | 1148 | for (row = 0; row < imagelength; row++) { |
1148 | 1149 | unsigned char* inp = buf + s; |
1149 | 1150 | unsigned char* outp = obuf; |
1150 | uint32 n = imagewidth; | |
1151 | uint32_t n = imagewidth; | |
1151 | 1152 | |
1152 | 1153 | while (n-- > 0) |
1153 | 1154 | *outp++ = *inp, inp += spp; |
1164 | 1165 | |
1165 | 1166 | DECLAREwriteFunc(writeBufferToContigTiles) |
1166 | 1167 | { |
1167 | uint32 imagew = TIFFScanlineSize(out); | |
1168 | uint32 tilew = TIFFTileRowSize(out); | |
1168 | uint32_t imagew = TIFFScanlineSize(out); | |
1169 | uint32_t tilew = TIFFTileRowSize(out); | |
1169 | 1170 | int iskew = imagew - tilew; |
1170 | 1171 | unsigned char* obuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(out)); |
1171 | 1172 | unsigned char* bufp = buf; |
1172 | uint32 tl, tw; | |
1173 | uint32 row; | |
1173 | uint32_t tl, tw; | |
1174 | uint32_t row; | |
1174 | 1175 | |
1175 | 1176 | (void) spp; |
1176 | 1177 | if (obuf == NULL) |
1178 | 1179 | (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl); |
1179 | 1180 | (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw); |
1180 | 1181 | for (row = 0; row < imagelength; row += tilelength) { |
1181 | uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1182 | uint32 colb = 0; | |
1183 | uint32 col; | |
1182 | uint32_t nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1183 | uint32_t colb = 0; | |
1184 | uint32_t col; | |
1184 | 1185 | |
1185 | 1186 | for (col = 0; col < imagewidth; col += tw) { |
1186 | 1187 | /* |
1188 | 1189 | * visible portion and skewing factors. |
1189 | 1190 | */ |
1190 | 1191 | if (colb + tilew > imagew) { |
1191 | uint32 width = imagew - colb; | |
1192 | uint32_t width = imagew - colb; | |
1192 | 1193 | int oskew = tilew - width; |
1193 | 1194 | cpStripToTile(obuf, bufp + colb, nrow, width, |
1194 | 1195 | oskew, oskew + iskew); |
1209 | 1210 | |
1210 | 1211 | DECLAREwriteFunc(writeBufferToSeparateTiles) |
1211 | 1212 | { |
1212 | uint32 imagew = TIFFScanlineSize(out); | |
1213 | uint32_t imagew = TIFFScanlineSize(out); | |
1213 | 1214 | tsize_t tilew = TIFFTileRowSize(out); |
1214 | 1215 | int iskew = imagew - tilew; |
1215 | 1216 | unsigned char *obuf = (unsigned char*) _TIFFmalloc(TIFFTileSize(out)); |
1216 | 1217 | unsigned char *bufp = buf; |
1217 | uint32 tl, tw; | |
1218 | uint32 row; | |
1218 | uint32_t tl, tw; | |
1219 | uint32_t row; | |
1219 | 1220 | |
1220 | 1221 | if (obuf == NULL) |
1221 | 1222 | return (FALSE); |
1222 | 1223 | (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl); |
1223 | 1224 | (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw); |
1224 | 1225 | for (row = 0; row < imagelength; row += tl) { |
1225 | uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1226 | uint32 colb = 0; | |
1227 | uint32 col; | |
1226 | uint32_t nrow = (row+tl > imagelength) ? imagelength-row : tl; | |
1227 | uint32_t colb = 0; | |
1228 | uint32_t col; | |
1228 | 1229 | |
1229 | 1230 | for (col = 0; col < imagewidth; col += tw) { |
1230 | 1231 | tsample_t s; |
1234 | 1235 | * visible portion and skewing factors. |
1235 | 1236 | */ |
1236 | 1237 | if (colb + tilew > imagew) { |
1237 | uint32 width = imagew - colb; | |
1238 | uint32_t width = imagew - colb; | |
1238 | 1239 | int oskew = tilew - width; |
1239 | 1240 | |
1240 | 1241 | cpContigBufToSeparateBuf(obuf, |
1395 | 1396 | * Select the appropriate copy function to use. |
1396 | 1397 | */ |
1397 | 1398 | static copyFunc |
1398 | pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel) | |
1399 | { | |
1400 | uint16 shortv; | |
1401 | uint32 w, l, tw, tl; | |
1399 | pickCopyFunc(TIFF* in, TIFF* out, uint16_t bitspersample, uint16_t samplesperpixel) | |
1400 | { | |
1401 | uint16_t shortv; | |
1402 | uint32_t w, l, tw, tl; | |
1402 | 1403 | int bychunk; |
1403 | 1404 | |
1404 | 1405 | (void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv); |
1421 | 1422 | TIFFGetField(in, TIFFTAG_TILELENGTH, &tl); |
1422 | 1423 | bychunk = (tw == w && tl == rowsperstrip); |
1423 | 1424 | } else { |
1424 | uint32 irps = (uint32) -1L; | |
1425 | uint32_t irps = (uint32_t) -1L; | |
1425 | 1426 | TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps); |
1426 | 1427 | bychunk = (rowsperstrip == irps); |
1427 | 1428 | } |
0 | 0 | #ifndef GEO_CONFIG_H |
1 | 1 | #define GEO_CONFIG_H |
2 | 2 | |
3 | /* Define if you have the <stdlib.h> header file. */ | |
4 | #cmakedefine HAVE_STDLIB_H | |
5 | ||
6 | /* Define if you have the <string.h> header file. */ | |
7 | #cmakedefine HAVE_STRING_H | |
8 | ||
9 | 3 | /* Define if you have the <strings.h> header file. */ |
10 | #cmakedefine HAVE_STRINGS_H | |
4 | #cmakedefine GEOTIFF_HAVE_STRINGS_H 1 | |
11 | 5 | |
12 | 6 | #cmakedefine GEO_NORMALIZE_DISABLE_TOWGS84 |
13 | 7 |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.69 for libgeotiff 1.7.0. | |
2 | # Generated by GNU Autoconf 2.69 for libgeotiff 1.7.1. | |
3 | 3 | # |
4 | 4 | # Report bugs to <warmerdam@pobox.com>. |
5 | 5 | # |
589 | 589 | # Identity of this package. |
590 | 590 | PACKAGE_NAME='libgeotiff' |
591 | 591 | PACKAGE_TARNAME='libgeotiff' |
592 | PACKAGE_VERSION='1.7.0' | |
593 | PACKAGE_STRING='libgeotiff 1.7.0' | |
592 | PACKAGE_VERSION='1.7.1' | |
593 | PACKAGE_STRING='libgeotiff 1.7.1' | |
594 | 594 | PACKAGE_BUGREPORT='warmerdam@pobox.com' |
595 | 595 | PACKAGE_URL='' |
596 | 596 | |
1421 | 1421 | # Omit some internal or obsolete options to make the list less imposing. |
1422 | 1422 | # This message is too long to be a string in the A/UX 3.1 sh. |
1423 | 1423 | cat <<_ACEOF |
1424 | \`configure' configures libgeotiff 1.7.0 to adapt to many kinds of systems. | |
1424 | \`configure' configures libgeotiff 1.7.1 to adapt to many kinds of systems. | |
1425 | 1425 | |
1426 | 1426 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1427 | 1427 | |
1492 | 1492 | |
1493 | 1493 | if test -n "$ac_init_help"; then |
1494 | 1494 | case $ac_init_help in |
1495 | short | recursive ) echo "Configuration of libgeotiff 1.7.0:";; | |
1495 | short | recursive ) echo "Configuration of libgeotiff 1.7.1:";; | |
1496 | 1496 | esac |
1497 | 1497 | cat <<\_ACEOF |
1498 | 1498 | |
1638 | 1638 | test -n "$ac_init_help" && exit $ac_status |
1639 | 1639 | if $ac_init_version; then |
1640 | 1640 | cat <<\_ACEOF |
1641 | libgeotiff configure 1.7.0 | |
1641 | libgeotiff configure 1.7.1 | |
1642 | 1642 | generated by GNU Autoconf 2.69 |
1643 | 1643 | |
1644 | 1644 | Copyright (C) 2012 Free Software Foundation, Inc. |
2007 | 2007 | This file contains any messages produced by compilers while |
2008 | 2008 | running configure, to aid debugging if configure makes a mistake. |
2009 | 2009 | |
2010 | It was created by libgeotiff $as_me 1.7.0, which was | |
2010 | It was created by libgeotiff $as_me 1.7.1, which was | |
2011 | 2011 | generated by GNU Autoconf 2.69. Invocation command line was |
2012 | 2012 | |
2013 | 2013 | $ $0 $@ |
2425 | 2425 | |
2426 | 2426 | |
2427 | 2427 | |
2428 | RELEASE_VERSION=1.7.0 | |
2428 | RELEASE_VERSION=1.7.1 | |
2429 | 2429 | |
2430 | 2430 | ac_config_headers="$ac_config_headers geo_config.h" |
2431 | 2431 | |
2917 | 2917 | |
2918 | 2918 | # Define the identity of the package. |
2919 | 2919 | PACKAGE='libgeotiff' |
2920 | VERSION='1.7.0' | |
2920 | VERSION='1.7.1' | |
2921 | 2921 | |
2922 | 2922 | |
2923 | 2923 | cat >>confdefs.h <<_ACEOF |
12163 | 12163 | LIBS="$LDFLAGS $LIBS" |
12164 | 12164 | |
12165 | 12165 | |
12166 | for ac_header in string.h | |
12166 | for ac_header in strings.h | |
12167 | 12167 | do : |
12168 | ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" | |
12169 | if test "x$ac_cv_header_string_h" = xyes; then : | |
12168 | ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" | |
12169 | if test "x$ac_cv_header_strings_h" = xyes; then : | |
12170 | 12170 | cat >>confdefs.h <<_ACEOF |
12171 | #define HAVE_STRING_H 1 | |
12171 | #define HAVE_STRINGS_H 1 | |
12172 | 12172 | _ACEOF |
12173 | HAVE_STRING_H=1 | |
12174 | else | |
12175 | as_fn_error $? "cannot find string.h, bailing out" "$LINENO" 5 | |
12173 | GEOTIFF_HAVE_STRINGS_H=1 | |
12176 | 12174 | fi |
12177 | 12175 | |
12178 | 12176 | done |
12177 | ||
12178 | ||
12179 | cat >>confdefs.h <<_ACEOF | |
12180 | #define GEOTIFF_HAVE_STRINGS_H 1 | |
12181 | _ACEOF | |
12182 | ||
12179 | 12183 | |
12180 | 12184 | for ac_header in stdio.h |
12181 | 12185 | do : |
16179 | 16183 | # report actual input values of CONFIG_FILES etc. instead of their |
16180 | 16184 | # values after options handling. |
16181 | 16185 | ac_log=" |
16182 | This file was extended by libgeotiff $as_me 1.7.0, which was | |
16186 | This file was extended by libgeotiff $as_me 1.7.1, which was | |
16183 | 16187 | generated by GNU Autoconf 2.69. Invocation command line was |
16184 | 16188 | |
16185 | 16189 | CONFIG_FILES = $CONFIG_FILES |
16245 | 16249 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
16246 | 16250 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
16247 | 16251 | ac_cs_version="\\ |
16248 | libgeotiff config.status 1.7.0 | |
16252 | libgeotiff config.status 1.7.1 | |
16249 | 16253 | configured by $0, generated by GNU Autoconf 2.69, |
16250 | 16254 | with options \\"\$ac_cs_config\\" |
16251 | 16255 |
1 | 1 | |
2 | 2 | m4_define([VERSION_MAJOR], [1]) |
3 | 3 | m4_define([VERSION_MINOR], [7]) |
4 | m4_define([VERSION_POINT], [0]) | |
4 | m4_define([VERSION_POINT], [1]) | |
5 | 5 | m4_define([GEOTIFF_VERSION], |
6 | 6 | [VERSION_MAJOR.VERSION_MINOR.VERSION_POINT]) |
7 | 7 | |
44 | 44 | dnl Checks for header files. |
45 | 45 | dnl ######################################################################### |
46 | 46 | |
47 | AC_CHECK_HEADERS([string.h],[HAVE_STRING_H=1], [AC_MSG_ERROR([cannot find string.h, bailing out])]) | |
47 | dnl AC_CHECK_HEADERS([string.h],[HAVE_STRING_H=1], [AC_MSG_ERROR([cannot find string.h, bailing out])]) | |
48 | AC_CHECK_HEADERS([strings.h],[GEOTIFF_HAVE_STRINGS_H=1]) | |
49 | AC_DEFINE_UNQUOTED(GEOTIFF_HAVE_STRINGS_H, 1, | |
50 | [Define if you have the <strings.h> header file.]) | |
51 | ||
48 | 52 | AC_CHECK_HEADERS([stdio.h],, [AC_MSG_ERROR([cannot find stdio.h, bailing out])]) |
49 | 53 | AC_CHECK_HEADERS([stdlib.h],, [AC_MSG_ERROR([cannot find stdlib.h, bailing out])]) |
50 | 54 |
37 | 37 | |
38 | 38 | #include <math.h> |
39 | 39 | |
40 | #ifdef HAVE_STRING_H | |
41 | # include <string.h> | |
42 | #endif | |
43 | #if defined(HAVE_STRINGS_H) && !defined(_WIN32) | |
40 | #include <string.h> | |
41 | #if defined(GEOTIFF_HAVE_STRINGS_H) && !defined(_WIN32) | |
44 | 42 | # include <strings.h> |
45 | 43 | #endif |
46 | #ifdef HAVE_STDLIB_H | |
47 | # include <stdlib.h> | |
48 | #endif | |
44 | #include <stdlib.h> | |
49 | 45 | |
50 | 46 | /********************************************************************** |
51 | 47 | * Do we want to build as a DLL on windows? |
0 | 0 | #ifndef GEO_CONFIG_H |
1 | 1 | #define GEO_CONFIG_H |
2 | 2 | |
3 | /* Define if you have the ANSI C header files. */ | |
4 | #undef STDC_HEADERS | |
5 | ||
6 | /* Define if you have the <stdlib.h> header file. */ | |
7 | #undef HAVE_STDLIB_H | |
8 | ||
9 | /* Define if you have the <string.h> header file. */ | |
10 | #undef HAVE_STRING_H | |
11 | ||
12 | 3 | /* Define if you have the <strings.h> header file. */ |
13 | #undef HAVE_STRINGS_H | |
14 | ||
15 | #undef HAVE_LIBPROJ | |
16 | #undef HAVE_PROJECTS_H | |
4 | #undef GEOTIFF_HAVE_STRINGS_H | |
17 | 5 | |
18 | 6 | #undef GEO_NORMALIZE_DISABLE_TOWGS84 |
19 | 7 |
32 | 32 | |
33 | 33 | va_start(list, msg); |
34 | 34 | if( level == LIBGEOTIFF_WARNING ) |
35 | fprintf(stderr, "Warning :"); | |
35 | fprintf(stderr, "Warning: "); | |
36 | 36 | else if( level == LIBGEOTIFF_ERROR ) |
37 | fprintf(stderr, "Error :"); | |
37 | fprintf(stderr, "Error: "); | |
38 | 38 | vfprintf(stderr, msg, list); |
39 | 39 | fprintf(stderr, "\n"); |
40 | 40 | va_end(list); |
266 | 266 | { |
267 | 267 | case GTIFF_LOCAL: |
268 | 268 | /* store value into data value */ |
269 | if (count != 1 ) | |
270 | { | |
271 | if( gt->gt_error_callback ) | |
272 | { | |
273 | gt->gt_error_callback( | |
274 | gt, | |
275 | LIBGEOTIFF_ERROR, | |
276 | "Key %s of TIFFTagLocation=0 has count=%d, " | |
277 | "whereas only 1 is legal.", | |
278 | GTIFKeyName(keyptr->gk_key), count); | |
279 | } | |
280 | return 0; | |
281 | } | |
269 | 282 | memcpy(&keyptr->gk_data, &(entptr->ent_val_offset), sizeof(pinfo_t)); |
270 | 283 | break; |
271 | 284 | case GTIFF_GEOKEYDIRECTORY: |
272 | 285 | keyptr->gk_data = (char *)(gt->gt_short+offset); |
273 | 286 | if (gt->gt_nshorts < offset+count) |
287 | { | |
288 | if( gt->gt_error_callback ) | |
289 | { | |
290 | gt->gt_error_callback( | |
291 | gt, | |
292 | LIBGEOTIFF_ERROR, | |
293 | "Key %s of type SHORT has offset=%d and count=%d, " | |
294 | "but the GeoKeyDirectory tag has only %d values.", | |
295 | GTIFKeyName(keyptr->gk_key), | |
296 | offset, count, gt->gt_nshorts); | |
297 | } | |
274 | 298 | return 0; |
299 | } | |
275 | 300 | break; |
276 | 301 | case GTIFF_DOUBLEPARAMS: |
277 | 302 | keyptr->gk_data = (char *)(gt->gt_double+offset); |
278 | 303 | if (gt->gt_ndoubles < offset+count) |
304 | { | |
305 | if( gt->gt_error_callback ) | |
306 | { | |
307 | gt->gt_error_callback( | |
308 | gt, | |
309 | LIBGEOTIFF_ERROR, | |
310 | "Key %s of type SHORT has offset=%d and count=%d, " | |
311 | "but the GeoDoubleParams tag has only %d values.", | |
312 | GTIFKeyName(keyptr->gk_key), | |
313 | offset, count, gt->gt_ndoubles); | |
314 | } | |
279 | 315 | return 0; |
316 | } | |
280 | 317 | break; |
281 | 318 | case GTIFF_ASCIIPARAMS: |
282 | 319 | if( tempData->tk_asciiParams == NULL ) |
320 | { | |
321 | if( gt->gt_error_callback ) | |
322 | { | |
323 | gt->gt_error_callback( | |
324 | gt, | |
325 | LIBGEOTIFF_ERROR, | |
326 | "Key %s is of type ASCII but GeoAsciiParams is " | |
327 | "missing or corrupted.", | |
328 | GTIFKeyName(keyptr->gk_key)); | |
329 | } | |
283 | 330 | return 0; |
331 | } | |
284 | 332 | if( offset + count == tempData->tk_asciiParamsLength + 1 |
285 | 333 | && count > 0 ) |
286 | 334 | { |
293 | 341 | else if (offset < tempData->tk_asciiParamsLength |
294 | 342 | && offset + count > tempData->tk_asciiParamsLength ) |
295 | 343 | { |
344 | if( gt->gt_error_callback ) | |
345 | { | |
346 | gt->gt_error_callback( | |
347 | gt, | |
348 | LIBGEOTIFF_WARNING, | |
349 | "Key %s of type ASCII has offset=%d and count=%d, but " | |
350 | "the GeoAsciiParams tag has only %d bytes. " | |
351 | "Truncating the value of the key.", | |
352 | GTIFKeyName(keyptr->gk_key), offset, count, | |
353 | tempData->tk_asciiParamsLength); | |
354 | } | |
296 | 355 | count = tempData->tk_asciiParamsLength - offset; |
297 | /* issue warning... if we could */ | |
298 | 356 | } |
299 | 357 | else if (offset + count > tempData->tk_asciiParamsLength) |
358 | { | |
359 | if( gt->gt_error_callback ) | |
360 | { | |
361 | gt->gt_error_callback( | |
362 | gt, | |
363 | LIBGEOTIFF_ERROR, | |
364 | "Key %s of type ASCII has offset=%d and count=%d, " | |
365 | "but the GeoAsciiParams tag has only %d values.", | |
366 | GTIFKeyName(keyptr->gk_key), offset, count, | |
367 | tempData->tk_asciiParamsLength); | |
368 | } | |
300 | 369 | return 0; |
370 | } | |
301 | 371 | |
302 | 372 | keyptr->gk_count = MAX(1,count+1); |
303 | 373 | keyptr->gk_data = (char *) _GTIFcalloc (keyptr->gk_count); |
313 | 383 | keyptr->gk_data[MAX(0,count)] = '\0'; |
314 | 384 | break; |
315 | 385 | default: |
386 | if( gt->gt_error_callback ) | |
387 | { | |
388 | gt->gt_error_callback( | |
389 | gt, | |
390 | LIBGEOTIFF_ERROR, | |
391 | "Key %d of unknown type.", | |
392 | keyptr->gk_key); | |
393 | } | |
316 | 394 | return 0; /* failure */ |
317 | 395 | } |
318 | 396 | keyptr->gk_size = _gtiff_size[keyptr->gk_type]; |
2989 | 2989 | void GTIFPrintDefn( GTIFDefn * psDefn, FILE * fp ) |
2990 | 2990 | { |
2991 | 2991 | GTIF *psGTIF = GTIFNew(NULL); |
2992 | GTIFPrintDefnEx(psGTIF, psDefn, fp); | |
2993 | GTIFFree(psGTIF); | |
2992 | if( psGTIF ) | |
2993 | { | |
2994 | GTIFPrintDefnEx(psGTIF, psDefn, fp); | |
2995 | GTIFFree(psGTIF); | |
2996 | } | |
2994 | 2997 | } |
2995 | 2998 | |
2996 | 2999 | /************************************************************************/ |
46 | 46 | #define GEOTIFF_SPEC_1_1_MINOR_REVISION 1 |
47 | 47 | |
48 | 48 | /* Library version */ |
49 | #define LIBGEOTIFF_VERSION 1700 | |
49 | #define LIBGEOTIFF_VERSION 1710 | |
50 | 50 | |
51 | 51 | #include "geo_config.h" |
52 | 52 | #include "geokeys.h" |
130 | 130 | void GTIF_DLL GTIFFree(GTIF *gtif); |
131 | 131 | int GTIF_DLL GTIFWriteKeys(GTIF *gtif); |
132 | 132 | /* versions must be an array of 3 int */ |
133 | void GTIF_DLL GTIFDirectoryInfo(GTIF *gtif, int *versions, int *keycount); | |
133 | void GTIF_DLL GTIFDirectoryInfo(GTIF *gtif, int versions[3], int *keycount); | |
134 | 134 | void GTIF_DLL *GTIFGetUserData(GTIF *gtif); |
135 | 135 | int GTIF_DLL GTIFSetVersionNumbers(GTIF* gtif, |
136 | 136 | unsigned short version, |