aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/env.c9
-rw-r--r--src/n3.c5
-rw-r--r--src/stack.h2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/env.c b/src/env.c
index 5f71e266..da468e09 100644
--- a/src/env.c
+++ b/src/env.c
@@ -20,6 +20,7 @@
#include "serd/serd.h"
+#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -226,13 +227,14 @@ serd_env_expand_in_place(const SerdEnv* env,
return SERD_ERR_BAD_ARG;
}
- const size_t name_len = colon - str;
+ assert(colon >= str);
+ const size_t name_len = (size_t)(colon - str);
const SerdPrefix* const prefix = serd_env_find(env, str, name_len);
if (prefix) {
uri_prefix->buf = serd_node_get_string(prefix->uri);
uri_prefix->len = prefix->uri->n_bytes;
uri_suffix->buf = colon + 1;
- uri_suffix->len = curie->n_bytes - (colon - str) - 1;
+ uri_suffix->len = curie->n_bytes - name_len - 1;
return SERD_SUCCESS;
}
return SERD_ERR_BAD_CURIE;
@@ -275,8 +277,9 @@ serd_env_expand(const SerdEnv* env, const SerdNode* node)
return serd_new_resolved_uri_i(
serd_node_get_string(node), &env->base_uri);
default:
- return NULL;
+ break;
}
+ return NULL;
}
void
diff --git a/src/n3.c b/src/n3.c
index 163e29b5..f748496e 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -1342,11 +1342,10 @@ read_directive(SerdReader* reader)
switch (peek_byte(reader)) {
case 'B': case 'b': return read_base(reader, sparql, true);
case 'P': case 'p': return read_prefixID(reader, sparql, true);
- default:
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid directive\n");
+ default: break;
}
- return SERD_SUCCESS;
+ return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid directive\n");
}
static SerdStatus
diff --git a/src/stack.h b/src/stack.h
index 5c84df37..c703fce4 100644
--- a/src/stack.h
+++ b/src/stack.h
@@ -90,7 +90,7 @@ static inline void*
serd_stack_push_aligned(SerdStack* stack, size_t n_bytes, size_t align)
{
// Push padding if necessary
- const uint8_t pad = align - stack->size % align;
+ const size_t pad = align - stack->size % align;
if (pad > 0) {
void* padding = serd_stack_push(stack, pad);
if (!padding) {