THRIFT-4745: fixes compiler warnings

This commit is contained in:
James E. King III 2019-01-31 17:11:04 -05:00
parent 2be45e566d
commit 53bd0e6295
4 changed files with 8 additions and 4 deletions

View File

@ -42,9 +42,9 @@ using std::vector;
static const string endl = "\n"; // avoid ostream << std::endl flushes
// largest consecutive integer representable by a double (2 ^ 53 - 1)
static const long max_safe_integer = 0x1fffffffffffff;
static const int64_t max_safe_integer = 0x1fffffffffffff;
// smallest consecutive number representable by a double (-2 ^ 53 + 1)
static const long min_safe_integer = -max_safe_integer;
static const int64_t min_safe_integer = -max_safe_integer;
#include "thrift/generate/t_oop_generator.h"

View File

@ -79,6 +79,10 @@
#include <byteswap.h>
#define ntohll(n) bswap_64(n)
#define htonll(n) bswap_64(n)
#elif defined(_MSC_VER)
#include <stdlib.h>
#define ntohll(n) _byteswap_uint64(n)
#define htonll(n) _byteswap_uint64(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))

View File

@ -161,7 +161,7 @@ class TCompactProtocol(TProtocolBase):
# writes this out as a "var int" which is always positive, and attempting
# to write a negative number results in an infinite loop, so we may
# need to do some conversion here...
tseqid = seqid;
tseqid = seqid
if tseqid < 0:
tseqid = 2147483648 + (2147483648 + tseqid)
self.__writeVarint(tseqid)

View File

@ -74,7 +74,7 @@ class TPedanticProtocol : public _P
{
public:
TPedanticProtocol(std::shared_ptr<TTransport>& transport)
: _P(transport), m_last_seqid(std::numeric_limits<int32_t>::max() - 10) { }
: _P(transport), m_last_seqid((std::numeric_limits<int32_t>::max)() - 10) { }
virtual uint32_t writeMessageBegin_virt(const std::string& name,
const TMessageType messageType,