aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/env.c6
-rw-r--r--src/writer.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/src/env.c b/src/env.c
index adda27ba..d969d3df 100644
--- a/src/env.c
+++ b/src/env.c
@@ -215,8 +215,8 @@ serd_env_expand(const SerdEnv* env,
{
const uint8_t* const colon = (const uint8_t*)memchr(
curie->buf, ':', curie->n_bytes + 1);
- if (!colon) {
- return SERD_ERR_BAD_ARG; // Invalid CURIE
+ if (curie->type != SERD_CURIE || !colon) {
+ return SERD_ERR_BAD_ARG;
}
const size_t name_len = colon - curie->buf;
@@ -228,7 +228,7 @@ serd_env_expand(const SerdEnv* env,
uri_suffix->len = curie->n_bytes - (colon - curie->buf) - 1;
return SERD_SUCCESS;
}
- return SERD_ERR_NOT_FOUND;
+ return SERD_ERR_BAD_CURIE;
}
SERD_API
diff --git a/src/writer.c b/src/writer.c
index 58cf17ee..603ca65e 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -525,14 +525,14 @@ write_curie(SerdWriter* const writer,
const Field field,
const SerdStatementFlags flags)
{
- SerdChunk prefix;
- SerdChunk suffix;
+ SerdChunk prefix;
+ SerdChunk suffix;
+ SerdStatus st;
switch (writer->syntax) {
case SERD_NTRIPLES:
case SERD_NQUADS:
- if (serd_env_expand(writer->env, node, &prefix, &suffix)) {
- w_err(writer, SERD_ERR_BAD_CURIE,
- "undefined namespace prefix `%s'\n", node->buf);
+ if ((st = serd_env_expand(writer->env, node, &prefix, &suffix))) {
+ w_err(writer, st, "undefined namespace prefix `%s'\n", node->buf);
return false;
}
write_sep(writer, SEP_URI_BEGIN);