summaryrefslogtreecommitdiff
path: root/src/prefix_tree.cpp
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2010-09-08 15:25:45 +0200
committerMartin Lucina <martin@lucina.net>2012-01-23 08:53:27 +0100
commit90d73cba9cd1d1724f38ed82fc0eefb1781c9c20 (patch)
tree1760872164a93384d1adb90db9c8d41777dbb2a7 /src/prefix_tree.cpp
parentcf026feae205bfeb7e007f6afd0e8d7b283865c8 (diff)
parent5ba1cb20fe6f6699cef1cc726718e760cd4c9af1 (diff)
Imported Debian patch 2.0.9.dfsg-1debian/2.0.9.dfsg-1
Diffstat (limited to 'src/prefix_tree.cpp')
-rw-r--r--src/prefix_tree.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/prefix_tree.cpp b/src/prefix_tree.cpp
index 51225d6..6d4f084 100644
--- a/src/prefix_tree.cpp
+++ b/src/prefix_tree.cpp
@@ -42,7 +42,7 @@ zmq::prefix_tree_t::~prefix_tree_t ()
if (count == 1)
delete next.node;
else if (count > 1) {
- for (unsigned char i = 0; i != count; ++i)
+ for (unsigned short i = 0; i != count; ++i)
if (next.table [i])
delete next.table [i];
free (next.table);
@@ -74,7 +74,7 @@ void zmq::prefix_tree_t::add (unsigned char *prefix_, size_t size_)
next.table = (prefix_tree_t**)
malloc (sizeof (prefix_tree_t*) * count);
zmq_assert (next.table);
- for (unsigned char i = 0; i != count; ++i)
+ for (unsigned short i = 0; i != count; ++i)
next.table [i] = 0;
min = std::min (min, c);
next.table [oldc - min] = oldp;
@@ -82,25 +82,25 @@ void zmq::prefix_tree_t::add (unsigned char *prefix_, size_t size_)
else if (min < c) {
// The new character is above the current character range.
- unsigned char old_count = count;
+ unsigned short old_count = count;
count = c - min + 1;
next.table = (prefix_tree_t**) realloc ((void*) next.table,
sizeof (prefix_tree_t*) * count);
zmq_assert (next.table);
- for (unsigned char i = old_count; i != count; i++)
+ for (unsigned short i = old_count; i != count; i++)
next.table [i] = NULL;
}
else {
// The new character is below the current character range.
- unsigned char old_count = count;
+ unsigned short old_count = count;
count = (min + old_count) - c;
next.table = (prefix_tree_t**) realloc ((void*) next.table,
sizeof (prefix_tree_t*) * count);
zmq_assert (next.table);
memmove (next.table + min - c, next.table,
old_count * sizeof (prefix_tree_t*));
- for (unsigned char i = 0; i != min - c; i++)
+ for (unsigned short i = 0; i != min - c; i++)
next.table [i] = NULL;
min = c;
}