aboutsummaryrefslogtreecommitdiffstats
path: root/libfonts_get_output_rendering_settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'libfonts_get_output_rendering_settings.c')
-rw-r--r--libfonts_get_output_rendering_settings.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libfonts_get_output_rendering_settings.c b/libfonts_get_output_rendering_settings.c
index 2cecf3c..b9c1efd 100644
--- a/libfonts_get_output_rendering_settings.c
+++ b/libfonts_get_output_rendering_settings.c
@@ -18,6 +18,7 @@ getn(const char *file_part1, size_t file_part1_len, const char *file_part2,
int in_a_section = 0;
char *value;
unsigned int found_fields = 0;
+ size_t lineno = 0;
if (file_part1_len > SIZE_MAX - file_part2_len - 1)
goto enomem;
@@ -51,7 +52,7 @@ open_again:
case ENODEV:
case ENOTDIR:
case ENXIO:
- /* TODO print warning using `ctx` */
+ warning(ctx, errno, "libfonts_get_default_rendering_settings", "failed to open %s:", path);
goto out;
default:
goto out;
@@ -71,6 +72,7 @@ open_again:
if (!len)
break;
line[len -= 1] = '\0';
+ lineno++;
while (isblank(*line)) {
line++;
@@ -93,7 +95,7 @@ open_again:
} else if (!in_a_section) {
value = libfonts_confsplit__(line);
if (!value) {
- /* TODO warning */
+ warning(ctx, 0, "libfonts_get_output_rendering_settings", "bad line in %s at line %zu", path, lineno);
continue;
}
/* TODO aliases should be declarable above the first "[%s]" */
@@ -101,21 +103,24 @@ open_again:
} else if (in_the_section) {
value = libfonts_confsplit__(line);
if (!value) {
- /* TODO warning */
+ warning(ctx, 0, "libfonts_get_output_rendering_settings", "bad line in %s at line %zu", path, lineno);
continue;
}
#define X(INDEX, CONFNAME, CNAME, DEFVAL, PARSER)\
if (!strcmp(line, CONFNAME)) {\
if (found_fields & (1U << INDEX)) {\
- /* TODO warning */\
+ warning(ctx, 0, "libfonts_get_output_rendering_settings",\
+ "duplicate definition in %s at line %zu", path, lineno); \
}\
found_fields |= (1U << INDEX);\
if (!PARSER(&settings->CNAME, value)) {\
- /* TODO warning */\
+ warning(ctx, 0, "libfonts_get_output_rendering_settings",\
+ "invalid value in %s at line %zu: %s", path, lineno, value);\
}\
} else
LIST_RENDERING_SETTINGS(X,) {
- /* TODO warning */
+ warning(ctx, 0, "libfonts_get_output_rendering_settings",\
+ "bad definition in %s at line %zu: %s", path, lineno, line);\
}
#undef X
}