Commit 0a1f7e35 authored by Martin Sustrik's avatar Martin Sustrik

Merge branch 'maint'

* maint:
  Prior to this patch prefix_tree asserts.
  Fix for signaler_t on HP-UX and AIX platforms
  Mikael Kjaer added to AUTHORS

Conflicts:
	src/trie.cpp
parents a81a3739 14853c2d
...@@ -5,6 +5,7 @@ Alexej Lotz <alexej.lotz@arcor.de> ...@@ -5,6 +5,7 @@ Alexej Lotz <alexej.lotz@arcor.de>
Asko Kauppi <askok@dnainternet.net> Asko Kauppi <askok@dnainternet.net>
Barak Amar <barak.amar@gmail.com> Barak Amar <barak.amar@gmail.com>
Bernd Prager <bernd@prager.ws> Bernd Prager <bernd@prager.ws>
Bernd Melchers <melchers@ZEDAT.FU-Berlin.DE>
Brian Buchanan <bwb@holo.org> Brian Buchanan <bwb@holo.org>
Chris Wong <chris@chriswongstudio.com> Chris Wong <chris@chriswongstudio.com>
Conrad D. Steenberg <conrad.steenberg@caltech.edu> Conrad D. Steenberg <conrad.steenberg@caltech.edu>
...@@ -25,6 +26,7 @@ Martin Lucina <mato@kotelna.sk> ...@@ -25,6 +26,7 @@ Martin Lucina <mato@kotelna.sk>
Martin Sustrik <sustrik@250bpm.com> Martin Sustrik <sustrik@250bpm.com>
Matus Hamorsky <mhamorsky@gmail.com> Matus Hamorsky <mhamorsky@gmail.com>
McClain Looney <m@loonsoft.com> McClain Looney <m@loonsoft.com>
Mikael Helbo Kjaer <mhk@designtech.dk>
Pavel Gushcha <pavimus@gmail.com> Pavel Gushcha <pavimus@gmail.com>
Pavol Malosek <malosek@fastmq.com> Pavol Malosek <malosek@fastmq.com>
Pieter Hintjens <ph@imatix.com> Pieter Hintjens <ph@imatix.com>
......
...@@ -184,7 +184,7 @@ void zmq::signaler_t::send (const command_t &cmd_) ...@@ -184,7 +184,7 @@ void zmq::signaler_t::send (const command_t &cmd_)
zmq_assert (nbytes == sizeof (command_t)); zmq_assert (nbytes == sizeof (command_t));
} }
bool zmq::signaler_t::recv (command_t &cmd_, bool block_) bool zmq::signaler_t::recv (command_t *cmd_, bool block_)
{ {
if (block_) { if (block_) {
...@@ -199,7 +199,7 @@ bool zmq::signaler_t::recv (command_t &cmd_, bool block_) ...@@ -199,7 +199,7 @@ bool zmq::signaler_t::recv (command_t &cmd_, bool block_)
bool result; bool result;
ssize_t nbytes; ssize_t nbytes;
do { do {
nbytes = ::recv (r, buffer, sizeof (command_t), 0); nbytes = ::recv (r, (char*) cmd_, sizeof (command_t), 0);
} while (nbytes == -1 && errno == EINTR); } while (nbytes == -1 && errno == EINTR);
if (nbytes == -1 && errno == EAGAIN) { if (nbytes == -1 && errno == EAGAIN) {
result = false; result = false;
...@@ -213,7 +213,7 @@ bool zmq::signaler_t::recv (command_t &cmd_, bool block_) ...@@ -213,7 +213,7 @@ bool zmq::signaler_t::recv (command_t &cmd_, bool block_)
result = true; result = true;
} }
if (block_) if (block_) {
// Set the reader to non-blocking mode. // Set the reader to non-blocking mode.
int flags = fcntl (r, F_GETFL, 0); int flags = fcntl (r, F_GETFL, 0);
......
...@@ -42,7 +42,7 @@ zmq::trie_t::~trie_t () ...@@ -42,7 +42,7 @@ zmq::trie_t::~trie_t ()
if (count == 1) if (count == 1)
delete next.node; delete next.node;
else if (count > 1) { else if (count > 1) {
for (unsigned char i = 0; i != count; ++i) for (unsigned short i = 0; i != count; ++i)
if (next.table [i]) if (next.table [i])
delete next.table [i]; delete next.table [i];
free (next.table); free (next.table);
...@@ -74,7 +74,7 @@ void zmq::trie_t::add (unsigned char *prefix_, size_t size_) ...@@ -74,7 +74,7 @@ void zmq::trie_t::add (unsigned char *prefix_, size_t size_)
next.table = (trie_t**) next.table = (trie_t**)
malloc (sizeof (trie_t*) * count); malloc (sizeof (trie_t*) * count);
zmq_assert (next.table); zmq_assert (next.table);
for (unsigned char i = 0; i != count; ++i) for (unsigned short i = 0; i != count; ++i)
next.table [i] = 0; next.table [i] = 0;
min = std::min (min, c); min = std::min (min, c);
next.table [oldc - min] = oldp; next.table [oldc - min] = oldp;
...@@ -82,25 +82,25 @@ void zmq::trie_t::add (unsigned char *prefix_, size_t size_) ...@@ -82,25 +82,25 @@ void zmq::trie_t::add (unsigned char *prefix_, size_t size_)
else if (min < c) { else if (min < c) {
// The new character is above the current character range. // The new character is above the current character range.
unsigned char old_count = count; unsigned short old_count = count;
count = c - min + 1; count = c - min + 1;
next.table = (trie_t**) realloc ((void*) next.table, next.table = (trie_t**) realloc ((void*) next.table,
sizeof (trie_t*) * count); sizeof (trie_t*) * count);
zmq_assert (next.table); 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; next.table [i] = NULL;
} }
else { else {
// The new character is below the current character range. // The new character is below the current character range.
unsigned char old_count = count; unsigned short old_count = count;
count = (min + old_count) - c; count = (min + old_count) - c;
next.table = (trie_t**) realloc ((void*) next.table, next.table = (trie_t**) realloc ((void*) next.table,
sizeof (trie_t*) * count); sizeof (trie_t*) * count);
zmq_assert (next.table); zmq_assert (next.table);
memmove (next.table + min - c, next.table, memmove (next.table + min - c, next.table,
old_count * sizeof (trie_t*)); old_count * sizeof (trie_t*));
for (unsigned char i = 0; i != min - c; i++) for (unsigned short i = 0; i != min - c; i++)
next.table [i] = NULL; next.table [i] = NULL;
min = c; min = c;
} }
......
...@@ -42,7 +42,7 @@ namespace zmq ...@@ -42,7 +42,7 @@ namespace zmq
uint32_t refcnt; uint32_t refcnt;
unsigned char min; unsigned char min;
unsigned char count; unsigned short count;
union { union {
class trie_t *node; class trie_t *node;
class trie_t **table; class trie_t **table;
......
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