You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2009/03/11 21:03:45 UTC

svn commit: r752600 - /qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp

Author: aconway
Date: Wed Mar 11 20:03:45 2009
New Revision: 752600

URL: http://svn.apache.org/viewvc?rev=752600&view=rev
Log:
Fix problems buildling on gcc 4.4 and latest corosync.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp?rev=752600&r1=752599&r2=752600&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Cpg.cpp Wed Mar 11 20:03:45 2009
@@ -148,9 +148,13 @@
 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 @@
       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 @@
 
 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



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org