diff options
author | David Robillard <d@drobilla.net> | 2018-09-30 20:45:52 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-11-25 22:12:47 +0100 |
commit | 904ef9ccffbc86f5514e028732737a48a149bd59 (patch) | |
tree | fe48f33bdf3c9feb6a0e71a76ebff084929ab6cf | |
parent | 4e7bf77fd35a76ef6b3e97e6182c58698d86421f (diff) | |
download | serd-904ef9ccffbc86f5514e028732737a48a149bd59.tar.gz serd-904ef9ccffbc86f5514e028732737a48a149bd59.tar.bz2 serd-904ef9ccffbc86f5514e028732737a48a149bd59.zip |
Fix warnings
-rw-r--r-- | src/env.c | 9 | ||||
-rw-r--r-- | src/n3.c | 5 | ||||
-rw-r--r-- | src/stack.h | 2 |
3 files changed, 9 insertions, 7 deletions
@@ -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 @@ -1348,11 +1348,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 11b31222..29db1e77 100644 --- a/src/stack.h +++ b/src/stack.h @@ -88,7 +88,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) { |