aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-12 16:46:29 +0000
committerDavid Robillard <d@drobilla.net>2011-05-12 16:46:29 +0000
commitbc42e1c4d4fc93592b7e08226192acc00ccf37bc (patch)
treee97b59d0c982c42317a8eebd1851d69a2f85879c /src/writer.c
parent13a66cb43bcab491f6ae7e1280b035b2522496c8 (diff)
downloadserd-bc42e1c4d4fc93592b7e08226192acc00ccf37bc.tar.gz
serd-bc42e1c4d4fc93592b7e08226192acc00ccf37bc.tar.bz2
serd-bc42e1c4d4fc93592b7e08226192acc00ccf37bc.zip
Use conventional string lengths not including NULL terminator
git-svn-id: http://svn.drobilla.net/serd/trunk@174 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/writer.c b/src/writer.c
index bd78a050..d0120cde 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -214,7 +214,7 @@ write_node(SerdWriter* writer,
} // else fall through
case SERD_BLANK_ID:
writer->sink("_:", 2, writer->stream);
- writer->sink(node->buf, node->n_bytes - 1, writer->stream);
+ writer->sink(node->buf, node->n_bytes, writer->stream);
break;
case SERD_CURIE:
switch (writer->syntax) {
@@ -229,7 +229,7 @@ write_node(SerdWriter* writer,
writer->sink(">", 1, writer->stream);
break;
case SERD_TURTLE:
- writer->sink(node->buf, node->n_bytes - 1, writer->stream);
+ writer->sink(node->buf, node->n_bytes, writer->stream);
}
break;
case SERD_LITERAL:
@@ -238,7 +238,7 @@ write_node(SerdWriter* writer,
if (!strcmp((const char*)datatype->buf, NS_XSD "boolean")
|| !strcmp((const char*)datatype->buf, NS_XSD "decimal")
|| !strcmp((const char*)datatype->buf, NS_XSD "integer")) {
- writer->sink(node->buf, node->n_bytes - 1, writer->stream);
+ writer->sink(node->buf, node->n_bytes, writer->stream);
break;
}
}
@@ -246,16 +246,16 @@ write_node(SerdWriter* writer,
&& ((node->flags & SERD_HAS_NEWLINE)
|| (node->flags & SERD_HAS_QUOTE))) {
writer->sink("\"\"\"", 3, writer->stream);
- write_text(writer, WRITE_LONG_STRING, node->buf, node->n_bytes - 1, '\0');
+ write_text(writer, WRITE_LONG_STRING, node->buf, node->n_bytes, '\0');
writer->sink("\"\"\"", 3, writer->stream);
} else {
writer->sink("\"", 1, writer->stream);
- write_text(writer, WRITE_STRING, node->buf, node->n_bytes - 1, '"');
+ write_text(writer, WRITE_STRING, node->buf, node->n_bytes, '"');
writer->sink("\"", 1, writer->stream);
}
if (lang && lang->buf) {
writer->sink("@", 1, writer->stream);
- writer->sink(lang->buf, lang->n_bytes - 1, writer->stream);
+ writer->sink(lang->buf, lang->n_bytes, writer->stream);
} else if (datatype && datatype->buf) {
writer->sink("^^", 2, writer->stream);
write_node(writer, datatype, NULL, NULL, false);
@@ -271,7 +271,7 @@ write_node(SerdWriter* writer,
SerdNode prefix;
SerdChunk suffix;
if (serd_env_qualify(writer->env, node, &prefix, &suffix)) {
- write_text(writer, WRITE_URI, prefix.buf, prefix.n_bytes - 1, '>');
+ write_text(writer, WRITE_URI, prefix.buf, prefix.n_bytes, '>');
writer->sink(":", 1, writer->stream);
write_text(writer, WRITE_URI, suffix.buf, suffix.len, '>');
return true;
@@ -289,7 +289,7 @@ write_node(SerdWriter* writer,
}
}
writer->sink("<", 1, writer->stream);
- write_text(writer, WRITE_URI, node->buf, node->n_bytes - 1, '>');
+ write_text(writer, WRITE_URI, node->buf, node->n_bytes, '>');
writer->sink(">", 1, writer->stream);
return true;
}
@@ -472,7 +472,7 @@ serd_writer_set_base_uri(SerdWriter* writer,
reset_context(writer);
}
writer->sink("@base <", 7, writer->stream);
- writer->sink(uri->buf, uri->n_bytes - 1, writer->stream);
+ writer->sink(uri->buf, uri->n_bytes, writer->stream);
writer->sink("> .\n", 4, writer->stream);
}
reset_context(writer);
@@ -494,9 +494,9 @@ serd_writer_set_prefix(SerdWriter* writer,
reset_context(writer);
}
writer->sink("@prefix ", 8, writer->stream);
- writer->sink(name->buf, name->n_bytes - 1, writer->stream);
+ writer->sink(name->buf, name->n_bytes, writer->stream);
writer->sink(": <", 3, writer->stream);
- write_text(writer, WRITE_URI, uri->buf, uri->n_bytes - 1, '>');
+ write_text(writer, WRITE_URI, uri->buf, uri->n_bytes, '>');
writer->sink("> .\n", 4, writer->stream);
}
reset_context(writer);