"checkit_tiff" is an incredibly fast conformance checker for baseline TIFFs (with various extensions), see http://andreas-romeyke.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.4 KiB

4 years ago
  1. /* rule based checks if given TIFF is a specific baseline TIFF
  2. *
  3. * author: Andreas Romeyke, 2015
  4. * licensed under conditions of libtiff
  5. * (see http://libtiff.maptools.org/misc.html)
  6. *
  7. */
  8. #ifndef _FIXIT_TIFF_CHECK_HELPER
  9. #define _FIXIT_TIFF_CHECK_HELPER
  10. #include <stdlib.h>
  11. #include "msg_tiffparse.h"
  12. //#include <tiff.h>
  13. //#include <tiffio.h>
  14. #define TIFF_ANY 0
  15. void TIFFSwabShort(uint16 *a);
  16. void TIFFSwabLong(uint32 *a);
  17. /* helper */
  18. long long fsize(int fd);
  19. ret_t check_tag_has_fvalue(ctiff_t * ctif, tag_t tag, float value);
  20. ret_t check_tag_has_u16value(ctiff_t * ctif, tag_t tag, uint16 value);
  21. ret_t check_tag_has_u32value(ctiff_t * ctif, tag_t tag, uint32 value);
  22. uint32 TIFFGetRawTagTypeListEntry( ctiff_t * ctif, int tagidx );
  23. tag_t TIFFGetRawTagListEntry( ctiff_t * ctif, int tagidx ) ;
  24. int TIFFGetRawTagListCount (ctiff_t * ctif, uint32 ifdpos) ;
  25. TIFFDataType TIFFGetRawTagType(ctiff_t * ctif, tag_t tag);
  26. ifd_entry_t TIFFGetRawIFDEntry( ctiff_t * ctif, tag_t tag);
  27. ifd_entry_t TIFFGetRawTagIFDListEntry( ctiff_t * ctif, int tagidx );
  28. int TIFFGetRawTagListIndex(ctiff_t * ctif, tag_t tag);
  29. ret_t TIFFGetFieldASCII(ctiff_t * ctif, const tag_t tag, char** result_string_p, uint32 * result_countp);
  30. ret_t TIFFGetFieldLONG(ctiff_t * ctif, const tag_t tag, uint32 ** result_long_p, uint32 * result_countp);
  31. ret_t TIFFGetFieldSHORT(ctiff_t * ctif, const tag_t tag, uint16 ** result_short_p, uint32 * result_countp);
  32. ret_t TIFFGetFieldRATIONAL(ctiff_t * ctif, const tag_t tag, float ** result_float_p, uint32 * result_countp);
  33. ret_t read_offsetdata(ctiff_t * ctif, const uint32 address, const uint32 count, const uint16 datatype, offset_t * result_offsetp, ret_t * ret_p);
  34. char * secstrcat (char * dest, const char * src, size_t * maxsize_p);
  35. ctiff_t * initialize_ctif( const char * tiff_file, ct_ioflag_t );
  36. void free_ctif( ctiff_t * ctif);
  37. uint32 get_ifd0_pos( ctiff_t * ctif);
  38. ret_t parse_header_and_endianess(ctiff_t * ctif );
  39. uint32 get_next_ifd_pos( ctiff_t * ctif, uint32 actual_pos );
  40. uint16 get_ifd0_count( ctiff_t * ctif );
  41. int is_byteswapped( ctiff_t * ctif );
  42. ret_t get_first_IFD(ctiff_t * ctif, uint32 * ifd);
  43. ret_t set_value_found_ret (ret_t * rp, const char * msg);
  44. returncode_t __add_to_render_pipeline_via_strncpy (retmsg_t ** pointer, const char * src, rm_type_t src_type);
  45. void __clean_render_pipeline( retmsg_t ** pointer );
  46. #define GET_EMPTY_RET(ret) \
  47. ret_t ret; \
  48. ret.value_found = NULL; \
  49. ret.logical_or_count = 0; \
  50. ret.returncode = should_not_occur;
  51. #endif