From 5f9614cf9a8003a772e48d9d2ae5b2877d08a721 Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Sun, 21 Nov 2010 16:59:05 +0000 Subject: [PATCH] THRIFT-916 long long becomes int64_t Patch: Christian Lavoie git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1037500 13f79535-47bb-0310-9956-ffa450edef68 --- contrib/fb303/TClientInfo.cpp | 2 +- lib/cpp/src/protocol/TProtocol.h | 4 ++-- lib/cpp/src/transport/TFileTransport.cpp | 4 ++-- test/cpp/src/TestClient.cpp | 2 +- test/cpp/src/main.cpp | 18 +++++++++--------- test/cpp/src/nb-main.cpp | 18 +++++++++--------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/contrib/fb303/TClientInfo.cpp b/contrib/fb303/TClientInfo.cpp index d0930179..e07eaa8c 100644 --- a/contrib/fb303/TClientInfo.cpp +++ b/contrib/fb303/TClientInfo.cpp @@ -160,7 +160,7 @@ void TClientInfoServerHandler::getStatsStrings(vector& result) { char buf[256]; snprintf(buf, sizeof buf, "%d %s %s %.3f %llu", i, addrStr, callStr, secs, - (unsigned long long)info->getNCalls()); + (uint64_t)info->getNCalls()); result.push_back(buf); } diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h index 6059d139..8e38d88b 100644 --- a/lib/cpp/src/protocol/TProtocol.h +++ b/lib/cpp/src/protocol/TProtocol.h @@ -122,8 +122,8 @@ using apache::thrift::transport::TTransport; # define ntohll(n) bswap_64(n) # define htonll(n) bswap_64(n) # else /* GNUC & GLIBC */ -# define ntohll(n) ( (((unsigned long long)ntohl(n)) << 32) + ntohl(n >> 32) ) -# define htonll(n) ( (((unsigned long long)htonl(n)) << 32) + htonl(n >> 32) ) +# define ntohll(n) ( (((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32) ) +# define htonll(n) ( (((uint64_t)htonl(n)) << 32) + htonl(n >> 32) ) # endif /* GNUC & GLIBC */ #else /* __BYTE_ORDER */ # error "Can't define htonll or ntohll!" diff --git a/lib/cpp/src/transport/TFileTransport.cpp b/lib/cpp/src/transport/TFileTransport.cpp index 8b09ed99..b42a0931 100644 --- a/lib/cpp/src/transport/TFileTransport.cpp +++ b/lib/cpp/src/transport/TFileTransport.cpp @@ -743,7 +743,7 @@ bool TFileTransport::isEventCorrupted() { // 3. size indicates that event crosses chunk boundary T_ERROR("Read corrupt event. Event crosses chunk boundary. Event size:%u Offset:%lld", readState_.event_->eventSize_, - (long long int) (offset_ + readState_.bufferPtr_ + 4)); + (int64_t) (offset_ + readState_.bufferPtr_ + 4)); return true; } @@ -784,7 +784,7 @@ void TFileTransport::performRecovery() { currentEvent_ = NULL; char errorMsg[1024]; sprintf(errorMsg, "TFileTransport: log file corrupted at offset: %lld", - (long long int) (offset_ + readState_.lastDispatchPtr_)); + (int64_t) (offset_ + readState_.lastDispatchPtr_)); GlobalOutput(errorMsg); throw TTransportException(errorMsg); diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp index 4fcf6b18..897153ab 100644 --- a/test/cpp/src/TestClient.cpp +++ b/test/cpp/src/TestClient.cpp @@ -42,7 +42,7 @@ using namespace thrift::test; // Current time, microseconds since the epoch uint64_t now() { - long long ret; + int64_t ret; struct timeval tv; gettimeofday(&tv, NULL); diff --git a/test/cpp/src/main.cpp b/test/cpp/src/main.cpp index 2aad4d60..c4124c30 100644 --- a/test/cpp/src/main.cpp +++ b/test/cpp/src/main.cpp @@ -210,8 +210,8 @@ public: size_t& _workerCount; size_t _loopCount; TType _loopType; - long long _startTime; - long long _endTime; + int64_t _startTime; + int64_t _endTime; bool _done; Monitor _sleep; }; @@ -439,8 +439,8 @@ int main(int argc, char **argv) { (*thread)->start(); } - long long time00; - long long time01; + int64_t time00; + int64_t time01; {Synchronized s(monitor); threadCount = clientCount; @@ -458,18 +458,18 @@ int main(int argc, char **argv) { time01 = Util::currentTime(); } - long long firstTime = 9223372036854775807LL; - long long lastTime = 0; + int64_t firstTime = 9223372036854775807LL; + int64_t lastTime = 0; double averageTime = 0; - long long minTime = 9223372036854775807LL; - long long maxTime = 0; + int64_t minTime = 9223372036854775807LL; + int64_t maxTime = 0; for (set >::iterator ix = clientThreads.begin(); ix != clientThreads.end(); ix++) { shared_ptr client = dynamic_pointer_cast((*ix)->runnable()); - long long delta = client->_endTime - client->_startTime; + int64_t delta = client->_endTime - client->_startTime; assert(delta > 0); diff --git a/test/cpp/src/nb-main.cpp b/test/cpp/src/nb-main.cpp index 8c74a815..6887e4e1 100644 --- a/test/cpp/src/nb-main.cpp +++ b/test/cpp/src/nb-main.cpp @@ -216,8 +216,8 @@ public: size_t& _workerCount; size_t _loopCount; TType _loopType; - long long _startTime; - long long _endTime; + int64_t _startTime; + int64_t _endTime; bool _done; Monitor _sleep; }; @@ -432,8 +432,8 @@ int main(int argc, char **argv) { (*thread)->start(); } - long long time00; - long long time01; + int64_t time00; + int64_t time01; {Synchronized s(monitor); threadCount = clientCount; @@ -451,18 +451,18 @@ int main(int argc, char **argv) { time01 = Util::currentTime(); } - long long firstTime = 9223372036854775807LL; - long long lastTime = 0; + int64_t firstTime = 9223372036854775807LL; + int64_t lastTime = 0; double averageTime = 0; - long long minTime = 9223372036854775807LL; - long long maxTime = 0; + int64_t minTime = 9223372036854775807LL; + int64_t maxTime = 0; for (set >::iterator ix = clientThreads.begin(); ix != clientThreads.end(); ix++) { shared_ptr client = dynamic_pointer_cast((*ix)->runnable()); - long long delta = client->_endTime - client->_startTime; + int64_t delta = client->_endTime - client->_startTime; assert(delta > 0); -- 2.17.1