From 3fe2365234ae91d5e82f9c1ba2de782337b8e42a Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 27 Oct 2015 13:21:26 -0400 Subject: [PATCH] [fix] signed size_t in trie_set_tail --- src/trie.c | 4 ++-- src/trie.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trie.c b/src/trie.c index 31157789..cae61640 100644 --- a/src/trie.c +++ b/src/trie.c @@ -454,10 +454,10 @@ void trie_add_tail(trie_t *self, unsigned char *tail) { uchar_array_push(self->tail, '\0'); } -void trie_set_tail(trie_t *self, unsigned char *tail, int32_t tail_pos) { +void trie_set_tail(trie_t *self, unsigned char *tail, uint32_t tail_pos) { log_debug("Setting tail: %s at pos %d\n", tail, tail_pos); size_t tail_len = strlen((char *)tail); - size_t num_appends = ((size_t)tail_pos + tail_len) - self->tail->n; + ssize_t num_appends = (ssize_t)(tail_pos + tail_len) - self->tail->n; int i = 0; // Pad with 0s if we're short diff --git a/src/trie.h b/src/trie.h index ba6a8970..88864f3e 100644 --- a/src/trie.h +++ b/src/trie.h @@ -109,7 +109,7 @@ uint32_t trie_add_transition(trie_t *self, uint32_t node_id, unsigned char c); void trie_make_room_for(trie_t *self, uint32_t next_id); void trie_add_tail(trie_t *self, unsigned char *tail); -void trie_set_tail(trie_t *self, unsigned char *tail, int32_t tail_pos); +void trie_set_tail(trie_t *self, unsigned char *tail, uint32_t tail_pos); int32_t trie_separate_tail(trie_t *self, uint32_t from_index, unsigned char *tail, uint32_t data); void trie_tail_merge(trie_t *self, uint32_t old_node_id, unsigned char *suffix, uint32_t data);