Browse Source

ZOOKEEPER-2049 Yosemite build failure: htonll conflict (Till Toenshoff via michim)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1632209 13f79535-47bb-0310-9956-ffa450edef68
Michi Mutsuzaki 10 years ago
parent
commit
92794f1722
5 changed files with 14 additions and 11 deletions
  1. 4 1
      CHANGES.txt
  2. 1 1
      src/c/include/recordio.h
  3. 3 3
      src/c/src/recordio.c
  4. 3 3
      src/c/src/zookeeper.c
  5. 3 3
      src/c/tests/ZKMocks.cc

+ 4 - 1
CHANGES.txt

@@ -7,7 +7,10 @@ BUGFIXES:
 
 
   ZOOKEEPER-2026 Startup order in ServerCnxnFactory-ies is wrong (Stevo Slavic via rakeshr)
   ZOOKEEPER-2026 Startup order in ServerCnxnFactory-ies is wrong (Stevo Slavic via rakeshr)
 
 
- ZOOKEEPER-2058 rat: exclude *.cer files  (michim via rakeshr)
+  ZOOKEEPER-2058 rat: exclude *.cer files  (michim via rakeshr)
+
+  ZOOKEEPER-2049 Yosemite build failure: htonll conflict (Till Toenshoff via
+  michim)
 
 
 IMPROVEMENTS:
 IMPROVEMENTS:
   ZOOKEEPER-1660 Documentation for Dynamic Reconfiguration (Reed Wanderman-Milne via shralex)  
   ZOOKEEPER-1660 Documentation for Dynamic Reconfiguration (Reed Wanderman-Milne via shralex)  

+ 1 - 1
src/c/include/recordio.h

@@ -70,7 +70,7 @@ void close_buffer_iarchive(struct iarchive **ia);
 char *get_buffer(struct oarchive *);
 char *get_buffer(struct oarchive *);
 int get_buffer_len(struct oarchive *);
 int get_buffer_len(struct oarchive *);
 
 
-int64_t htonll(int64_t v);
+int64_t zoo_htonll(int64_t v);
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }

+ 3 - 3
src/c/src/recordio.c

@@ -80,7 +80,7 @@ int oa_serialize_int(struct oarchive *oa, const char *tag, const int32_t *d)
     priv->off+=sizeof(i);
     priv->off+=sizeof(i);
     return 0;
     return 0;
 }
 }
