Browse Source

- added support for deep geotiff checks

development v0.5.0
parent
commit
aeded94806
  1. 1
      src/headers/config_parser.h
  2. 5
      src/ifdrules/check_all_geotiff_tags.c
  3. 2
      src/messages/msg_parser.c
  4. 11
      src/parser/config_parser.c

1
src/headers/config_parser.h

@ -57,6 +57,7 @@ typedef enum {
fc_internal_logic_combine_open,
fc_internal_logic_combine_close,
fc_all_offsets_are_not_zero,
fc_all_geotiff_tags_have_same_count_of_values,
fc_dummy
} function_t;

5
src/ifdrules/check_all_geotiff_tags.c

@ -74,9 +74,8 @@ ret_t check_all_geotiff_tags(ctiff_t * ctif) {
return ret;
}
uint32 count = ifd_entry.count;
unsigned int v[count];
char value[VALUESTRLEN];
memset(value, '\0', VALUESTRLEN);
char value[VALUESTRLEN];
memset(value, '\0', VALUESTRLEN);
/* type is short? */
switch (ifd_entry.datatype) {

2
src/messages/msg_parser.c

@ -33,6 +33,7 @@ const char * get_parser_function_name( function_t f ) {
case fc_internal_logic_combine_open: return "fc_internal_logic_combine_open"; break;
case fc_internal_logic_combine_close: return "fc_internal_logic_combine_close"; break;
case fc_all_offsets_are_not_zero: return "fc_all_offsets_are_not_zero"; break;
case fc_all_geotiff_tags_have_same_count_of_values: return "fc_all_geotiff_tags_have_same_count_of_values"; break;
case fc_dummy: return "fc_dummy"; break;
}
return "missed function description, should not occur";
@ -63,6 +64,7 @@ const char * get_parser_function_description( function_t f ) {
case fc_internal_logic_combine_open: return "One or more conditions needs to be combined in a logical_or operation (open)"; break;
case fc_internal_logic_combine_close: return "One or more conditions needs to be combined in a logical_or operation (close)"; break;
case fc_all_offsets_are_not_zero: return "All tag offsets should be greater than zero,"; break;
case fc_all_geotiff_tags_have_same_count_of_values: return "All GeoTIFF tags should have same amount of values,"; break;
case fc_dummy: return "Dummy."; break;
}
return "missed function description, should not occur";

11
src/parser/config_parser.c

@ -162,7 +162,7 @@ void exe_printstack () {
printf(" exe-stack value[ %i ] --> {\n\tlineno=%i\n\tis_precondition=%s (%i)\n\ttag=%hu\n\tfunction_used=%s (%i)\n",
j,
parser_state.exe_stack[j].lineno,
(parser_state.exe_stack[j].is_precondition == true?"true":"false"),
(parser_state.exe_stack[j].is_precondition == true?"true":"false"),
parser_state.exe_stack[j].is_precondition,
parser_state.exe_stack[j].tag,
get_parser_function_description(parser_state.exe_stack[j].function),
@ -381,6 +381,10 @@ ret_t call_exec_function(ctiff_t * ctif, ret_t * retp, internal_entry_t * exep)
case fc_internal_logic_combine_open: { ret.returncode = parser_logical_combine_open ; break; }
case fc_internal_logic_combine_close: { ret.returncode = parser_logical_combine_close ; break; }
case fc_all_offsets_are_not_zero: { ret = check_all_offsets_are_greater_zero(ctif); break;}
case fc_all_geotiff_tags_have_same_count_of_values: {
ret = check_all_geotiff_tags(ctif); break;
}
default: {
GET_EMPTY_RET(res)
res.value_found = __ch_malloc(res.value_found);
@ -1097,6 +1101,11 @@ void set_mode(modes_t mode) {
exe_push(e);
break;
}
case mode_enable_deep_geotiff_checks: {
e.function = fc_all_geotiff_tags_have_same_count_of_values;
exe_push(e);
break;
}
case mode_enable_type_checks: { /* nothing, because we must enable it only in rule_addtag_config */
}
}

Loading…
Cancel
Save