[fix] signed size_t in trie_set_tail

This commit is contained in:
Al
2015-10-27 13:21:26 -04:00
parent ad59ba7a7b
commit 3fe2365234
2 changed files with 3 additions and 3 deletions

View File

@@ -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

View File

@@ -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);