From 71f06fab915f20d10b4b97d6c927087228b51f6e Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 29 Nov 2012 22:33:04 +0100 Subject: [PATCH] Trivial 64-bit warning fixes. --- src/body.cpp | 4 ++-- src/net/imap/IMAPConnection.cpp | 4 ++-- src/net/pop3/POP3Store.cpp | 8 ++++---- src/net/smtp/SMTPTransport.cpp | 4 ++-- src/security/sasl/SASLContext.cpp | 4 ++-- src/security/sasl/SASLSession.cpp | 4 ++-- src/security/sasl/SASLSocket.cpp | 12 ++++++------ src/security/sasl/builtinSASLMechanism.cpp | 12 ++++++------ src/utility/encoder/b64Encoder.cpp | 4 ++-- src/utility/encoder/qpEncoder.cpp | 8 ++++---- src/utility/encoder/uuEncoder.cpp | 8 ++++---- src/utility/progressListener.cpp | 8 ++++---- vmime/security/sasl/SASLContext.hpp | 4 ++-- vmime/security/sasl/SASLMechanism.hpp | 12 ++++++------ vmime/security/sasl/SASLSession.hpp | 4 ++-- vmime/security/sasl/SASLSocket.hpp | 4 ++-- vmime/security/sasl/builtinSASLMechanism.hpp | 12 ++++++------ vmime/utility/progressListener.hpp | 16 ++++++++-------- 18 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/body.cpp b/src/body.cpp index 732fa8b5..e235d49a 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -520,7 +520,7 @@ const string body::generateRandomBoundaryString() // Generate a string of random characters unsigned int r = utility::random::getTime(); - unsigned int m = sizeof(unsigned int); + unsigned int m = static_cast (sizeof(unsigned int)); for (size_t i = 2 ; i < (sizeof(boundary) / sizeof(boundary[0]) - 1) ; ++i) { @@ -530,7 +530,7 @@ const string body::generateRandomBoundaryString() if (--m == 0) { r = utility::random::getNext(); - m = sizeof(unsigned int); + m = static_cast (sizeof(unsigned int)); } } diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp index 6c8b400e..35c3dbe5 100644 --- a/src/net/imap/IMAPConnection.cpp +++ b/src/net/imap/IMAPConnection.cpp @@ -381,10 +381,10 @@ void IMAPConnection::authenticateSASL() } byte_t* challenge = 0; - int challengeLen = 0; + long challengeLen = 0; byte_t* resp = 0; - int respLen = 0; + long respLen = 0; try { diff --git a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp index 8233cdb2..f8a8ec0a 100644 --- a/src/net/pop3/POP3Store.cpp +++ b/src/net/pop3/POP3Store.cpp @@ -466,10 +466,10 @@ void POP3Store::authenticateSASL() case RESPONSE_READY: { byte_t* challenge = 0; - int challengeLen = 0; + long challengeLen = 0; byte_t* resp = 0; - int respLen = 0; + long respLen = 0; try { @@ -749,7 +749,7 @@ void POP3Store::readResponse(string& buffer, const bool multiLine, utility::progressListener* progress) { bool foundTerminator = false; - int current = 0, total = 0; + long current = 0, total = 0; if (progress) progress->start(total); @@ -846,7 +846,7 @@ void POP3Store::readResponse(string& buffer, const bool multiLine, void POP3Store::readResponse(utility::outputStream& os, utility::progressListener* progress, const int predictedSize) { - int current = 0, total = predictedSize; + long current = 0, total = predictedSize; string temp; bool codeDone = false; diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp index eb29e65d..7c67fa02 100644 --- a/src/net/smtp/SMTPTransport.cpp +++ b/src/net/smtp/SMTPTransport.cpp @@ -381,10 +381,10 @@ void SMTPTransport::authenticateSASL() case 334: { byte_t* challenge = 0; - int challengeLen = 0; + long challengeLen = 0; byte_t* resp = 0; - int respLen = 0; + long respLen = 0; try { diff --git a/src/security/sasl/SASLContext.cpp b/src/security/sasl/SASLContext.cpp index 8c623124..bf601b35 100644 --- a/src/security/sasl/SASLContext.cpp +++ b/src/security/sasl/SASLContext.cpp @@ -106,7 +106,7 @@ ref SASLContext::suggestMechanism } -void SASLContext::decodeB64(const string& input, byte_t** output, int* outputLen) +void SASLContext::decodeB64(const string& input, byte_t** output, long* outputLen) { string res; @@ -127,7 +127,7 @@ void SASLContext::decodeB64(const string& input, byte_t** output, int* outputLen } -const string SASLContext::encodeB64(const byte_t* input, const int inputLen) +const string SASLContext::encodeB64(const byte_t* input, const long inputLen) { string res; diff --git a/src/security/sasl/SASLSession.cpp b/src/security/sasl/SASLSession.cpp index dcf53452..1ab6d577 100644 --- a/src/security/sasl/SASLSession.cpp +++ b/src/security/sasl/SASLSession.cpp @@ -99,8 +99,8 @@ ref SASLSession::getContext() bool SASLSession::evaluateChallenge - (const byte_t* challenge, const int challengeLen, - byte_t** response, int* responseLen) + (const byte_t* challenge, const long challengeLen, + byte_t** response, long* responseLen) { return m_mech->step(thisRef().dynamicCast (), challenge, challengeLen, response, responseLen); diff --git a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp index 531e4188..c3498d22 100644 --- a/src/security/sasl/SASLSocket.cpp +++ b/src/security/sasl/SASLSocket.cpp @@ -83,7 +83,7 @@ SASLSocket::size_type SASLSocket::getBlockSize() const void SASLSocket::receive(string& buffer) { - const int n = receiveRaw(m_recvBuffer, sizeof(m_recvBuffer)); + const size_type n = receiveRaw(m_recvBuffer, sizeof(m_recvBuffer)); buffer = string(m_recvBuffer, n); } @@ -93,7 +93,7 @@ SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count { if (m_pendingLen != 0) { - const int copyLen = + const size_type copyLen = (count >= m_pendingLen ? m_pendingLen : count); std::copy(m_pendingBuffer + m_pendingPos, @@ -115,10 +115,10 @@ SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count return copyLen; } - const int n = m_wrapped->receiveRaw(buffer, count); + const size_type n = m_wrapped->receiveRaw(buffer, count); byte_t* output = 0; - int outputLen = 0; + long outputLen = 0; m_session->getMechanism()->decode (m_session, reinterpret_cast (buffer), n, @@ -156,7 +156,7 @@ void SASLSocket::send(const string& buffer) void SASLSocket::sendRaw(const char* buffer, const size_type count) { byte_t* output = 0; - int outputLen = 0; + long outputLen = 0; m_session->getMechanism()->encode (m_session, reinterpret_cast (buffer), count, @@ -180,7 +180,7 @@ void SASLSocket::sendRaw(const char* buffer, const size_type count) SASLSocket::size_type SASLSocket::sendRawNonBlocking(const char* buffer, const size_type count) { byte_t* output = 0; - int outputLen = 0; + long outputLen = 0; m_session->getMechanism()->encode (m_session, reinterpret_cast (buffer), count, diff --git a/src/security/sasl/builtinSASLMechanism.cpp b/src/security/sasl/builtinSASLMechanism.cpp index 9501fb4b..618f4a3b 100644 --- a/src/security/sasl/builtinSASLMechanism.cpp +++ b/src/security/sasl/builtinSASLMechanism.cpp @@ -63,8 +63,8 @@ const string builtinSASLMechanism::getName() const bool builtinSASLMechanism::step - (ref sess, const byte_t* challenge, const int challengeLen, - byte_t** response, int* responseLen) + (ref sess, const byte_t* challenge, const long challengeLen, + byte_t** response, long* responseLen) { char* output = 0; size_t outputLen = 0; @@ -121,8 +121,8 @@ bool builtinSASLMechanism::isComplete() const void builtinSASLMechanism::encode - (ref sess, const byte_t* input, const int inputLen, - byte_t** output, int* outputLen) + (ref sess, const byte_t* input, const long inputLen, + byte_t** output, long* outputLen) { char* coutput = 0; size_t coutputLen = 0; @@ -154,8 +154,8 @@ void builtinSASLMechanism::encode void builtinSASLMechanism::decode - (ref sess, const byte_t* input, const int inputLen, - byte_t** output, int* outputLen) + (ref sess, const byte_t* input, const long inputLen, + byte_t** output, long* outputLen) { char* coutput = 0; size_t coutputLen = 0; diff --git a/src/utility/encoder/b64Encoder.cpp b/src/utility/encoder/b64Encoder.cpp index 58ef3200..85c972f9 100644 --- a/src/utility/encoder/b64Encoder.cpp +++ b/src/utility/encoder/b64Encoder.cpp @@ -197,8 +197,8 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in, // Process the data char buffer[16384]; - int bufferLength = 0; - int bufferPos = 0; + utility::stream::size_type bufferLength = 0; + utility::stream::size_type bufferPos = 0; utility::stream::size_type total = 0; utility::stream::size_type inTotal = 0; diff --git a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp index ab8db2e4..9e1c1ccd 100644 --- a/src/utility/encoder/qpEncoder.cpp +++ b/src/utility/encoder/qpEncoder.cpp @@ -178,8 +178,8 @@ utility::stream::size_type qpEncoder::encode(utility::inputStream& in, // Process the data char buffer[16384]; - int bufferLength = 0; - int bufferPos = 0; + utility::stream::size_type bufferLength = 0; + utility::stream::size_type bufferPos = 0; string::size_type curCol = 0; @@ -380,8 +380,8 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in, const bool rfc2047 = getProperties().getProperty ("rfc2047", false); char buffer[16384]; - int bufferLength = 0; - int bufferPos = 0; + utility::stream::size_type bufferLength = 0; + utility::stream::size_type bufferPos = 0; unsigned char outBuffer[16384]; int outBufferPos = 0; diff --git a/src/utility/encoder/uuEncoder.cpp b/src/utility/encoder/uuEncoder.cpp index 0ddfbac6..4b4d83d8 100644 --- a/src/utility/encoder/uuEncoder.cpp +++ b/src/utility/encoder/uuEncoder.cpp @@ -52,15 +52,15 @@ const std::vector uuEncoder::getAvailableProperties() const // This is the character encoding function to make a character printable -static inline unsigned char UUENCODE(const unsigned char c) +static inline unsigned char UUENCODE(const unsigned long c) { - return ((c & 077) + ' '); + return static_cast ((c & 077) + ' '); } // Single character decoding -static inline unsigned char UUDECODE(const unsigned char c) +static inline unsigned char UUDECODE(const unsigned long c) { - return ((c - ' ') & 077); + return static_cast ((c - ' ') & 077); } diff --git a/src/utility/progressListener.cpp b/src/utility/progressListener.cpp index 4bce3721..ae5a455c 100644 --- a/src/utility/progressListener.cpp +++ b/src/utility/progressListener.cpp @@ -31,7 +31,7 @@ namespace utility { // progressListenerSizeAdapter progressListenerSizeAdapter::progressListenerSizeAdapter - (progressListener* list, const int total) + (progressListener* list, const long total) : m_wrapped(list), m_total(total) { } @@ -43,14 +43,14 @@ bool progressListenerSizeAdapter::cancel() const } -void progressListenerSizeAdapter::start(const int predictedTotal) +void progressListenerSizeAdapter::start(const long predictedTotal) { if (m_wrapped) m_wrapped->start(predictedTotal); } -void progressListenerSizeAdapter::progress(const int current, const int currentTotal) +void progressListenerSizeAdapter::progress(const long current, const long currentTotal) { if (m_wrapped) { @@ -62,7 +62,7 @@ void progressListenerSizeAdapter::progress(const int current, const int currentT } -void progressListenerSizeAdapter::stop(const int total) +void progressListenerSizeAdapter::stop(const long total) { if (m_wrapped) { diff --git a/vmime/security/sasl/SASLContext.hpp b/vmime/security/sasl/SASLContext.hpp index acdb8b5a..5c8df51f 100644 --- a/vmime/security/sasl/SASLContext.hpp +++ b/vmime/security/sasl/SASLContext.hpp @@ -93,7 +93,7 @@ public: * @param output output buffer * @param outputLen length of output buffer */ - void decodeB64(const string& input, byte_t** output, int* outputLen); + void decodeB64(const string& input, byte_t** output, long* outputLen); /** Helper function for encoding challenge in Base64. * @@ -101,7 +101,7 @@ public: * @param inputLen length of input buffer * @return Base64-encoded challenge */ - const string encodeB64(const byte_t* input, const int inputLen); + const string encodeB64(const byte_t* input, const long inputLen); private: diff --git a/vmime/security/sasl/SASLMechanism.hpp b/vmime/security/sasl/SASLMechanism.hpp index 678a3030..1411418a 100644 --- a/vmime/security/sasl/SASLMechanism.hpp +++ b/vmime/security/sasl/SASLMechanism.hpp @@ -72,8 +72,8 @@ public: */ virtual bool step (ref sess, - const byte_t* challenge, const int challengeLen, - byte_t** response, int* responseLen) = 0; + const byte_t* challenge, const long challengeLen, + byte_t** response, long* responseLen) = 0; /** Check whether authentication has completed. If false, more * calls to evaluateChallenge() are needed to complete the @@ -98,8 +98,8 @@ public: * 'outputLen' are undetermined) */ virtual void encode(ref sess, - const byte_t* input, const int inputLen, - byte_t** output, int* outputLen) = 0; + const byte_t* input, const long inputLen, + byte_t** output, long* outputLen) = 0; /** Decode data according to negotiated SASL mechanism. This * might mean that data is integrity or privacy protected. @@ -115,8 +115,8 @@ public: * 'outputLen' are undetermined) */ virtual void decode(ref sess, - const byte_t* input, const int inputLen, - byte_t** output, int* outputLen) = 0; + const byte_t* input, const long inputLen, + byte_t** output, long* outputLen) = 0; }; diff --git a/vmime/security/sasl/SASLSession.hpp b/vmime/security/sasl/SASLSession.hpp index 63645b18..cfe67d94 100644 --- a/vmime/security/sasl/SASLSession.hpp +++ b/vmime/security/sasl/SASLSession.hpp @@ -108,8 +108,8 @@ public: * 'responseLen' are undetermined) */ bool evaluateChallenge - (const byte_t* challenge, const int challengeLen, - byte_t** response, int* responseLen); + (const byte_t* challenge, const long challengeLen, + byte_t** response, long* responseLen); /** Return a socket in which transmitted data is integrity * and/or privacy protected, depending on the QOP (Quality of diff --git a/vmime/security/sasl/SASLSocket.hpp b/vmime/security/sasl/SASLSocket.hpp index d6f4ecd9..0e7d209f 100644 --- a/vmime/security/sasl/SASLSocket.hpp +++ b/vmime/security/sasl/SASLSocket.hpp @@ -75,8 +75,8 @@ private: ref m_wrapped; byte_t* m_pendingBuffer; - int m_pendingPos; - int m_pendingLen; + size_type m_pendingPos; + size_type m_pendingLen; char m_recvBuffer[65536]; }; diff --git a/vmime/security/sasl/builtinSASLMechanism.hpp b/vmime/security/sasl/builtinSASLMechanism.hpp index aa6c360c..c88f35b3 100644 --- a/vmime/security/sasl/builtinSASLMechanism.hpp +++ b/vmime/security/sasl/builtinSASLMechanism.hpp @@ -56,18 +56,18 @@ public: const string getName() const; bool step(ref sess, - const byte_t* challenge, const int challengeLen, - byte_t** response, int* responseLen); + const byte_t* challenge, const long challengeLen, + byte_t** response, long* responseLen); bool isComplete() const; void encode(ref sess, - const byte_t* input, const int inputLen, - byte_t** output, int* outputLen); + const byte_t* input, const long inputLen, + byte_t** output, long* outputLen); void decode(ref sess, - const byte_t* input, const int inputLen, - byte_t** output, int* outputLen); + const byte_t* input, const long inputLen, + byte_t** output, long* outputLen); private: diff --git a/vmime/utility/progressListener.hpp b/vmime/utility/progressListener.hpp index 39b884ab..fdc86660 100644 --- a/vmime/utility/progressListener.hpp +++ b/vmime/utility/progressListener.hpp @@ -55,20 +55,20 @@ public: * @param predictedTotal predicted amount of units (this has * no concrete meaning: these are not bytes, nor percentage...) */ - virtual void start(const int predictedTotal) = 0; + virtual void start(const long predictedTotal) = 0; /** Called during the operation (can be called several times). * * @param current current position * @param currentTotal adjusted total amount of units */ - virtual void progress(const int current, const int currentTotal) = 0; + virtual void progress(const long current, const long currentTotal) = 0; /** Called at the end of the operation. * * @param total final total amount of units */ - virtual void stop(const int total) = 0; + virtual void stop(const long total) = 0; }; @@ -86,18 +86,18 @@ public: * @param list wrapped progress listener (can be NULL) * @param total predicted total */ - progressListenerSizeAdapter(progressListener* list, const int total); + progressListenerSizeAdapter(progressListener* list, const long total); bool cancel() const; - void start(const int predictedTotal); - void progress(const int current, const int currentTotal); - void stop(const int total); + void start(const long predictedTotal); + void progress(const long current, const long currentTotal); + void stop(const long total); private: progressListener* m_wrapped; - int m_total; + long m_total; };