diff options
| author | Alan Conway <aconway@apache.org> | 2011-08-25 20:41:28 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2011-08-25 20:41:28 +0000 |
| commit | 2fdd2cc2ade41e213ae35818532574bbf40f4a00 (patch) | |
| tree | 42fb45022ea08fee157abf50713b452acf5eda5d /cpp/src/qpid/log/Statement.cpp | |
| parent | 7f99badd1c330b3a6032b15a13aca1cde81274d3 (diff) | |
| download | qpid-python-2fdd2cc2ade41e213ae35818532574bbf40f4a00.tar.gz | |
QPID-3384: Enable DTX transactions in a cluster.
- Replicate DTX state to new members joining.
- Use cluster timer for DTX timeouts.
- Incidental: quote nulls in qpid::Msg messages (XIDs often have null characters)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1161742 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/log/Statement.cpp')
| -rw-r--r-- | cpp/src/qpid/log/Statement.cpp | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/cpp/src/qpid/log/Statement.cpp b/cpp/src/qpid/log/Statement.cpp index 6a32b50096..85b4d1f155 100644 --- a/cpp/src/qpid/log/Statement.cpp +++ b/cpp/src/qpid/log/Statement.cpp @@ -24,35 +24,9 @@ #include <ctype.h> namespace qpid { +std::string quote(const std::string& str); // Defined in Msg.cpp namespace log { -namespace { -using namespace std; - -struct NonPrint { bool operator()(unsigned char c) { return !isprint(c) && !isspace(c); } }; - -const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - -std::string quote(const std::string& str) { - NonPrint nonPrint; - size_t n = std::count_if(str.begin(), str.end(), nonPrint); - if (n==0) return str; - std::string ret; - ret.reserve(str.size()+2*n); // Avoid extra allocations. - for (string::const_iterator i = str.begin(); i != str.end(); ++i) { - if (nonPrint(*i)) { - ret.push_back('\\'); - ret.push_back('x'); - ret.push_back(hex[((*i) >> 4)&0xf]); - ret.push_back(hex[(*i) & 0xf]); - } - else ret.push_back(*i); - } - return ret; -} - -} - void Statement::log(const std::string& message) { Logger::instance().log(*this, quote(message)); } |
