From 2638ded01498b41a67574a2eae4181106226a933 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 9 Jul 2021 21:36:52 -0400 Subject: Replace SERD_WRITE_STRICT flag with SERD_WRITE_LAX The unset value for flags should represent the best default, which in this case is strict parsing. Lax parsing is the riskier opt-in option. --- src/writer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/writer.c') diff --git a/src/writer.c b/src/writer.c index 74d858c7..2b1bc39d 100644 --- a/src/writer.c +++ b/src/writer.c @@ -338,7 +338,7 @@ write_uri(SerdWriter* writer, const char* utf8, size_t n_bytes, SerdStatus* st) size_t size = 0; len += write_character(writer, (const uint8_t*)utf8 + i, &size, st); i += size; - if (*st && (writer->flags & SERD_WRITE_STRICT)) { + if (*st && !(writer->flags & SERD_WRITE_LAX)) { break; } @@ -361,7 +361,7 @@ ewrite_uri(SerdWriter* writer, const char* utf8, size_t n_bytes) SerdStatus st = SERD_SUCCESS; write_uri(writer, utf8, n_bytes, &st); - return (st == SERD_ERR_BAD_WRITE || (writer->flags & SERD_WRITE_STRICT)) + return (st == SERD_ERR_BAD_WRITE || !(writer->flags & SERD_WRITE_LAX)) ? st : SERD_SUCCESS; } @@ -527,7 +527,7 @@ write_text(SerdWriter* writer, // Write UTF-8 character size_t size = 0; write_character(writer, (const uint8_t*)utf8 + i - 1, &size, &st); - if (st && (writer->flags & SERD_WRITE_STRICT)) { + if (st && !(writer->flags & SERD_WRITE_LAX)) { return st; } @@ -541,7 +541,7 @@ write_text(SerdWriter* writer, } } - return (writer->flags & SERD_WRITE_STRICT) ? st : SERD_SUCCESS; + return (writer->flags & SERD_WRITE_LAX) ? SERD_SUCCESS : st; } typedef struct { -- cgit v1.2.1