summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-11-05 16:05:18 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-11-05 16:05:18 +0100
commitbb66f3cc3bc2a76d10f16e1206f35480eb250a07 (patch)
tree70c3b54c1b37283964c7faa85e54a00f9cd3b816 /src
parent6503716203552966e2fa6a6b4839bc0e001f9478 (diff)
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: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r--src/mtrie.cpp2
-rw-r--r--src/trie.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mtrie.cpp b/src/mtrie.cpp
index 1c96c98..65b4fe8 100644
--- a/src/mtrie.cpp
+++ b/src/mtrie.cpp
@@ -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,
diff --git a/src/trie.cpp b/src/trie.cpp
index 9718c77..d53a135 100644
--- a/src/trie.cpp
+++ b/src/trie.cpp
@@ -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_,