Skip to content

Commit

Permalink
Fix deserialize().
Browse files Browse the repository at this point in the history
  • Loading branch information
esstrifork committed Jan 6, 2012
1 parent 03c4b43 commit 2a2b818
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions c_src/bloom_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ class bloom_filter

inline size_t serialized_size() const
{
return ((table_size_/bits_per_char)+(6*sizeof(size_t))+(salt_.size()*sizeof(bloom_type)));
return ((table_size_/bits_per_char)+(5*sizeof(size_t) + sizeof(double))+(salt_.size()*sizeof(bloom_type)));
}


inline void serialize(unsigned char** data, unsigned int* len)
{
// TODO: Make this format platform independent!
size_t buf_sz = serialized_size();
char *buffer = new char[ buf_sz ];
serializer s(buffer, buf_sz);
Expand Down Expand Up @@ -318,8 +318,7 @@ class bloom_filter
double desired_false_positive_probability_;

serializer s((char*)data, len);
s.clear();
s.read_from_buffer((char*)data, len);
s.reset();

s >> salt_count_;
s >> table_size_;
Expand Down

0 comments on commit 2a2b818

Please sign in to comment.