Browse Source

- fixed sign in for-loops

- removed dead code (if count <0)
development
Andreas Romeyke 8 months ago
parent
commit
95a4c3b202
1 changed files with 5 additions and 14 deletions
  1. +5
    -14
      src/tagrules/check_tag_has_valuelist.c

+ 5
- 14
src/tagrules/check_tag_has_valuelist.c View File

@ -21,17 +21,8 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, unsigned int count, con
ret=check_tag_quiet(ctif, tag);
if (ret.returncode != is_valid) return ret;
if (count < 0) {
if (snprintf(ret.value_found, VALUESTRLEN, "count=%i", count) > 0) {
ret.returncode = calling_error_count_size;
return ret;
} else {
ret.returncode = could_not_print;
return ret;
}
}
unsigned int v[count];
for (int i=0; i< count; i++) {
for (unsigned int i=0; i< count; i++) {
v[i] = *values;
values++;
}
@ -48,7 +39,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, unsigned int count, con
case TIFF_LONG: {
/* value */
if (ifd_entry.value_or_offset == is_value) {
for (int i=0; i< count; i++) {
for (unsigned int i=0; i< count; i++) {
if (v[i] != ifd_entry.data32) {
snprintf(value, sizeof(value), "at [%i]=%u", i, ifd_entry.data32);
ret = set_value_found_ret (&ret, value);
@ -65,7 +56,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, unsigned int count, con
return ret;
}
uint32 * p = offset.data32p;
for (int i=0; i< count; i++) {
for (unsigned int i=0; i< count; i++) {
uint32 pval = *p;
#ifdef DEBUG
printf("OFFSET: v[%i]=%u p[%i]=%u\n", i,v[i],i,pval);
@ -84,7 +75,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, unsigned int count, con
case TIFF_SHORT: {
/* value */
if (ifd_entry.value_or_offset == is_value) {
for (int i=0; i< count; i++) {
for (unsigned int i=0; i< count; i++) {
int c = (v[i]) == (ifd_entry.data16[i]);
if (!c) {
snprintf(value, sizeof(value), "at [%i]=%u", i, ifd_entry.data16[i]);
@ -102,7 +93,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, unsigned int count, con
return ret;
}
uint16 * p = offset.data16p;
for (int i=0; i< count; i++) {
for (unsigned int i=0; i< count; i++) {
uint16 pval = *p;
#ifdef DEBUG
printf("SHORTOFFSET (tag=%i): v[%i]=%u p[%i]=0x%04x\n", tag, i,v[i],i,pval);


Loading…
Cancel
Save