Skip to content

Commit 923b477

Browse files
committed
CGATS file : skip on .cht
1 parent 8b8e98a commit 923b477

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/common/colorchecker.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void _dt_color_checker_patch_copy(dt_color_checker_patch *dest, const dt_
9999
dest->Lab[2] = src->Lab[2];
100100
}
101101

102-
static void dt_color_checker_copy(dt_color_checker_t *dest, const dt_color_checker_t *src)
102+
void dt_color_checker_copy(dt_color_checker_t *dest, const dt_color_checker_t *src)
103103
{
104104
if(!dest || !src) return;
105105

@@ -530,7 +530,7 @@ static gboolean _dispatch_cht_data(GList **boxes, dt_colorchecker_chart_spec_t *
530530
const char **tokens = (const char **)lines->data;
531531
if(!tokens) ERROR
532532

533-
const char *letter = tokens[0][0];
533+
const char letter = tokens[0][0];
534534
if(letter == 'F')
535535
{
536536
F_box = _dt_cht_extract_F(tokens);
@@ -714,7 +714,7 @@ static gboolean _dt_CGATS_is_supported(const cmsHANDLE *hIT8)
714714
goto end;
715715
}
716716
else
717-
{
717+
{
718718
const char *CGATS_type = cmsIT8GetProperty(*hIT8, "CGATS");
719719
// Check if the data type can be found in our supported list of CGATS types
720720
if(_dt_CGATS_get_type_value(CGATS_type) == CGATS_TYPE_UNKOWN)
@@ -1069,9 +1069,7 @@ static dt_color_checker_patch *_dt_colorchecker_CGATS_fill_patch_values(cmsHANDL
10691069
fprintf(stderr, "error: patch %lu not found in chart specification.\n", patch_iter);
10701070
goto error;
10711071
}
1072-
_dt_color_checker_patch_copy(&values[patch_iter], p);
1073-
fprintf(stdout, "Fill patch KEY: %s (%.5f, %.5f)\n", values[patch_iter].name, values[patch_iter].x, values[patch_iter].y);
1074-
1072+
_dt_color_checker_patch_copy(&values[patch_iter], p);
10751073
}
10761074
else
10771075
{
@@ -1347,14 +1345,19 @@ int dt_colorchecker_find_CGAT_reference_files(GList **ref_colorcheckers_files)
13471345
const char *filename;
13481346
while((filename = g_dir_read_name(dir)) != NULL)
13491347
{
1350-
dt_colorchecker_label_t *CGATS_label = _dt_colorchecker_user_ref_add_label(filename, user_it8_dir);
1351-
if(CGATS_label)
1348+
const char *dot = &filename[safe_strlen(filename) - 1];
1349+
while(dot && *dot != '.')dot--;
1350+
if(dot && g_strcmp0(dot, ".cht") != 0)
13521351
{
1353-
*ref_colorcheckers_files = g_list_append(*ref_colorcheckers_files, CGATS_label);
1354-
nb++;
1352+
dt_colorchecker_label_t *CGATS_label = _dt_colorchecker_user_ref_add_label(filename, user_it8_dir);
1353+
if(CGATS_label)
1354+
{
1355+
*ref_colorcheckers_files = g_list_append(*ref_colorcheckers_files, CGATS_label);
1356+
nb++;
1357+
}
1358+
else
1359+
fprintf(stderr, "Warning: failed to load CGATS file '%s' in %s\n", filename, user_it8_dir);
13551360
}
1356-
else
1357-
fprintf(stderr, "Error: failed to load CGATS file '%s' in %s\n", filename, user_it8_dir);
13581361
}
13591362
g_dir_close(dir);
13601363
}

src/common/colorchecker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef enum dt_color_checker_targets
3939
// helper to deal with patch color
4040
typedef struct dt_color_checker_patch
4141
{
42-
const char *name; // mnemonic name for the patch
42+
char *name; // mnemonic name for the patch
4343
dt_aligned_pixel_t Lab; // reference color in CIE Lab
4444

4545
// (x, y) position of the patch center, relatively to the guides (white dots)

0 commit comments

Comments
 (0)