|
| 1 | +diff --git src/c/include/recordio.h src/c/include/recordio.h |
| 2 | +index 4e1b78e..90f458b 100644 |
| 3 | +--- src/c/include/recordio.h |
| 4 | ++++ src/c/include/recordio.h |
| 5 | +@@ -73,7 +73,7 @@ void close_buffer_iarchive(struct iarchive **ia); |
| 6 | + char *get_buffer(struct oarchive *); |
| 7 | + int get_buffer_len(struct oarchive *); |
| 8 | + |
| 9 | +-int64_t htonll(int64_t v); |
| 10 | ++int64_t zoo_htonll(int64_t v); |
| 11 | + |
| 12 | + #ifdef __cplusplus |
| 13 | + } |
| 14 | +diff --git src/c/src/recordio.c src/c/src/recordio.c |
| 15 | +index cf8a1ac..41797fb 100644 |
| 16 | +--- src/c/src/recordio.c |
| 17 | ++++ src/c/src/recordio.c |
| 18 | +@@ -80,7 +80,7 @@ int oa_serialize_int(struct oarchive *oa, const char *tag, const int32_t *d) |
| 19 | + priv->off+=sizeof(i); |
| 20 | + return 0; |
| 21 | + } |
| 22 | +-int64_t htonll(int64_t v) |
| 23 | ++int64_t zoo_htonll(int64_t v) |
| 24 | + { |
| 25 | + int i = 0; |
| 26 | + char *s = (char *)&v; |
| 27 | +@@ -98,7 +98,7 @@ int64_t htonll(int64_t v) |
| 28 | + |
| 29 | + int oa_serialize_long(struct oarchive *oa, const char *tag, const int64_t *d) |
| 30 | + { |
| 31 | +- const int64_t i = htonll(*d); |
| 32 | ++ const int64_t i = zoo_htonll(*d); |
| 33 | + struct buff_struct *priv = oa->priv; |
| 34 | + if ((priv->len - priv->off) < sizeof(i)) { |
| 35 | + int rc = resize_buffer(priv, priv->len + sizeof(i)); |
| 36 | +@@ -207,7 +207,7 @@ int ia_deserialize_long(struct iarchive *ia, const char *tag, int64_t *count) |
| 37 | + } |
| 38 | + memcpy(count, priv->buffer+priv->off, sizeof(*count)); |
| 39 | + priv->off+=sizeof(*count); |
| 40 | +- v = htonll(*count); // htonll and ntohll do the same |
| 41 | ++ v = zoo_htonll(*count); // htonll and ntohll do the same |
| 42 | + *count = v; |
| 43 | + return 0; |
| 44 | + } |
| 45 | +diff --git src/c/src/zookeeper.c src/c/src/zookeeper.c |
| 46 | +index 27ecf8a..ba55d27 100644 |
| 47 | +--- src/c/src/zookeeper.c |
| 48 | ++++ src/c/src/zookeeper.c |
| 49 | +@@ -1408,7 +1408,7 @@ static int serialize_prime_connect(struct connect_req *req, char* buffer){ |
| 50 | + memcpy(buffer + offset, &req->protocolVersion, sizeof(req->protocolVersion)); |
| 51 | + offset = offset + sizeof(req->protocolVersion); |
| 52 | + |
| 53 | +- req->lastZxidSeen = htonll(req->lastZxidSeen); |
| 54 | ++ req->lastZxidSeen = zoo_htonll(req->lastZxidSeen); |
| 55 | + memcpy(buffer + offset, &req->lastZxidSeen, sizeof(req->lastZxidSeen)); |
| 56 | + offset = offset + sizeof(req->lastZxidSeen); |
| 57 | + |
| 58 | +@@ -1416,7 +1416,7 @@ static int serialize_prime_connect(struct connect_req *req, char* buffer){ |
| 59 | + memcpy(buffer + offset, &req->timeOut, sizeof(req->timeOut)); |
| 60 | + offset = offset + sizeof(req->timeOut); |
| 61 | + |
| 62 | +- req->sessionId = htonll(req->sessionId); |
| 63 | ++ req->sessionId = zoo_htonll(req->sessionId); |
| 64 | + memcpy(buffer + offset, &req->sessionId, sizeof(req->sessionId)); |
| 65 | + offset = offset + sizeof(req->sessionId); |
| 66 | + |
| 67 | +@@ -1447,7 +1447,7 @@ static int serialize_prime_connect(struct connect_req *req, char* buffer){ |
| 68 | + memcpy(&req->sessionId, buffer + offset, sizeof(req->sessionId)); |
| 69 | + offset = offset + sizeof(req->sessionId); |
| 70 | + |
| 71 | +- req->sessionId = htonll(req->sessionId); |
| 72 | ++ req->sessionId = zoo_htonll(req->sessionId); |
| 73 | + memcpy(&req->passwd_len, buffer + offset, sizeof(req->passwd_len)); |
| 74 | + offset = offset + sizeof(req->passwd_len); |
| 75 | + |
| 76 | +diff --git src/c/tests/ZKMocks.cc src/c/tests/ZKMocks.cc |
| 77 | +index 8916674..69bea16 100644 |
| 78 | +--- src/c/tests/ZKMocks.cc |
| 79 | ++++ src/c/tests/ZKMocks.cc |
| 80 | +@@ -41,7 +41,7 @@ HandshakeRequest* HandshakeRequest::parse(const std::string& buf){ |
| 81 | + int offset=sizeof(req->protocolVersion); |
| 82 | + |
| 83 | + memcpy(&req->lastZxidSeen,buf.data()+offset,sizeof(req->lastZxidSeen)); |
| 84 | +- req->lastZxidSeen = htonll(req->lastZxidSeen); |
| 85 | ++ req->lastZxidSeen = zoo_htonll(req->lastZxidSeen); |
| 86 | + offset+=sizeof(req->lastZxidSeen); |
| 87 | + |
| 88 | + memcpy(&req->timeOut,buf.data()+offset,sizeof(req->timeOut)); |
| 89 | +@@ -49,7 +49,7 @@ HandshakeRequest* HandshakeRequest::parse(const std::string& buf){ |
| 90 | + offset+=sizeof(req->timeOut); |
| 91 | + |
| 92 | + memcpy(&req->sessionId,buf.data()+offset,sizeof(req->sessionId)); |
| 93 | +- req->sessionId = htonll(req->sessionId); |
| 94 | ++ req->sessionId = zoo_htonll(req->sessionId); |
| 95 | + offset+=sizeof(req->sessionId); |
| 96 | + |
| 97 | + memcpy(&req->passwd_len,buf.data()+offset,sizeof(req->passwd_len)); |
| 98 | +@@ -322,7 +322,7 @@ string HandshakeResponse::toString() const { |
| 99 | + buf.append((char*)&tmp,sizeof(tmp)); |
| 100 | + tmp=htonl(timeOut); |
| 101 | + buf.append((char*)&tmp,sizeof(tmp)); |
| 102 | +- int64_t tmp64=htonll(sessionId); |
| 103 | ++ int64_t tmp64=zoo_htonll(sessionId); |
| 104 | + buf.append((char*)&tmp64,sizeof(sessionId)); |
| 105 | + tmp=htonl(passwd_len); |
| 106 | + buf.append((char*)&tmp,sizeof(tmp)); |
0 commit comments