Trivial 64-bit warning fixes.

This commit is contained in:
Vincent Richard 2012-11-29 22:33:04 +01:00
parent 3e9e8c9265
commit 71f06fab91
18 changed files with 66 additions and 66 deletions

View File

@ -520,7 +520,7 @@ const string body::generateRandomBoundaryString()
// Generate a string of random characters // Generate a string of random characters
unsigned int r = utility::random::getTime(); unsigned int r = utility::random::getTime();
unsigned int m = sizeof(unsigned int); unsigned int m = static_cast <unsigned int>(sizeof(unsigned int));
for (size_t i = 2 ; i < (sizeof(boundary) / sizeof(boundary[0]) - 1) ; ++i) for (size_t i = 2 ; i < (sizeof(boundary) / sizeof(boundary[0]) - 1) ; ++i)
{ {
@ -530,7 +530,7 @@ const string body::generateRandomBoundaryString()
if (--m == 0) if (--m == 0)
{ {
r = utility::random::getNext(); r = utility::random::getNext();
m = sizeof(unsigned int); m = static_cast <unsigned int>(sizeof(unsigned int));
} }
} }

View File

@ -381,10 +381,10 @@ void IMAPConnection::authenticateSASL()
} }
byte_t* challenge = 0; byte_t* challenge = 0;
int challengeLen = 0; long challengeLen = 0;
byte_t* resp = 0; byte_t* resp = 0;
int respLen = 0; long respLen = 0;
try try
{ {

View File

@ -466,10 +466,10 @@ void POP3Store::authenticateSASL()
case RESPONSE_READY: case RESPONSE_READY:
{ {
byte_t* challenge = 0; byte_t* challenge = 0;
int challengeLen = 0; long challengeLen = 0;
byte_t* resp = 0; byte_t* resp = 0;
int respLen = 0; long respLen = 0;
try try
{ {
@ -749,7 +749,7 @@ void POP3Store::readResponse(string& buffer, const bool multiLine,
utility::progressListener* progress) utility::progressListener* progress)
{ {
bool foundTerminator = false; bool foundTerminator = false;
int current = 0, total = 0; long current = 0, total = 0;
if (progress) if (progress)
progress->start(total); progress->start(total);
@ -846,7 +846,7 @@ void POP3Store::readResponse(string& buffer, const bool multiLine,
void POP3Store::readResponse(utility::outputStream& os, void POP3Store::readResponse(utility::outputStream& os,
utility::progressListener* progress, const int predictedSize) utility::progressListener* progress, const int predictedSize)
{ {
int current = 0, total = predictedSize; long current = 0, total = predictedSize;
string temp; string temp;
bool codeDone = false; bool codeDone = false;

View File

@ -381,10 +381,10 @@ void SMTPTransport::authenticateSASL()
case 334: case 334:
{ {
byte_t* challenge = 0; byte_t* challenge = 0;
int challengeLen = 0; long challengeLen = 0;
byte_t* resp = 0; byte_t* resp = 0;
int respLen = 0; long respLen = 0;
try try
{ {

View File

@ -106,7 +106,7 @@ ref <SASLMechanism> 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; 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; string res;

View File

@ -99,8 +99,8 @@ ref <SASLContext> SASLSession::getContext()
bool SASLSession::evaluateChallenge bool SASLSession::evaluateChallenge
(const byte_t* challenge, const int challengeLen, (const byte_t* challenge, const long challengeLen,
byte_t** response, int* responseLen) byte_t** response, long* responseLen)
{ {
return m_mech->step(thisRef().dynamicCast <SASLSession>(), return m_mech->step(thisRef().dynamicCast <SASLSession>(),
challenge, challengeLen, response, responseLen); challenge, challengeLen, response, responseLen);

View File

@ -83,7 +83,7 @@ SASLSocket::size_type SASLSocket::getBlockSize() const
void SASLSocket::receive(string& buffer) 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); buffer = string(m_recvBuffer, n);
} }
@ -93,7 +93,7 @@ SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count
{ {
if (m_pendingLen != 0) if (m_pendingLen != 0)
{ {
const int copyLen = const size_type copyLen =
(count >= m_pendingLen ? m_pendingLen : count); (count >= m_pendingLen ? m_pendingLen : count);
std::copy(m_pendingBuffer + m_pendingPos, std::copy(m_pendingBuffer + m_pendingPos,
@ -115,10 +115,10 @@ SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count
return copyLen; return copyLen;
} }
const int n = m_wrapped->receiveRaw(buffer, count); const size_type n = m_wrapped->receiveRaw(buffer, count);
byte_t* output = 0; byte_t* output = 0;
int outputLen = 0; long outputLen = 0;
m_session->getMechanism()->decode m_session->getMechanism()->decode
(m_session, reinterpret_cast <const byte_t*>(buffer), n, (m_session, reinterpret_cast <const byte_t*>(buffer), n,
@ -156,7 +156,7 @@ void SASLSocket::send(const string& buffer)
void SASLSocket::sendRaw(const char* buffer, const size_type count) void SASLSocket::sendRaw(const char* buffer, const size_type count)
{ {
byte_t* output = 0; byte_t* output = 0;
int outputLen = 0; long outputLen = 0;
m_session->getMechanism()->encode m_session->getMechanism()->encode
(m_session, reinterpret_cast <const byte_t*>(buffer), count, (m_session, reinterpret_cast <const byte_t*>(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) SASLSocket::size_type SASLSocket::sendRawNonBlocking(const char* buffer, const size_type count)
{ {
byte_t* output = 0; byte_t* output = 0;
int outputLen = 0; long outputLen = 0;
m_session->getMechanism()->encode m_session->getMechanism()->encode
(m_session, reinterpret_cast <const byte_t*>(buffer), count, (m_session, reinterpret_cast <const byte_t*>(buffer), count,

View File

@ -63,8 +63,8 @@ const string builtinSASLMechanism::getName() const
bool builtinSASLMechanism::step bool builtinSASLMechanism::step
(ref <SASLSession> sess, const byte_t* challenge, const int challengeLen, (ref <SASLSession> sess, const byte_t* challenge, const long challengeLen,
byte_t** response, int* responseLen) byte_t** response, long* responseLen)
{ {
char* output = 0; char* output = 0;
size_t outputLen = 0; size_t outputLen = 0;
@ -121,8 +121,8 @@ bool builtinSASLMechanism::isComplete() const
void builtinSASLMechanism::encode void builtinSASLMechanism::encode
(ref <SASLSession> sess, const byte_t* input, const int inputLen, (ref <SASLSession> sess, const byte_t* input, const long inputLen,
byte_t** output, int* outputLen) byte_t** output, long* outputLen)
{ {
char* coutput = 0; char* coutput = 0;
size_t coutputLen = 0; size_t coutputLen = 0;
@ -154,8 +154,8 @@ void builtinSASLMechanism::encode
void builtinSASLMechanism::decode void builtinSASLMechanism::decode
(ref <SASLSession> sess, const byte_t* input, const int inputLen, (ref <SASLSession> sess, const byte_t* input, const long inputLen,
byte_t** output, int* outputLen) byte_t** output, long* outputLen)
{ {
char* coutput = 0; char* coutput = 0;
size_t coutputLen = 0; size_t coutputLen = 0;

View File

@ -197,8 +197,8 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
// Process the data // Process the data
char buffer[16384]; char buffer[16384];
int bufferLength = 0; utility::stream::size_type bufferLength = 0;
int bufferPos = 0; utility::stream::size_type bufferPos = 0;
utility::stream::size_type total = 0; utility::stream::size_type total = 0;
utility::stream::size_type inTotal = 0; utility::stream::size_type inTotal = 0;

View File

@ -178,8 +178,8 @@ utility::stream::size_type qpEncoder::encode(utility::inputStream& in,
// Process the data // Process the data
char buffer[16384]; char buffer[16384];
int bufferLength = 0; utility::stream::size_type bufferLength = 0;
int bufferPos = 0; utility::stream::size_type bufferPos = 0;
string::size_type curCol = 0; string::size_type curCol = 0;
@ -380,8 +380,8 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in,
const bool rfc2047 = getProperties().getProperty <bool>("rfc2047", false); const bool rfc2047 = getProperties().getProperty <bool>("rfc2047", false);
char buffer[16384]; char buffer[16384];
int bufferLength = 0; utility::stream::size_type bufferLength = 0;
int bufferPos = 0; utility::stream::size_type bufferPos = 0;
unsigned char outBuffer[16384]; unsigned char outBuffer[16384];
int outBufferPos = 0; int outBufferPos = 0;

View File

@ -52,15 +52,15 @@ const std::vector <string> uuEncoder::getAvailableProperties() const
// This is the character encoding function to make a character printable // 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 <unsigned char>((c & 077) + ' ');
} }
// Single character decoding // 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 <unsigned char>((c - ' ') & 077);
} }

View File

@ -31,7 +31,7 @@ namespace utility {
// progressListenerSizeAdapter // progressListenerSizeAdapter
progressListenerSizeAdapter::progressListenerSizeAdapter progressListenerSizeAdapter::progressListenerSizeAdapter
(progressListener* list, const int total) (progressListener* list, const long total)
: m_wrapped(list), m_total(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) if (m_wrapped)
m_wrapped->start(predictedTotal); 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) 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) if (m_wrapped)
{ {

View File

@ -93,7 +93,7 @@ public:
* @param output output buffer * @param output output buffer
* @param outputLen length of 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. /** Helper function for encoding challenge in Base64.
* *
@ -101,7 +101,7 @@ public:
* @param inputLen length of input buffer * @param inputLen length of input buffer
* @return Base64-encoded challenge * @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: private:

View File

@ -72,8 +72,8 @@ public:
*/ */
virtual bool step virtual bool step
(ref <SASLSession> sess, (ref <SASLSession> sess,
const byte_t* challenge, const int challengeLen, const byte_t* challenge, const long challengeLen,
byte_t** response, int* responseLen) = 0; byte_t** response, long* responseLen) = 0;
/** Check whether authentication has completed. If false, more /** Check whether authentication has completed. If false, more
* calls to evaluateChallenge() are needed to complete the * calls to evaluateChallenge() are needed to complete the
@ -98,8 +98,8 @@ public:
* 'outputLen' are undetermined) * 'outputLen' are undetermined)
*/ */
virtual void encode(ref <SASLSession> sess, virtual void encode(ref <SASLSession> sess,
const byte_t* input, const int inputLen, const byte_t* input, const long inputLen,
byte_t** output, int* outputLen) = 0; byte_t** output, long* outputLen) = 0;
/** Decode data according to negotiated SASL mechanism. This /** Decode data according to negotiated SASL mechanism. This
* might mean that data is integrity or privacy protected. * might mean that data is integrity or privacy protected.
@ -115,8 +115,8 @@ public:
* 'outputLen' are undetermined) * 'outputLen' are undetermined)
*/ */
virtual void decode(ref <SASLSession> sess, virtual void decode(ref <SASLSession> sess,
const byte_t* input, const int inputLen, const byte_t* input, const long inputLen,
byte_t** output, int* outputLen) = 0; byte_t** output, long* outputLen) = 0;
}; };

View File

@ -108,8 +108,8 @@ public:
* 'responseLen' are undetermined) * 'responseLen' are undetermined)
*/ */
bool evaluateChallenge bool evaluateChallenge
(const byte_t* challenge, const int challengeLen, (const byte_t* challenge, const long challengeLen,
byte_t** response, int* responseLen); byte_t** response, long* responseLen);
/** Return a socket in which transmitted data is integrity /** Return a socket in which transmitted data is integrity
* and/or privacy protected, depending on the QOP (Quality of * and/or privacy protected, depending on the QOP (Quality of

View File

@ -75,8 +75,8 @@ private:
ref <net::socket> m_wrapped; ref <net::socket> m_wrapped;
byte_t* m_pendingBuffer; byte_t* m_pendingBuffer;
int m_pendingPos; size_type m_pendingPos;
int m_pendingLen; size_type m_pendingLen;
char m_recvBuffer[65536]; char m_recvBuffer[65536];
}; };

View File

@ -56,18 +56,18 @@ public:
const string getName() const; const string getName() const;
bool step(ref <SASLSession> sess, bool step(ref <SASLSession> sess,
const byte_t* challenge, const int challengeLen, const byte_t* challenge, const long challengeLen,
byte_t** response, int* responseLen); byte_t** response, long* responseLen);
bool isComplete() const; bool isComplete() const;
void encode(ref <SASLSession> sess, void encode(ref <SASLSession> sess,
const byte_t* input, const int inputLen, const byte_t* input, const long inputLen,
byte_t** output, int* outputLen); byte_t** output, long* outputLen);
void decode(ref <SASLSession> sess, void decode(ref <SASLSession> sess,
const byte_t* input, const int inputLen, const byte_t* input, const long inputLen,
byte_t** output, int* outputLen); byte_t** output, long* outputLen);
private: private:

View File

@ -55,20 +55,20 @@ public:
* @param predictedTotal predicted amount of units (this has * @param predictedTotal predicted amount of units (this has
* no concrete meaning: these are not bytes, nor percentage...) * 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). /** Called during the operation (can be called several times).
* *
* @param current current position * @param current current position
* @param currentTotal adjusted total amount of units * @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. /** Called at the end of the operation.
* *
* @param total final total amount of units * @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 list wrapped progress listener (can be NULL)
* @param total predicted total * @param total predicted total
*/ */
progressListenerSizeAdapter(progressListener* list, const int total); progressListenerSizeAdapter(progressListener* list, const long total);
bool cancel() const; bool cancel() const;
void start(const int predictedTotal); void start(const long predictedTotal);
void progress(const int current, const int currentTotal); void progress(const long current, const long currentTotal);
void stop(const int total); void stop(const long total);
private: private:
progressListener* m_wrapped; progressListener* m_wrapped;
int m_total; long m_total;
}; };