summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-03-11 20:03:45 +0000
committerAlan Conway <aconway@apache.org>2009-03-11 20:03:45 +0000
commit901d2469c9fa73d6e44b4ca7c673b37fb0323682 (patch)
treedc0aae9a1fc099640aa04f6555a47add9c3e2e79 /cpp/src
parentfb0986888f3a3ac0279cdfad4606cb35ec1b6e43 (diff)
downloadqpid-python-901d2469c9fa73d6e44b4ca7c673b37fb0323682.tar.gz
Fix problems buildling on gcc 4.4 and latest corosync.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@752600 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/cluster/Cpg.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/cpp/src/qpid/cluster/Cpg.cpp b/cpp/src/qpid/cluster/Cpg.cpp
index 92fceba904..915a578989 100644
--- a/cpp/src/qpid/cluster/Cpg.cpp
+++ b/cpp/src/qpid/cluster/Cpg.cpp
@@ -148,9 +148,13 @@ void Cpg::dispatchBlocking() {
string Cpg::errorStr(cpg_error_t err, const std::string& msg) {
std::ostringstream os;
os << msg << ": ";
+ // FIXME aconway 2009-03-11: The commented out cases below are
+ // because of mistakes in the latest corosync header files.
+ // The code should be re-instated when that is sorted out.
+ //
switch (err) {
case CPG_OK: os << "ok"; break;
- case CPG_ERR_LIBRARY: os << "library"; break;
+ // case CPG_ERR_LIBRARY: os << "library"; break;
case CPG_ERR_TIMEOUT: os << "timeout"; break;
case CPG_ERR_TRY_AGAIN: os << "try again"; break;
case CPG_ERR_INVALID_PARAM: os << "invalid param"; break;
@@ -160,8 +164,8 @@ string Cpg::errorStr(cpg_error_t err, const std::string& msg) {
case CPG_ERR_NOT_EXIST: os << "not exist"; break;
case CPG_ERR_EXIST: os << "exist"; break;
case CPG_ERR_NOT_SUPPORTED: os << "not supported"; break;
- case CPG_ERR_SECURITY: os << "security"; break;
- case CPG_ERR_TOO_MANY_GROUPS: os << "too many groups"; break;
+ // case CPG_ERR_SECURITY: os << "security"; break;
+ // case CPG_ERR_TOO_MANY_GROUPS: os << "too many groups"; break;
default: os << ": unknown cpg error " << err;
};
os << " (" << err << ")";
@@ -202,13 +206,19 @@ ostream& operator<<(ostream& o, const ConnectionId& c) {
std::string MemberId::str() const {
char s[8];
- reinterpret_cast<uint32_t&>(s[0]) = htonl(first);
- reinterpret_cast<uint32_t&>(s[4]) = htonl(second);
+ uint32_t x;
+ x = htonl(first);
+ ::memcpy(s, &x, 4);
+ x = htonl(second);
+ ::memcpy(s+4, &x, 4);
return std::string(s,8);
}
MemberId::MemberId(const std::string& s) {
- first = ntohl(reinterpret_cast<const uint32_t&>(s[0]));
- second = ntohl(reinterpret_cast<const uint32_t&>(s[4]));
+ uint32_t x;
+ memcpy(&x, &s[0], 4);
+ first = ntohl(x);
+ memcpy(&x, &s[4], 4);
+ second = ntohl(x);
}
}} // namespace qpid::cluster