diff options
author | John Langford <jl@hunch.net> | 2009-10-18 22:09:20 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2009-10-18 22:09:20 +0400 |
commit | 427c583435bf2d7fbf47fa059fa36f6ac5cb5dee (patch) | |
tree | 013ad87cf752d82e0576fe424ec9e2e79e2b6cd4 /simple_label.cc | |
parent | b4b8454dbc787770dd28c6edea30c06648e12810 (diff) |
Various bugfixes for cluster support
Diffstat (limited to 'simple_label.cc')
-rw-r--r-- | simple_label.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/simple_label.cc b/simple_label.cc index 4319221f..7c79ad7b 100644 --- a/simple_label.cc +++ b/simple_label.cc @@ -16,13 +16,14 @@ size_t read_cached_simple_label(void* v, io_buf& cache) { label_data* ld = (label_data*) v; char *c; - size_t total = sizeof(ld->label)+sizeof(ld->weight)+int_size; size_t tag_size = 0; + size_t total = sizeof(ld->label)+sizeof(ld->weight)+sizeof(tag_size); if (buf_read(cache, c, total) < total) return 0; c = bufread_simple_label(ld,c); - - c = run_len_decode(c, tag_size); + + tag_size = *(size_t*)c; + c += sizeof(tag_size); cache.set(c); if (buf_read(cache, c, tag_size) < tag_size) @@ -47,10 +48,12 @@ void cache_simple_label(void* v, io_buf& cache) { char *c; label_data* ld = (label_data*) v; - buf_write(cache, c, sizeof(ld->label)+sizeof(ld->weight)+int_size+ld->tag.index()); + buf_write(cache, c, sizeof(ld->label)+sizeof(ld->weight)+sizeof(ld->tag.index())+ld->tag.index()); c = bufcache_simple_label(ld,c); - c = run_len_encode(c, ld->tag.index()); + *(size_t*)c = ld->tag.index(); + c += sizeof(ld->tag.index()); + memcpy(c,ld->tag.begin,ld->tag.index()); c += ld->tag.index(); |