diff options
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/writer.c b/src/writer.c index 612c2620..43f2ebe5 100644 --- a/src/writer.c +++ b/src/writer.c @@ -244,9 +244,9 @@ sink(const void* buf, size_t len, SerdWriter* writer) if (written != len) { if (errno) { const char* const message = strerror(errno); - w_err(writer, SERD_ERR_BAD_WRITE, "write error (%s)\n", message); + w_err(writer, SERD_BAD_WRITE, "write error (%s)\n", message); } else { - w_err(writer, SERD_ERR_BAD_WRITE, "write error\n"); + w_err(writer, SERD_BAD_WRITE, "write error\n"); } } @@ -256,7 +256,7 @@ sink(const void* buf, size_t len, SerdWriter* writer) SERD_NODISCARD static inline SerdStatus esink(const void* buf, size_t len, SerdWriter* writer) { - return sink(buf, len, writer) == len ? SERD_SUCCESS : SERD_ERR_BAD_WRITE; + return sink(buf, len, writer) == len ? SERD_SUCCESS : SERD_BAD_WRITE; } // Write a single character, as an escape for single byte characters @@ -271,8 +271,7 @@ write_character(SerdWriter* writer, const uint32_t c = parse_utf8_char(utf8, size); switch (*size) { case 0: - *st = - w_err(writer, SERD_ERR_BAD_TEXT, "invalid UTF-8 start: %X\n", utf8[0]); + *st = w_err(writer, SERD_BAD_TEXT, "invalid UTF-8 start: %X\n", utf8[0]); return 0; case 1: snprintf(escape, sizeof(escape), "\\u%04X", utf8[0]); @@ -331,7 +330,7 @@ write_uri(SerdWriter* writer, const char* utf8, size_t n_bytes, SerdStatus* st) const size_t n_bulk = sink(&utf8[i], j - i, writer); len += n_bulk; if (n_bulk != j - i) { - *st = SERD_ERR_BAD_WRITE; + *st = SERD_BAD_WRITE; return len; } @@ -366,7 +365,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_BAD_WRITE || (writer->flags & SERD_WRITE_STRICT)) ? st : SERD_SUCCESS; } @@ -754,7 +753,7 @@ write_uri_node(SerdWriter* const writer, if (!has_scheme && !supports_uriref(writer) && !serd_env_base_uri(writer->env, NULL)->buf) { return w_err(writer, - SERD_ERR_BAD_ARG, + SERD_BAD_ARG, "syntax does not support URI reference <%s>\n", node->buf); } @@ -961,7 +960,7 @@ serd_writer_write_statement(SerdWriter* writer, if (!is_resource(subject) || !is_resource(predicate) || !object || !object->buf) { - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } // Simple case: write a line of NTriples or NQuads @@ -1101,8 +1100,7 @@ serd_writer_end_anon(SerdWriter* writer, const SerdNode* node) } if (serd_stack_is_empty(&writer->anon_stack)) { - return w_err( - writer, SERD_ERR_UNKNOWN, "unexpected end of anonymous node\n"); + return w_err(writer, SERD_BAD_CALL, "unexpected end of anonymous node\n"); } // Write the end separator ']' and pop the context |