Commit bb66f3cc authored by Martin Sustrik's avatar Martin Sustrik

Bug in trie fixed (issue 277)

When there were both '0' and '255' subnodes in (mtrie)
the removal of the node resulted in an infinite loop.
Fixed.
Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent 65037162
......@@ -171,7 +171,7 @@ void zmq::mtrie_t::rm_helper (pipe_t *pipe_, unsigned char **buff_,
}
// If there are multiple subnodes.
for (unsigned char c = 0; c != count; c++) {
for (unsigned short c = 0; c != count; c++) {
(*buff_) [buffsize_] = min + c;
if (next.table [c])
next.table [c]->rm_helper (pipe_, buff_, buffsize_ + 1,
......
......@@ -219,7 +219,7 @@ void zmq::trie_t::apply_helper (
}
// If there are multiple subnodes.
for (unsigned char c = 0; c != count; c++) {
for (unsigned short c = 0; c != count; c++) {
(*buff_) [buffsize_] = min + c;
if (next.table [c])
next.table [c]->apply_helper (buff_, buffsize_ + 1, maxbuffsize_,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment