Mercurial > hg > th-libs
diff th_config.c @ 521:77495c646208
Fix parsing and writing of strings with simple escape sequences in config files.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 26 Dec 2019 13:34:19 +0200 |
parents | 8b36f2566cf9 |
children | 3a852e9f70a6 |
line wrap: on
line diff
--- a/th_config.c Thu Dec 26 13:17:32 2019 +0200 +++ b/th_config.c Thu Dec 26 13:34:19 2019 +0200 @@ -587,6 +587,7 @@ SET_MAX_BUF); ctx.parseMode = PM_ERROR; } + isEscaped = FALSE; } ctx.ch = -1; @@ -897,9 +898,9 @@ for (; node != NULL; node = node->next) if (node->data != NULL) { - if (!th_print_indent(fh, nesting, "\"%s\"%s\n", - (char *) node->data, - --n > 0 ? "," : "")) + if (!th_print_indent(fh, nesting, "\"") || + !th_cfg_write_string_escaped(fh, (char *) node->data, '"') || + thfprintf(fh, "\"%s\n", (--n > 0) ? "," : "") < 0) return THERR_FWRITE; }