-int64_t htonll(int64_t v)
+int64_t zoo_htonll(int64_t v)
 {
 {
     int i = 0;
     int i = 0;
     char *s = (char *)&v;
     char *s = (char *)&v;
@@ -98,7 +98,7 @@ int64_t htonll(int64_t v)
 
 
 int oa_serialize_long(struct oarchive *oa, const char *tag, const int64_t *d)
 int oa_serialize_long(struct oarchive *oa, const char *tag, const int64_t *d)
 {
 {
-    const int64_t i = htonll(*d);
+    const int64_t i = zoo_htonll(*d);
     struct buff_struct *priv = oa->priv;
     struct buff_struct *priv = oa->priv;
     if ((priv->len - priv->off) < sizeof(i)) {
     if ((priv->len - priv->off) < sizeof(i)) {
         int rc = resize_buffer(priv, priv->len + sizeof(i));
         int rc = resize_buffer(priv, priv->len + sizeof(i));
@@ -207,7 +207,7 @@ int ia_deserialize_long(struct iarchive *ia, const char *tag, int64_t *count)
     }
     }
     memcpy(count, priv->buffer+priv->off, sizeof(*count));
     memcpy(count, priv->buffer+priv->off, sizeof(*count));
     priv->off+=sizeof(*count);
     priv->off+=sizeof(*count);
-    v = htonll(*count); // htonll and  ntohll do the same
+    v = zoo_htonll(*count); // htonll and  ntohll do the same
     *count = v;
     *count = v;
     return 0;
     return 0;
 }
 }

+ 3 - 3
src/c/src/zookeeper.c

@@ -1798,7 +1798,7 @@ static int serialize_prime_connect(struct connect_req *req, char* buffer){
     memcpy(buffer + offset, &req->protocolVersion, sizeof(req->protocolVersion));
     memcpy(buffer + offset, &req->protocolVersion, sizeof(req->protocolVersion));
     offset = offset +  sizeof(req->protocolVersion);
     offset = offset +  sizeof(req->protocolVersion);
 
 
-    req->lastZxidSeen = htonll(req->lastZxidSeen);
+    req->lastZxidSeen = zoo_htonll(req->lastZxidSeen);
     memcpy(buffer + offset, &req->lastZxidSeen, sizeof(req->lastZxidSeen));
     memcpy(buffer + offset, &req->lastZxidSeen, sizeof(req->lastZxidSeen));
     offset = offset +  sizeof(req->lastZxidSeen);
     offset = offset +  sizeof(req->lastZxidSeen);
 
 
@@ -1806,7 +1806,7 @@ static int serialize_prime_connect(struct connect_req *req, char* buffer){
     memcpy(buffer + offset, &req->timeOut, sizeof(req->timeOut));
     memcpy(buffer + offset, &req->timeOut, sizeof(req->timeOut));
     offset = offset +  sizeof(req->timeOut);
     offset = offset +  sizeof(req->timeOut);
 
 
-    req->sessionId = htonll(req->sessionId);
+    req->sessionId = zoo_htonll(req->sessionId);
     memcpy(buffer + offset, &req->sessionId, sizeof(req->sessionId));
     memcpy(buffer + offset, &req->sessionId, sizeof(req->sessionId));
     offset = offset +  sizeof(req->sessionId);
     offset = offset +  sizeof(req->sessionId);
 
 
@@ -1843,7 +1843,7 @@ static int deserialize_prime_response(struct prime_struct *resp, char* buffer)
      memcpy(&resp->sessionId, buffer + offset, sizeof(resp->sessionId));
      memcpy(&resp->sessionId, buffer + offset, sizeof(resp->sessionId));
      offset = offset +  sizeof(resp->sessionId);
      offset = offset +  sizeof(resp->sessionId);
 
 
-     resp->sessionId = htonll(resp->sessionId);
+     resp->sessionId = zoo_htonll(resp->sessionId);
      memcpy(&resp->passwd_len, buffer + offset, sizeof(resp->passwd_len));
      memcpy(&resp->passwd_len, buffer + offset, sizeof(resp->passwd_len));
      offset = offset +  sizeof(resp->passwd_len);
      offset = offset +  sizeof(resp->passwd_len);
 
 

+ 3 - 3
src/c/tests/ZKMocks.cc

@@ -41,7 +41,7 @@ HandshakeRequest* HandshakeRequest::parse(const std::string& buf) {
     int offset=sizeof(req->protocolVersion);
     int offset=sizeof(req->protocolVersion);
 
 
     memcpy(&req->lastZxidSeen,buf.data()+offset,sizeof(req->lastZxidSeen));
     memcpy(&req->lastZxidSeen,buf.data()+offset,sizeof(req->lastZxidSeen));
-    req->lastZxidSeen = htonll(req->lastZxidSeen);
+    req->lastZxidSeen = zoo_htonll(req->lastZxidSeen);
     offset+=sizeof(req->lastZxidSeen);
     offset+=sizeof(req->lastZxidSeen);
 
 
     memcpy(&req->timeOut,buf.data()+offset,sizeof(req->timeOut));
     memcpy(&req->timeOut,buf.data()+offset,sizeof(req->timeOut));
@@ -49,7 +49,7 @@ HandshakeRequest* HandshakeRequest::parse(const std::string& buf) {
     offset+=sizeof(req->timeOut);
     offset+=sizeof(req->timeOut);
 
 
     memcpy(&req->sessionId,buf.data()+offset,sizeof(req->sessionId));
     memcpy(&req->sessionId,buf.data()+offset,sizeof(req->sessionId));
-    req->sessionId = htonll(req->sessionId);
+    req->sessionId = zoo_htonll(req->sessionId);
     offset+=sizeof(req->sessionId);
     offset+=sizeof(req->sessionId);
 
 
     memcpy(&req->passwd_len,buf.data()+offset,sizeof(req->passwd_len));
     memcpy(&req->passwd_len,buf.data()+offset,sizeof(req->passwd_len));
@@ -339,7 +339,7 @@ string HandshakeResponse::toString() const {
     buf.append((char*)&tmp,sizeof(tmp));
     buf.append((char*)&tmp,sizeof(tmp));
     tmp=htonl(timeOut);
     tmp=htonl(timeOut);
     buf.append((char*)&tmp,sizeof(tmp));
     buf.append((char*)&tmp,sizeof(tmp));
-    int64_t tmp64=htonll(sessionId);
+    int64_t tmp64=zoo_htonll(sessionId);
     buf.append((char*)&tmp64,sizeof(sessionId));
     buf.append((char*)&tmp64,sizeof(sessionId));
     tmp=htonl(passwd_len);
     tmp=htonl(passwd_len);
     buf.append((char*)&tmp,sizeof(tmp));
     buf.append((char*)&tmp,sizeof(tmp));