From 0449579db0f5160e063e8ef5dfbe1c80d488d397 Mon Sep 17 00:00:00 2001 From: Malavan Sotheeswaran Date: Fri, 6 Oct 2023 13:18:02 -0700 Subject: [PATCH] use endian.h for expires too --- src/storage/rocksdb.cpp | 5 ++--- src/storage/rocksdb.h | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/storage/rocksdb.cpp b/src/storage/rocksdb.cpp index eb6a7a7fa..79fa88f8c 100644 --- a/src/storage/rocksdb.cpp +++ b/src/storage/rocksdb.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include "../server.h" #include "../cluster.h" #include "rocksdbfactor_internal.h" @@ -231,7 +230,7 @@ void RocksDBStorageProvider::setExpire(const char *key, size_t cchKey, long long { rocksdb::Status status; std::unique_lock l(m_lock); - long long beExpire = htonll(expire); + long long beExpire = htobe64(expire); std::string prefix((const char *)&beExpire,sizeof(long long)); std::string strKey(key, cchKey); if (m_spbatch != nullptr) @@ -246,7 +245,7 @@ void RocksDBStorageProvider::removeExpire(const char *key, size_t cchKey, long l { rocksdb::Status status; std::unique_lock l(m_lock); - long long beExpire = htonll(expire); + long long beExpire = htobe64(expire); std::string prefix((const char *)&beExpire,sizeof(long long)); std::string strKey(key, cchKey); std::string fullKey = prefix + strKey; diff --git a/src/storage/rocksdb.h b/src/storage/rocksdb.h index 564c9a432..5ded5b605 100644 --- a/src/storage/rocksdb.h +++ b/src/storage/rocksdb.h @@ -6,8 +6,9 @@ #include #ifdef __APPLE__ #include -#define htole16(x) OSSwapHostToLittleInt16(x) -#define le16toh(x) OSSwapLittleToHostInt16(x) +#define htole16 OSSwapHostToLittleInt16 +#define le16toh OSSwapLittleToHostInt16 +#define htobe64 OSSwapHostToBigInt64 #else #include #endif