From bef0b11248839cc2c6feb7629d75daa7069db814 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 30 Sep 2018 20:45:52 +0200 Subject: Fix warnings --- src/env.c | 9 ++++++--- src/n3.c | 5 ++--- src/stack.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/env.c b/src/env.c index 6714186e..6095ee30 100644 --- a/src/env.c +++ b/src/env.c @@ -20,6 +20,7 @@ #include "serd/serd.h" +#include #include #include #include @@ -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 e0898823..46de68cf 100644 --- a/src/n3.c +++ b/src/n3.c @@ -1334,11 +1334,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) { -- cgit v1.2.1