Browse Source

- fix, cardinality should only be checked if both tags used

development
Andreas Romeyke 8 months ago
parent
commit
3bb8e273c7
1 changed files with 14 additions and 13 deletions
  1. +14
    -13
      src/ifdrules/check_tags_with_corresponding_cardinality.c

+ 14
- 13
src/ifdrules/check_tags_with_corresponding_cardinality.c View File

@ -19,20 +19,21 @@ ret_t check_cardinality_of_some_tags_are_equal(ctiff_t * ctif) {
GET_EMPTY_RET(ret);
TIFP_CHECK( ctif, ret);
/* check if both values exist */
ret_t rc=check_tag_quiet(ctif, TIFFTAG_STRIPOFFSETS);
if (rc.returncode != is_valid) return rc;
rc=check_tag_quiet(ctif, TIFFTAG_STRIPBYTECOUNTS);
if (rc.returncode != is_valid) return rc;
ret_t rc_stripoffsets=check_tag_quiet(ctif, TIFFTAG_STRIPOFFSETS);
ret_t rc_stripbytecounts =check_tag_quiet(ctif, TIFFTAG_STRIPBYTECOUNTS);
if ((rc_stripoffsets.returncode == is_valid) && (rc_stripbytecounts.returncode == is_valid)) {
/* find stripoffset */
ifd_entry_t stripoffsets_entry = TIFFGetRawIFDEntry(ctif, TIFFTAG_STRIPOFFSETS);
ifd_entry_t stripbytescounts_entry = TIFFGetRawIFDEntry(ctif, TIFFTAG_STRIPBYTECOUNTS);
if (stripoffsets_entry.count != stripbytescounts_entry.count) {
char array[TIFFAILSTRLEN];
snprintf(array, sizeof(array), "tag %u count=%u, tag %u count=%u", TIFFTAG_STRIPOFFSETS, stripoffsets_entry.count, TIFFTAG_STRIPBYTECOUNTS, stripbytescounts_entry.count);
ret = set_value_found_ret(&ret, array);
ret.returncode = ifderror_different_cardinality;
return ret;
/* find stripoffset */
ifd_entry_t stripoffsets_entry = TIFFGetRawIFDEntry(ctif, TIFFTAG_STRIPOFFSETS);
ifd_entry_t stripbytescounts_entry = TIFFGetRawIFDEntry(ctif, TIFFTAG_STRIPBYTECOUNTS);
if (stripoffsets_entry.count != stripbytescounts_entry.count) {
char array[TIFFAILSTRLEN];
snprintf(array, sizeof(array), "tag %u count=%u, tag %u count=%u", TIFFTAG_STRIPOFFSETS,
stripoffsets_entry.count, TIFFTAG_STRIPBYTECOUNTS, stripbytescounts_entry.count);
ret = set_value_found_ret(&ret, array);
ret.returncode = ifderror_different_cardinality;
return ret;
}
}
ret.returncode=is_valid;
return ret;


Loading…
Cancel
Save