diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2013-03-05 19:48:32 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2013-03-05 19:48:32 +0000 |
| commit | 113113f4b0041d0a1d0c1fbf7faa94fad314f9ec (patch) | |
| tree | 477a753912038b252fde908452aad7e135117436 /cpp | |
| parent | c777514af0d4b8b7d68284166955190f21efed12 (diff) | |
| download | qpid-python-113113f4b0041d0a1d0c1fbf7faa94fad314f9ec.tar.gz | |
QPID-4558: Selectors for C++ broker
- Small fixes:
* Missing include file (accidentally included under gcc)
* Workaround some strange VS 2008 issue.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1452960 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
| -rw-r--r-- | cpp/src/qpid/broker/SelectorToken.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cpp/src/qpid/broker/SelectorToken.cpp b/cpp/src/qpid/broker/SelectorToken.cpp index 509d56af4b..3fd4abbc49 100644 --- a/cpp/src/qpid/broker/SelectorToken.cpp +++ b/cpp/src/qpid/broker/SelectorToken.cpp @@ -25,6 +25,7 @@ #include <algorithm> #include <iostream> #include <cassert> +#include <cctype> namespace qpid { namespace broker { @@ -93,7 +94,7 @@ struct RWEntry { TokenType type; }; -bool caseless(const char* s1, const char* s2) +inline bool caseless(const char* s1, const char* s2) { do { char ls1 = std::tolower(*s1); @@ -107,12 +108,8 @@ bool caseless(const char* s1, const char* s2) return false; } -bool operator<(const RWEntry& r, const char* rhs) { - return caseless(r.word, rhs); -} - -bool operator<(const char* rhs, const RWEntry& r) { - return caseless(rhs, r.word); +inline bool operator<(const RWEntry& lhs, const RWEntry& rhs) { + return caseless(lhs.word, rhs.word); } } @@ -138,7 +135,9 @@ bool tokeniseReservedWord(Token& tok) if ( tok.type != T_IDENTIFIER ) return false; - std::pair<const RWEntry*, const RWEntry*> entry = std::equal_range(&reserved[0], &reserved[reserved_size], tok.val.c_str()); + RWEntry rw; + rw.word = tok.val.c_str(); + std::pair<const RWEntry*, const RWEntry*> entry = std::equal_range(&reserved[0], &reserved[reserved_size], rw); if ( entry.first==entry.second ) return false; |
