Browse Source

- fixed merge problems

v0.4.0-hotfix v0.3.0
Andreas Romeyke 4 years ago
parent
commit
f3e85805da
  1. 1
      src/helper/check_print.c
  2. 2
      src/parser/config_parser.c
  3. 58
      src/tagrules/check_tag_has_some_of_these_values.c
  4. 7
      src/tagrules/check_tag_has_valuelist.c
  5. 4
      src/validate_icc/check_icc_header.c

1
src/helper/check_print.c

@ -12,7 +12,6 @@
#include <string.h>
#include "check.h"
#include "check_helper.h"
#include <assert.h>
#ifdef WIN32
static inline char *strndup(const char *s, size_t n)

2
src/parser/config_parser.c

@ -624,7 +624,7 @@ void commentline() {
}
/* helper function for parser */
/*
void rule_should_not_occur(char* s) {
void rule_should_not_occure(char* s) {
#ifdef DEBUG
printf("no parser rule matched after line %i (prev tag was %u): '%s'\n", getlineno(), gettag(), s);
#endif

58
src/tagrules/check_tag_has_some_of_these_values.c

@ -20,25 +20,18 @@ ret_t check_tag_has_some_of_these_values(ctiff_t * ctif, tag_t tag, int count, c
if (ret.returncode != is_valid) return ret;
const unsigned int * p = values;
TIFFDataType datatype = TIFFGetRawTagType( ctif, tag );
switch (datatype) {
case TIFF_LONG: {
p = values;
ret_t tmp_res;
for (int i=0; i< count; i++) {
TIFFDataType datatype = TIFFGetRawTagType( ctif, tag );
switch (datatype) {
case TIFF_LONG: {
p = values;
ret_t tmp_res;
for (int i=0; i< count; i++) {
#ifdef DEBUG
printf("### value = %u", *p);
printf("### value = %u", *p);
#endif
tmp_res = check_tag_has_u32value(ctif, tag, *p);
if (tmp_res.returncode == 0) return tmp_res;
p++;
}
uint32 * valp = NULL;
uint32 val;
TIFFGetFieldLONG(ctif, tag, &valp);
val = *valp;
return tif_fails_tag( tag, strdup(expected), int2str(val));
break;
tmp_res = check_tag_has_u32value(ctif, tag, *p);
if (tmp_res.returncode == 0) return tmp_res;
p++;
}
uint32 * valp = NULL;
uint32 val=0;
@ -59,18 +52,11 @@ ret_t check_tag_has_some_of_these_values(ctiff_t * ctif, tag_t tag, int count, c
ret_t tmp_res;
for (int i=0; i< count; i++) {
#ifdef DEBUG
printf("### value = %u", *p);
printf("### value = %u", *p);
#endif
tmp_res = check_tag_has_u16value(ctif, tag, *p);
if (tmp_res.returncode == 0) return tmp_res;
p++;
}
uint16 * valp = NULL;
uint16 val;
TIFFGetFieldSHORT(ctif, tag, &valp);
val = *valp;
return tif_fails_tag( tag, strdup(expected), int2str(val));
break;
tmp_res = check_tag_has_u16value(ctif, tag, *p);
if (tmp_res.returncode == 0) return tmp_res;
p++;
}
uint16 * valp = NULL;
uint16 val=0;
@ -91,19 +77,11 @@ ret_t check_tag_has_some_of_these_values(ctiff_t * ctif, tag_t tag, int count, c
ret_t tmp_res;
for (int i=0; i< count; i++) {
#ifdef DEBUG
printf("### value = %u", *p);
printf("### value = %u", *p);
#endif
tmp_res = check_tag_has_fvalue(ctif, tag, *p);
if (tmp_res.returncode == 0) return tmp_res;
p++;
}
float * valp = NULL;
float val;
TIFFGetFieldRATIONAL(ctif, tag, &valp);
val = * valp;
return tif_fails_tag( tag, strdup(expected), float2str(val));
//tif_fails("tag %u (%s) does not have some of expected values (but have:%f)\n", tag, TIFFTagName(tif, tag), val);
break;
tmp_res = check_tag_has_fvalue(ctif, tag, *p);
if (tmp_res.returncode == 0) return tmp_res;
p++;
}
float * valp = NULL;
float val=0.0f;

7
src/tagrules/check_tag_has_valuelist.c

@ -66,7 +66,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, int count, const unsign
for (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);
printf("OFFSET: v[%i]=%u p[%i]=%u\n", i,v[i],i,pval);
#endif
if (v[i] != *p) {
snprintf(value, sizeof(value), "at [%u]=%u", i, pval);
@ -74,6 +74,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, int count, const unsign
ret.returncode = tagerror_value_differs;
return ret;
}
p++;
}
}
break;
@ -99,7 +100,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, int count, const unsign
for (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);
printf("SHORTOFFSET (tag=%i): v[%i]=%u p[%i]=0x%04x\n", tag, i,v[i],i,pval);
#endif
if (v[i] != pval) {
snprintf(value, sizeof(value), "at [%u]=%u", i, pval);
@ -107,6 +108,7 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, int count, const unsign
ret.returncode = tagerror_value_differs;
return ret;
}
p++;
}
}
break;
@ -119,7 +121,6 @@ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, int count, const unsign
return ret;
}
}
}
ret.returncode=is_valid;
return ret;

4
src/validate_icc/check_icc_header.c

@ -135,8 +135,8 @@ icc_returncode_t parse_icc_common_header(unsigned long iccsize, char * iccdata,
char profilefilesignature[5]=" "; memcpy(profilefilesignature, &iccdata[36],4);
INFO("ICC: profilefilesignature='%s'\n", profilefilesignature);
/* -- */
char primaryplatformsignature[5]=" "; memcpy(primaryplatformsignature, &iccdata[40],4);
INFO("ICC: primaryplatformsignature='%s'\n", primaryplatformsignature);
char primaryplattformsignature[5]=" "; memcpy(primaryplattformsignature, &iccdata[40],4);
INFO("ICC: primaryplattformsignature='%s'\n", primaryplattformsignature);
if ( /* see page 15, table 15 of http://www.color.org/ICC_Minor_Revision_for_Web.pdf */
('\0' != primaryplattformsignature[0]) &&
(0 != strncmp("APPL", primaryplattformsignature, 4)) &&

Loading…
Cancel
Save